From d62834fa94fca5829a76710a8afad3ff30c44bab Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 18 Nov 2024 16:57:56 +0100 Subject: [PATCH 01/32] Reapply object tree-shaking This reverts commit 10bc15096ffe3c155fe5e81f1e474f208adbc667. --- LICENSE.md | 22 +-- scripts/ast-types.js | 6 +- scripts/generate-buffer-parsers.js | 1 + scripts/prepare-release.js | 6 +- src/Graph.ts | 4 +- src/Module.ts | 47 ++++--- src/ast/ExecutionContext.ts | 10 +- src/ast/bufferParsers.ts | 12 +- src/ast/nodes/ArrayExpression.ts | 8 +- src/ast/nodes/ArrayPattern.ts | 76 +++++++++-- src/ast/nodes/ArrowFunctionExpression.ts | 16 ++- src/ast/nodes/AssignmentExpression.ts | 21 ++- src/ast/nodes/AssignmentPattern.ts | 48 ++++++- src/ast/nodes/AwaitExpression.ts | 9 +- src/ast/nodes/BinaryExpression.ts | 4 +- src/ast/nodes/BlockStatement.ts | 9 +- src/ast/nodes/BreakStatement.ts | 11 +- src/ast/nodes/CallExpression.ts | 34 +++-- src/ast/nodes/CatchClause.ts | 9 +- src/ast/nodes/ChainExpression.ts | 4 +- src/ast/nodes/ClassBody.ts | 13 +- src/ast/nodes/ConditionalExpression.ts | 34 ++--- src/ast/nodes/ContinueStatement.ts | 11 +- src/ast/nodes/DoWhileStatement.ts | 9 +- src/ast/nodes/ExportDefaultDeclaration.ts | 12 +- src/ast/nodes/ForInStatement.ts | 18 ++- src/ast/nodes/ForOfStatement.ts | 16 ++- src/ast/nodes/ForStatement.ts | 15 +- src/ast/nodes/Identifier.ts | 128 +++++++++++++----- src/ast/nodes/IfStatement.ts | 27 ++-- src/ast/nodes/ImportExpression.ts | 34 +++-- src/ast/nodes/JSXOpeningFragment.ts | 9 +- src/ast/nodes/LabeledStatement.ts | 17 ++- src/ast/nodes/LogicalExpression.ts | 20 +-- src/ast/nodes/MemberExpression.ts | 124 +++++++++++++---- src/ast/nodes/MetaProperty.ts | 2 +- src/ast/nodes/NewExpression.ts | 19 ++- src/ast/nodes/ObjectExpression.ts | 51 +++++-- src/ast/nodes/ObjectPattern.ts | 78 +++++++++-- src/ast/nodes/Program.ts | 9 +- src/ast/nodes/Property.ts | 108 +++++++++++---- src/ast/nodes/PropertyDefinition.ts | 8 +- src/ast/nodes/RestElement.ts | 68 +++++++++- src/ast/nodes/ReturnStatement.ts | 9 +- src/ast/nodes/SequenceExpression.ts | 14 +- src/ast/nodes/SpreadElement.ts | 9 +- src/ast/nodes/StaticBlock.ts | 9 +- src/ast/nodes/Super.ts | 11 +- src/ast/nodes/SwitchCase.ts | 11 +- src/ast/nodes/SwitchStatement.ts | 11 +- src/ast/nodes/TaggedTemplateExpression.ts | 24 ++-- src/ast/nodes/TemplateElement.ts | 2 +- src/ast/nodes/ThisExpression.ts | 12 +- src/ast/nodes/ThrowStatement.ts | 9 +- src/ast/nodes/TryStatement.ts | 14 +- src/ast/nodes/UnaryExpression.ts | 4 +- src/ast/nodes/UnknownNode.ts | 5 +- src/ast/nodes/UpdateExpression.ts | 6 +- src/ast/nodes/VariableDeclaration.ts | 16 ++- src/ast/nodes/VariableDeclarator.ts | 32 +++-- src/ast/nodes/WhileStatement.ts | 9 +- src/ast/nodes/shared/BitFlags.ts | 3 +- src/ast/nodes/shared/CallExpressionBase.ts | 10 +- src/ast/nodes/shared/ClassNode.ts | 35 +++-- src/ast/nodes/shared/Expression.ts | 21 ++- src/ast/nodes/shared/FunctionBase.ts | 117 +++++----------- src/ast/nodes/shared/FunctionNode.ts | 42 +++--- src/ast/nodes/shared/IdentifierBase.ts | 22 ++- src/ast/nodes/shared/JSXElementBase.ts | 9 +- src/ast/nodes/shared/MethodBase.ts | 12 +- src/ast/nodes/shared/MultiExpression.ts | 4 +- src/ast/nodes/shared/Node.ts | 29 ++-- src/ast/nodes/shared/ObjectEntity.ts | 49 ++++++- src/ast/nodes/shared/ObjectMember.ts | 20 +-- src/ast/nodes/shared/Pattern.ts | 26 +++- src/ast/nodes/shared/chainElements.ts | 4 +- src/ast/nodes/shared/jsxHelpers.ts | 6 +- src/ast/nodes/shared/loops.ts | 3 +- src/ast/scopes/BlockScope.ts | 12 +- src/ast/scopes/CatchBodyScope.ts | 13 +- src/ast/scopes/ClassBodyScope.ts | 3 +- src/ast/scopes/FunctionBodyScope.ts | 11 +- src/ast/scopes/FunctionScope.ts | 23 ++-- src/ast/scopes/ModuleScope.ts | 7 +- src/ast/scopes/ParameterScope.ts | 61 +++++---- src/ast/scopes/ReturnValueScope.ts | 56 ++++++++ src/ast/scopes/Scope.ts | 14 +- src/ast/scopes/TrackingScope.ts | 4 +- src/ast/utils/PathTracker.ts | 81 +++++++++-- src/ast/variables/ArgumentsVariable.ts | 9 +- src/ast/variables/ExportDefaultVariable.ts | 12 +- src/ast/variables/ExportShimVariable.ts | 6 +- src/ast/variables/ExternalVariable.ts | 7 +- src/ast/variables/GlobalVariable.ts | 6 +- src/ast/variables/LocalVariable.ts | 98 +++++++++----- src/ast/variables/NamespaceVariable.ts | 10 +- src/ast/variables/ParameterVariable.ts | 108 ++++++++++----- .../variables/SyntheticNamedExportVariable.ts | 8 +- src/ast/variables/ThisVariable.ts | 4 +- src/ast/variables/Variable.ts | 6 +- .../dynamic-import-with-namespace/_config.js | 22 +++ .../_expected/amd/generated-module1.js | 13 ++ .../_expected/amd/generated-module10.js | 13 ++ .../_expected/amd/generated-module2.js | 13 ++ .../_expected/amd/generated-module3.js | 7 + .../_expected/amd/generated-module4.js | 13 ++ .../_expected/amd/generated-module5.js | 13 ++ .../_expected/amd/generated-module6.js | 7 + .../_expected/amd/generated-module7.js | 13 ++ .../_expected/amd/generated-module8.js | 13 ++ .../_expected/amd/generated-module9.js | 7 + .../_expected/amd/main.js | 87 ++++++++++++ .../_expected/cjs/generated-module1.js | 11 ++ .../_expected/cjs/generated-module10.js | 11 ++ .../_expected/cjs/generated-module2.js | 11 ++ .../_expected/cjs/generated-module3.js | 5 + .../_expected/cjs/generated-module4.js | 11 ++ .../_expected/cjs/generated-module5.js | 11 ++ .../_expected/cjs/generated-module6.js | 5 + .../_expected/cjs/generated-module7.js | 11 ++ .../_expected/cjs/generated-module8.js | 11 ++ .../_expected/cjs/generated-module9.js | 5 + .../_expected/cjs/main.js | 85 ++++++++++++ .../_expected/es/generated-module1.js | 6 + .../_expected/es/generated-module10.js | 6 + .../_expected/es/generated-module2.js | 6 + .../_expected/es/generated-module3.js | 3 + .../_expected/es/generated-module4.js | 6 + .../_expected/es/generated-module5.js | 6 + .../_expected/es/generated-module6.js | 3 + .../_expected/es/generated-module7.js | 6 + .../_expected/es/generated-module8.js | 6 + .../_expected/es/generated-module9.js | 3 + .../_expected/es/main.js | 83 ++++++++++++ .../_expected/system/generated-module1.js | 13 ++ .../_expected/system/generated-module10.js | 13 ++ .../_expected/system/generated-module2.js | 13 ++ .../_expected/system/generated-module3.js | 10 ++ .../_expected/system/generated-module4.js | 13 ++ .../_expected/system/generated-module5.js | 13 ++ .../_expected/system/generated-module6.js | 10 ++ .../_expected/system/generated-module7.js | 13 ++ .../_expected/system/generated-module8.js | 13 ++ .../_expected/system/generated-module9.js | 10 ++ .../_expected/system/main.js | 92 +++++++++++++ .../dynamic-import-with-namespace/main.js | 83 ++++++++++++ .../dynamic-import-with-namespace/module.js | 4 + .../no-default-deoptimization/_expected.js | 2 +- .../{_expected/es.js => _expected.js} | 0 .../computed-properties/_expected/amd.js | 19 --- .../computed-properties/_expected/cjs.js | 17 --- .../computed-properties/_expected/iife.js | 22 --- .../computed-properties/_expected/system.js | 21 --- .../computed-properties/_expected/umd.js | 23 ---- .../destructured-known-arguments/_config.js | 3 + .../destructured-known-arguments/_expected.js | 28 ++++ .../destructured-known-arguments/main.js | 32 +++++ .../_expected.js | 2 +- .../_config.js | 4 + .../_expected.js | 4 + .../ignore-property-read-side-effects/main.js | 8 ++ .../_config.js | 3 + .../_expected.js | 7 + .../main.js | 9 ++ .../remove-props-via-destructuring/_config.js | 3 + .../_expected.js | 9 ++ .../remove-props-via-destructuring/main.js | 9 ++ .../remove-unused-nested-props/_config.js | 3 + .../remove-unused-nested-props/_expected.js | 2 + .../remove-unused-nested-props/main.js | 2 + .../_config.js | 4 + .../_expected.js | 6 + .../main.js | 8 ++ .../remove-unused-parameter-props/_config.js | 3 + .../_expected.js | 18 +++ .../remove-unused-parameter-props/main.js | 22 +++ .../remove-unused-props/_config.js | 3 + .../remove-unused-props/_expected.js | 5 + .../remove-unused-props/main.js | 5 + .../_expected.js | 10 +- .../optional-chaining-namespace/_expected.js | 2 +- .../recursive-destructuring/_config.js | 3 + .../recursive-destructuring/_expected.js | 1 + .../samples/recursive-destructuring/main.js | 1 + .../_expected.js | 7 +- .../_expected/amd.js | 4 +- .../_expected/cjs.js | 4 +- .../_expected/es.js | 4 +- .../_expected/iife.js | 4 +- .../_expected/system.js | 4 +- .../_expected/umd.js | 4 +- .../_expected.js | 2 +- .../_expected.js | 20 +++ .../system-export-declarations/_expected.js | 2 +- .../_expected.js | 27 +++- .../main.js | 4 + .../deoptimize-nested-function-arg/_config.js | 3 + .../deoptimize-nested-function-arg/main.js | 8 ++ .../samples/deoptimize-via-arguments/main.js | 4 +- .../_config.js | 3 + .../dep.js | 2 + .../main.js | 9 ++ .../_config.js | 3 + .../main.js | 13 ++ .../_config.js | 3 + .../main.js | 9 ++ .../do-not-destructure-unused/_config.js | 3 + .../do-not-destructure-unused/main.js | 17 +++ .../exports/_config.js | 13 ++ .../exports/main.js | 4 + .../_config.js | 3 + .../main.js | 6 + .../_config.js | 3 + .../main.js | 6 + .../include-call-arguments-path/_config.js | 3 + .../include-call-arguments-path/main.js | 9 ++ .../include-destructuring-rest/_config.js | 3 + .../include-destructuring-rest/main.js | 15 ++ .../_config.js | 6 + .../dep.js | 1 + .../main.js | 4 + .../_config.js | 3 + .../main.js | 5 + .../include-this-unknown-function/_config.js | 8 ++ .../include-this-unknown-function/main.js | 11 ++ .../_config.js | 3 + .../main.js | 36 +++++ .../_config.js | 3 + .../main.js | 34 +++++ .../_config.js | 3 + .../main.js | 33 +++++ .../object-side-effects/_config.js | 3 + .../object-side-effects/main.js | 22 +++ .../_config.js | 3 + .../main.js | 14 ++ .../_config.js | 3 + .../main.js | 13 ++ .../_config.js | 3 + .../main.js | 13 ++ .../track-destructured-setter/_config.js | 3 + .../track-destructured-setter/main.js | 8 ++ .../_config.js | 6 + .../main.js | 6 + .../_config.js | 8 ++ .../object-tree-shaking-for-parameter/main.js | 15 ++ .../_config.js | 3 + .../main.js | 7 + .../_config.js | 3 + .../main.js | 3 + .../module.js | 2 + .../_config.js | 3 + .../main.js | 6 + .../_config.js | 3 + .../main.js | 2 + .../module.js | 1 + .../preserve-var-declaration/_config.js | 3 + .../samples/preserve-var-declaration/main.js | 5 + .../_config.js | 6 + .../recursive-calls-without-treeshake/main.js | 10 ++ .../_config.js | 3 + .../main.js | 2 + 261 files changed, 3211 insertions(+), 869 deletions(-) create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_config.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module1.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module10.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module2.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module3.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module4.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module5.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module6.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module7.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module8.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module9.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/main.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module1.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module10.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module2.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module3.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module4.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module5.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module6.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module7.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module8.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module9.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/main.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module1.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module10.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module2.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module3.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module4.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module5.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module6.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module7.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module8.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module9.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/main.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module1.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module10.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module2.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module3.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module4.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module5.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module6.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module7.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module8.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module9.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/main.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/main.js create mode 100644 test/chunking-form/samples/dynamic-import-with-namespace/module.js rename test/form/samples/computed-properties/{_expected/es.js => _expected.js} (100%) delete mode 100644 test/form/samples/computed-properties/_expected/amd.js delete mode 100644 test/form/samples/computed-properties/_expected/cjs.js delete mode 100644 test/form/samples/computed-properties/_expected/iife.js delete mode 100644 test/form/samples/computed-properties/_expected/system.js delete mode 100644 test/form/samples/computed-properties/_expected/umd.js create mode 100644 test/form/samples/destructured-known-arguments/_config.js create mode 100644 test/form/samples/destructured-known-arguments/_expected.js create mode 100644 test/form/samples/destructured-known-arguments/main.js create mode 100644 test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/main.js create mode 100644 test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/main.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/main.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-nested-props/main.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/main.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/main.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-props/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-props/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/remove-unused-props/main.js create mode 100644 test/form/samples/recursive-destructuring/_config.js create mode 100644 test/form/samples/recursive-destructuring/_expected.js create mode 100644 test/form/samples/recursive-destructuring/main.js create mode 100644 test/function/samples/deoptimize-nested-function-arg/_config.js create mode 100644 test/function/samples/deoptimize-nested-function-arg/main.js create mode 100644 test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/dep.js create mode 100644 test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/main.js create mode 100644 test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/main.js create mode 100644 test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/main.js create mode 100644 test/function/samples/object-expression-treeshaking/do-not-destructure-unused/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/do-not-destructure-unused/main.js create mode 100644 test/function/samples/object-expression-treeshaking/exports/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/exports/main.js create mode 100644 test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/main.js create mode 100644 test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-call-arguments-path/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-call-arguments-path/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-destructuring-rest/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-destructuring-rest/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/dep.js create mode 100644 test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-this-unknown-function/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-this-unknown-function/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/main.js create mode 100644 test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/main.js create mode 100644 test/function/samples/object-expression-treeshaking/object-side-effects/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/object-side-effects/main.js create mode 100644 test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/main.js create mode 100644 test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/main.js create mode 100644 test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/main.js create mode 100644 test/function/samples/object-expression-treeshaking/track-destructured-setter/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/track-destructured-setter/main.js create mode 100644 test/function/samples/object-tree-shaking-for-global-assignment/_config.js create mode 100644 test/function/samples/object-tree-shaking-for-global-assignment/main.js create mode 100644 test/function/samples/object-tree-shaking-for-parameter/_config.js create mode 100644 test/function/samples/object-tree-shaking-for-parameter/main.js create mode 100644 test/function/samples/object-tree-shaking-in-function-self-call/_config.js create mode 100644 test/function/samples/object-tree-shaking-in-function-self-call/main.js create mode 100644 test/function/samples/object-tree-shaking-with-destructed-export/_config.js create mode 100644 test/function/samples/object-tree-shaking-with-destructed-export/main.js create mode 100644 test/function/samples/object-tree-shaking-with-destructed-export/module.js create mode 100644 test/function/samples/object-tree-shaking-with-duplicated-function-call/_config.js create mode 100644 test/function/samples/object-tree-shaking-with-duplicated-function-call/main.js create mode 100644 test/function/samples/preserve-exported-object-in-namespace/_config.js create mode 100644 test/function/samples/preserve-exported-object-in-namespace/main.js create mode 100644 test/function/samples/preserve-exported-object-in-namespace/module.js create mode 100644 test/function/samples/preserve-var-declaration/_config.js create mode 100644 test/function/samples/preserve-var-declaration/main.js create mode 100644 test/function/samples/recursive-calls-without-treeshake/_config.js create mode 100644 test/function/samples/recursive-calls-without-treeshake/main.js create mode 100644 test/function/samples/wrap-empty-object-with-double-brackets/_config.js create mode 100644 test/function/samples/wrap-empty-object-with-double-brackets/main.js diff --git a/LICENSE.md b/LICENSE.md index 868fbf14986..ce44fa22e5b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -13,7 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI # Licenses of bundled dependencies The published Rollup artifact additionally contains code with the following licenses: -MIT, ISC, 0BSD +MIT, ISC # Bundled dependencies: ## @jridgewell/sourcemap-codec @@ -632,26 +632,6 @@ Repository: micromatch/to-regex-range --------------------------------------- -## tslib -License: 0BSD -By: Microsoft Corp. -Repository: https://github.com/Microsoft/tslib.git - -> Copyright (c) Microsoft Corporation. -> -> Permission to use, copy, modify, and/or distribute this software for any -> purpose with or without fee is hereby granted. -> -> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -> AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -> PERFORMANCE OF THIS SOFTWARE. - ---------------------------------------- - ## yargs-parser License: ISC By: Ben Coe diff --git a/scripts/ast-types.js b/scripts/ast-types.js index d69c45d9d3e..831cfc556e1 100644 --- a/scripts/ast-types.js +++ b/scripts/ast-types.js @@ -88,7 +88,7 @@ export const AST_NODES = { 'parameters', `scope.addParameterVariables( parameters.map( - parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION) as ParameterVariable[] + parameter => parameter.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION) as ParameterVariable[] ), parameters[parameters.length - 1] instanceof RestElement );` @@ -153,7 +153,7 @@ export const AST_NODES = { ['body', 'Node'] ], postProcessFields: { - param: ['parameter', "parameter?.declare('parameter', UNKNOWN_EXPRESSION)"] + param: ['parameter', "parameter?.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION)"] }, scopes: { body: 'scope.bodyScope' @@ -310,7 +310,7 @@ export const AST_NODES = { 'parameters', `scope.addParameterVariables( parameters.map( - parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION) as ParameterVariable[] + parameter => parameter.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION) as ParameterVariable[] ), parameters[parameters.length - 1] instanceof RestElement );` diff --git a/scripts/generate-buffer-parsers.js b/scripts/generate-buffer-parsers.js index 801079f5b24..051151e05bc 100644 --- a/scripts/generate-buffer-parsers.js +++ b/scripts/generate-buffer-parsers.js @@ -178,6 +178,7 @@ import type { Node, NodeBase } from './nodes/shared/Node'; import type ChildScope from './scopes/ChildScope'; import type ModuleScope from './scopes/ModuleScope'; import TrackingScope from './scopes/TrackingScope'; +import { EMPTY_PATH } from './utils/PathTracker'; import type ParameterVariable from './variables/ParameterVariable'; export function convertProgram( diff --git a/scripts/prepare-release.js b/scripts/prepare-release.js index 87eb2834c8b..720bcd68e84 100755 --- a/scripts/prepare-release.js +++ b/scripts/prepare-release.js @@ -192,10 +192,8 @@ function getDummyLogSection(headline, pr) { * @return {Promise} */ async function installDependenciesAndLint() { - await Promise.all([ - runWithEcho('npm', ['ci', '--ignore-scripts']), - runWithEcho('npm', ['run', 'check-audit']) - ]); + await runWithEcho('npm', ['ci', '--ignore-scripts']); + await runWithEcho('npm', ['run', 'check-audit']); await runWithEcho('npm', ['run', 'ci:lint']); } diff --git a/src/Graph.ts b/src/Graph.ts index 36781821267..3398fbf0b63 100644 --- a/src/Graph.ts +++ b/src/Graph.ts @@ -1,6 +1,6 @@ import flru from 'flru'; import GlobalScope from './ast/scopes/GlobalScope'; -import { PathTracker } from './ast/utils/PathTracker'; +import { EntityPathTracker } from './ast/utils/PathTracker'; import type ExternalModule from './ExternalModule'; import Module from './Module'; import { ModuleLoader, type UnresolvedModule } from './ModuleLoader'; @@ -54,7 +54,7 @@ function normalizeEntryModules( export default class Graph { readonly astLru = flru(5); readonly cachedModules = new Map(); - readonly deoptimizationTracker = new PathTracker(); + readonly deoptimizationTracker = new EntityPathTracker(); entryModules: Module[] = []; readonly fileOperationQueue: Queue; readonly moduleLoader: ModuleLoader; diff --git a/src/Module.ts b/src/Module.ts index 3e91e863cb2..7d6dd0cc1be 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -20,7 +20,12 @@ import type Program from './ast/nodes/Program'; import type { NodeBase } from './ast/nodes/shared/Node'; import VariableDeclaration from './ast/nodes/VariableDeclaration'; import ModuleScope from './ast/scopes/ModuleScope'; -import { type PathTracker, UNKNOWN_PATH } from './ast/utils/PathTracker'; +import { + EMPTY_PATH, + type EntityPathTracker, + type ObjectPath, + UNKNOWN_PATH +} from './ast/utils/PathTracker'; import ExportDefaultVariable from './ast/variables/ExportDefaultVariable'; import ExportShimVariable from './ast/variables/ExportShimVariable'; import ExternalVariable from './ast/variables/ExternalVariable'; @@ -116,7 +121,7 @@ export interface AstContext { addImportMeta: (node: MetaProperty) => void; addImportSource: (importSource: string) => void; code: string; - deoptimizationTracker: PathTracker; + deoptimizationTracker: EntityPathTracker; error: (properties: RollupLog, pos: number) => never; fileName: string; getExports: () => string[]; @@ -128,7 +133,7 @@ export interface AstContext { importDescriptions: Map; includeAllExports: () => void; includeDynamicImport: (node: ImportExpression) => void; - includeVariableInModule: (variable: Variable) => void; + includeVariableInModule: (variable: Variable, path: ObjectPath) => void; log: (level: LogLevel, properties: RollupLog, pos: number) => void; magicString: MagicString; manualPureFunctions: PureFunctions; @@ -699,7 +704,7 @@ export default class Module { include(): void { const context = createInclusionContext(); - if (this.ast!.shouldBeIncluded(context)) this.ast!.include(context, false); + if (this.ast!.shouldBeIncluded(context)) this.ast!.includePath(EMPTY_PATH, context, false); } includeAllExports(includeNamespaceMembers: boolean): void { @@ -715,9 +720,7 @@ export default class Module { return error(logMissingEntryExport(exportName, this.id)); } variable.deoptimizePath(UNKNOWN_PATH); - if (!variable.included) { - this.includeVariable(variable); - } + this.includeVariable(variable, UNKNOWN_PATH); } } @@ -726,7 +729,7 @@ export default class Module { if (variable) { variable.deoptimizePath(UNKNOWN_PATH); if (!variable.included) { - this.includeVariable(variable); + this.includeVariable(variable, UNKNOWN_PATH); } if (variable instanceof ExternalVariable) { variable.module.reexported = true; @@ -740,7 +743,7 @@ export default class Module { } includeAllInBundle(): void { - this.ast!.include(createInclusionContext(), true); + this.ast!.includePath(UNKNOWN_PATH, createInclusionContext(), true); this.includeAllExports(false); } @@ -757,7 +760,7 @@ export default class Module { if (variable) { variable.deoptimizePath(UNKNOWN_PATH); if (!variable.included) { - this.includeVariable(variable); + this.includeVariable(variable, UNKNOWN_PATH); } } @@ -1336,12 +1339,12 @@ export default class Module { for (const module of [this, ...this.exportAllModules]) { if (module instanceof ExternalModule) { const [externalVariable] = module.getVariableForExportName('*'); - externalVariable.include(); + externalVariable.includePath(UNKNOWN_PATH, createInclusionContext()); this.includedImports.add(externalVariable); externalNamespaces.add(externalVariable); } else if (module.info.syntheticNamedExports) { const syntheticNamespace = module.getSyntheticNamespace(); - syntheticNamespace.include(); + syntheticNamespace.includePath(UNKNOWN_PATH, createInclusionContext()); this.includedImports.add(syntheticNamespace); syntheticNamespaces.add(syntheticNamespace); } @@ -1350,14 +1353,14 @@ export default class Module { } private includeDynamicImport(node: ImportExpression): void { - const resolution = ( - this.dynamicImports.find(dynamicImport => dynamicImport.node === node) as { - resolution: string | Module | ExternalModule | undefined; - } - ).resolution; + const resolution = this.dynamicImports.find( + dynamicImport => dynamicImport.node === node + )!.resolution; if (resolution instanceof Module) { - resolution.includedDynamicImporters.push(this); + if (!resolution.includedDynamicImporters.includes(this)) { + resolution.includedDynamicImporters.push(this); + } const importedNames = this.options.treeshake ? node.getDeterministicImportedNames() @@ -1371,14 +1374,13 @@ export default class Module { } } - private includeVariable(variable: Variable): void { + private includeVariable(variable: Variable, path: ObjectPath): void { const variableModule = variable.module; if (variable.included) { if (variableModule instanceof Module && variableModule !== this) { getAndExtendSideEffectModules(variable, this); } } else { - variable.include(); this.graph.needsTreeshakingPass = true; if (variableModule instanceof Module) { if (!variableModule.isExecuted) { @@ -1394,10 +1396,11 @@ export default class Module { } } } + variable.includePath(path, createInclusionContext()); } - private includeVariableInModule(variable: Variable): void { - this.includeVariable(variable); + private includeVariableInModule(variable: Variable, path: ObjectPath): void { + this.includeVariable(variable, path); const variableModule = variable.module; if (variableModule && variableModule !== this) { this.includedImports.add(variable); diff --git a/src/ast/ExecutionContext.ts b/src/ast/ExecutionContext.ts index 3906fb7b97e..df7bb363769 100644 --- a/src/ast/ExecutionContext.ts +++ b/src/ast/ExecutionContext.ts @@ -1,6 +1,6 @@ import type { Entity } from './Entity'; import type { ExpressionEntity } from './nodes/shared/Expression'; -import { DiscriminatedPathTracker, PathTracker } from './utils/PathTracker'; +import { DiscriminatedPathTracker, EntityPathTracker } from './utils/PathTracker'; import type ThisVariable from './variables/ThisVariable'; interface ExecutionContextIgnore { @@ -23,8 +23,8 @@ export interface InclusionContext extends ControlFlowContext { } export interface HasEffectsContext extends ControlFlowContext { - accessed: PathTracker; - assigned: PathTracker; + accessed: EntityPathTracker; + assigned: EntityPathTracker; brokenFlow: boolean; called: DiscriminatedPathTracker; ignore: ExecutionContextIgnore; @@ -44,8 +44,8 @@ export function createInclusionContext(): InclusionContext { export function createHasEffectsContext(): HasEffectsContext { return { - accessed: new PathTracker(), - assigned: new PathTracker(), + accessed: new EntityPathTracker(), + assigned: new EntityPathTracker(), brokenFlow: false, called: new DiscriminatedPathTracker(), hasBreak: false, diff --git a/src/ast/bufferParsers.ts b/src/ast/bufferParsers.ts index 8a7b8128f98..385610ed39c 100644 --- a/src/ast/bufferParsers.ts +++ b/src/ast/bufferParsers.ts @@ -103,6 +103,7 @@ import type { Node, NodeBase } from './nodes/shared/Node'; import type ChildScope from './scopes/ChildScope'; import type ModuleScope from './scopes/ModuleScope'; import TrackingScope from './scopes/TrackingScope'; +import { EMPTY_PATH } from './utils/PathTracker'; import type ParameterVariable from './variables/ParameterVariable'; export function convertProgram( @@ -335,7 +336,8 @@ const bufferParsers: ((node: any, position: number, buffer: AstBuffer) => void)[ const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer)); scope.addParameterVariables( parameters.map( - parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION) as ParameterVariable[] + parameter => + parameter.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION) as ParameterVariable[] ), parameters[parameters.length - 1] instanceof RestElement ); @@ -384,7 +386,7 @@ const bufferParsers: ((node: any, position: number, buffer: AstBuffer) => void)[ const parameterPosition = buffer[position]; const parameter = (node.param = parameterPosition === 0 ? null : convertNode(node, scope, parameterPosition, buffer)); - parameter?.declare('parameter', UNKNOWN_EXPRESSION); + parameter?.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION); node.body = convertNode(node, scope.bodyScope, buffer[position + 1], buffer); }, function chainExpression(node: ChainExpression, position, buffer) { @@ -528,7 +530,8 @@ const bufferParsers: ((node: any, position: number, buffer: AstBuffer) => void)[ const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer)); scope.addParameterVariables( parameters.map( - parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION) as ParameterVariable[] + parameter => + parameter.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION) as ParameterVariable[] ), parameters[parameters.length - 1] instanceof RestElement ); @@ -546,7 +549,8 @@ const bufferParsers: ((node: any, position: number, buffer: AstBuffer) => void)[ const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer)); scope.addParameterVariables( parameters.map( - parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION) as ParameterVariable[] + parameter => + parameter.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION) as ParameterVariable[] ), parameters[parameters.length - 1] instanceof RestElement ); diff --git a/src/ast/nodes/ArrayExpression.ts b/src/ast/nodes/ArrayExpression.ts index 1d731e3642f..739cde53a81 100644 --- a/src/ast/nodes/ArrayExpression.ts +++ b/src/ast/nodes/ArrayExpression.ts @@ -2,8 +2,8 @@ import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { + type EntityPathTracker, type ObjectPath, - type PathTracker, UNKNOWN_PATH, UnknownInteger } from '../utils/PathTracker'; @@ -23,7 +23,7 @@ export default class ArrayExpression extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath( interaction, @@ -38,7 +38,7 @@ export default class ArrayExpression extends NodeBase { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.getObjectEntity().getLiteralValueAtPath(path, recursionTracker, origin); @@ -47,7 +47,7 @@ export default class ArrayExpression extends NodeBase { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return this.getObjectEntity().getReturnExpressionWhenCalledAtPath( diff --git a/src/ast/nodes/ArrayPattern.ts b/src/ast/nodes/ArrayPattern.ts index 1cbb302b825..daf57eb35ea 100644 --- a/src/ast/nodes/ArrayPattern.ts +++ b/src/ast/nodes/ArrayPattern.ts @@ -1,15 +1,15 @@ -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteractionAssigned } from '../NodeInteractions'; -import { EMPTY_PATH, type ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, type ObjectPath, UnknownInteger, UnknownKey } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; -import { UNKNOWN_EXPRESSION } from './shared/Expression'; +import type { ExpressionEntity } from './shared/Expression'; import { NodeBase } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; -export default class ArrayPattern extends NodeBase implements PatternNode { +export default class ArrayPattern extends NodeBase implements DeclarationPatternNode { declare elements: (PatternNode | null)[]; declare type: NodeType.tArrayPattern; @@ -22,16 +22,30 @@ export default class ArrayPattern extends NodeBase implements PatternNode { } } - declare(kind: VariableKind): LocalVariable[] { + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[] { const variables: LocalVariable[] = []; + const includedPatternPath = getIncludedPatternPath(destructuredInitPath); for (const element of this.elements) { if (element !== null) { - variables.push(...element.declare(kind, UNKNOWN_EXPRESSION)); + variables.push( + ...(element as DeclarationPatternNode).declare(kind, includedPatternPath, init) + ); } } return variables; } + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity): void { + const includedPatternPath = getIncludedPatternPath(destructuredInitPath); + for (const element of this.elements) { + element?.deoptimizeAssignment(includedPatternPath, init); + } + } + // Patterns can only be deoptimized at the empty path at the moment deoptimizePath(): void { for (const element of this.elements) { @@ -39,6 +53,20 @@ export default class ArrayPattern extends NodeBase implements PatternNode { } } + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + const includedPatternPath = getIncludedPatternPath(destructuredInitPath); + for (const element of this.elements) { + if (element?.hasEffectsWhenDestructuring(context, includedPatternPath, init)) { + return true; + } + } + return false; + } + // Patterns are only checked at the empty path at the moment hasEffectsOnInteractionAtPath( _path: ObjectPath, @@ -51,9 +79,41 @@ export default class ArrayPattern extends NodeBase implements PatternNode { return false; } + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + let included = false; + const includedPatternPath = getIncludedPatternPath(destructuredInitPath); + for (const element of this.elements) { + if (element) { + element.included ||= included; + included = + element.includeDestructuredIfNecessary(context, includedPatternPath, init) || included; + } + } + if (included) { + // This is necessary so that if any pattern element is included, all are + // included for proper deconflicting + for (const element of this.elements) { + if (element && !element.included) { + element.included = true; + element.includeDestructuredIfNecessary(context, includedPatternPath, init); + } + } + } + return (this.included ||= included); + } + markDeclarationReached(): void { for (const element of this.elements) { - element?.markDeclarationReached(); + (element as DeclarationPatternNode)?.markDeclarationReached(); } } } + +const getIncludedPatternPath = (destructuredInitPath: ObjectPath): ObjectPath => + destructuredInitPath.at(-1) === UnknownKey + ? destructuredInitPath + : [...destructuredInitPath, UnknownInteger]; diff --git a/src/ast/nodes/ArrowFunctionExpression.ts b/src/ast/nodes/ArrowFunctionExpression.ts index c99578c872e..649d10e4a6b 100644 --- a/src/ast/nodes/ArrowFunctionExpression.ts +++ b/src/ast/nodes/ArrowFunctionExpression.ts @@ -3,7 +3,7 @@ import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_CALLED } from '../NodeInteractions'; import type ChildScope from '../scopes/ChildScope'; import ReturnValueScope from '../scopes/ReturnValueScope'; -import { type ObjectPath } from '../utils/PathTracker'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type BlockStatement from './BlockStatement'; import type CallExpression from './CallExpression'; import Identifier from './Identifier'; @@ -13,11 +13,11 @@ import FunctionBase from './shared/FunctionBase'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; import { ObjectEntity } from './shared/ObjectEntity'; import { OBJECT_PROTOTYPE } from './shared/ObjectPrototype'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode } from './shared/Pattern'; export default class ArrowFunctionExpression extends FunctionBase { declare body: BlockStatement | ExpressionNode; - declare params: PatternNode[]; + declare params: DeclarationPatternNode[]; declare preventChildBlockScope: true; declare scope: ReturnValueScope; declare type: NodeType.tArrowFunctionExpression; @@ -75,11 +75,15 @@ export default class ArrowFunctionExpression extends FunctionBase { return isIIFE || super.onlyFunctionCallUsed(); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - super.include(context, includeChildrenRecursively); + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { + super.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); for (const parameter of this.params) { if (!(parameter instanceof Identifier)) { - parameter.include(context, includeChildrenRecursively); + parameter.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } } diff --git a/src/ast/nodes/AssignmentExpression.ts b/src/ast/nodes/AssignmentExpression.ts index aecdf927edf..bce594178cb 100644 --- a/src/ast/nodes/AssignmentExpression.ts +++ b/src/ast/nodes/AssignmentExpression.ts @@ -28,7 +28,7 @@ import { type ExpressionNode, type IncludeChildren, NodeBase } from './shared/No import type { PatternNode } from './shared/Pattern'; export default class AssignmentExpression extends NodeBase { - declare left: ExpressionNode | PatternNode; + declare left: PatternNode; declare operator: | '=' | '+=' @@ -55,7 +55,9 @@ export default class AssignmentExpression extends NodeBase { // MemberExpressions do not access the property before assignments if the // operator is '='. return ( - right.hasEffects(context) || left.hasEffectsAsAssignmentTarget(context, operator !== '=') + right.hasEffects(context) || + left.hasEffectsAsAssignmentTarget(context, operator !== '=') || + this.left.hasEffectsWhenDestructuring?.(context, EMPTY_PATH, right) ); } @@ -67,19 +69,25 @@ export default class AssignmentExpression extends NodeBase { return this.right.hasEffectsOnInteractionAtPath(path, interaction, context); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { const { deoptimized, left, right, operator } = this; if (!deoptimized) this.applyDeoptimizations(); this.included = true; + const hasEffectsContext = createHasEffectsContext(); if ( includeChildrenRecursively || operator !== '=' || left.included || - left.hasEffectsAsAssignmentTarget(createHasEffectsContext(), false) + left.hasEffectsAsAssignmentTarget(hasEffectsContext, false) || + left.hasEffectsWhenDestructuring?.(hasEffectsContext, EMPTY_PATH, right) ) { left.includeAsAssignmentTarget(context, includeChildrenRecursively, operator !== '='); } - right.include(context, includeChildrenRecursively); + right.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } initialise(): void { @@ -164,8 +172,7 @@ export default class AssignmentExpression extends NodeBase { protected applyDeoptimizations(): void { this.deoptimized = true; - this.left.deoptimizePath(EMPTY_PATH); - this.right.deoptimizePath(UNKNOWN_PATH); + this.left.deoptimizeAssignment(EMPTY_PATH, this.right); this.scope.context.requestTreeshakingPass(); } } diff --git a/src/ast/nodes/AssignmentPattern.ts b/src/ast/nodes/AssignmentPattern.ts index a67646b9022..e071fe980fe 100644 --- a/src/ast/nodes/AssignmentPattern.ts +++ b/src/ast/nodes/AssignmentPattern.ts @@ -1,7 +1,7 @@ import type MagicString from 'magic-string'; import { BLANK } from '../../utils/blank'; import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteractionAssigned } from '../NodeInteractions'; import { EMPTY_PATH, type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; @@ -9,10 +9,10 @@ import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import type { ExpressionEntity } from './shared/Expression'; import { type ExpressionNode, NodeBase } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; -export default class AssignmentPattern extends NodeBase implements PatternNode { +export default class AssignmentPattern extends NodeBase implements DeclarationPatternNode { declare left: PatternNode; declare right: ExpressionNode; declare type: NodeType.tAssignmentPattern; @@ -24,8 +24,16 @@ export default class AssignmentPattern extends NodeBase implements PatternNode { this.left.addExportedVariables(variables, exportNamesByVariable); } - declare(kind: VariableKind, init: ExpressionEntity): LocalVariable[] { - return this.left.declare(kind, init); + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[] { + return (this.left as DeclarationPatternNode).declare(kind, destructuredInitPath, init); + } + + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity): void { + this.left.deoptimizeAssignment(destructuredInitPath, init); } deoptimizePath(path: ObjectPath): void { @@ -44,8 +52,36 @@ export default class AssignmentPattern extends NodeBase implements PatternNode { ); } + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + return this.left.hasEffectsWhenDestructuring(context, destructuredInitPath, init); + } + + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + let included = + this.left.includeDestructuredIfNecessary(context, destructuredInitPath, init) || + this.included; + if ((included ||= this.right.shouldBeIncluded(context))) { + this.right.includePath(UNKNOWN_PATH, context, false); + if (!this.left.included) { + this.left.included = true; + // Unfortunately, we need to include the left side again now, so that + // any declared variables are properly included. + this.left.includeDestructuredIfNecessary(context, destructuredInitPath, init); + } + } + return (this.included = included); + } + markDeclarationReached(): void { - this.left.markDeclarationReached(); + (this.left as DeclarationPatternNode).markDeclarationReached(); } render( diff --git a/src/ast/nodes/AwaitExpression.ts b/src/ast/nodes/AwaitExpression.ts index 25f262c0e64..55585f265d0 100644 --- a/src/ast/nodes/AwaitExpression.ts +++ b/src/ast/nodes/AwaitExpression.ts @@ -1,4 +1,5 @@ import type { InclusionContext } from '../ExecutionContext'; +import { type ObjectPath } from '../utils/PathTracker'; import ArrowFunctionExpression from './ArrowFunctionExpression'; import type * as NodeType from './NodeType'; import FunctionNode from './shared/FunctionNode'; @@ -13,7 +14,11 @@ export default class AwaitExpression extends NodeBase { return true; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) { this.included = true; @@ -26,6 +31,6 @@ export default class AwaitExpression extends NodeBase { this.scope.context.usesTopLevelAwait = true; } } - this.argument.include(context, includeChildrenRecursively); + this.argument.includePath(path, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/BinaryExpression.ts b/src/ast/nodes/BinaryExpression.ts index 7c969f3b612..8021d923bf2 100644 --- a/src/ast/nodes/BinaryExpression.ts +++ b/src/ast/nodes/BinaryExpression.ts @@ -7,8 +7,8 @@ import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, - type PathTracker, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; import ExpressionStatement from './ExpressionStatement'; @@ -80,7 +80,7 @@ export default class BinaryExpression extends NodeBase implements DeoptimizableE getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { if (path.length > 0) return UnknownValue; diff --git a/src/ast/nodes/BlockStatement.ts b/src/ast/nodes/BlockStatement.ts index 22c332f9b64..ff6baa33180 100644 --- a/src/ast/nodes/BlockStatement.ts +++ b/src/ast/nodes/BlockStatement.ts @@ -3,6 +3,7 @@ import { type RenderOptions, renderStatementList } from '../../utils/renderHelpe import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import ExpressionStatement from './ExpressionStatement'; import * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; @@ -49,14 +50,18 @@ export default class BlockStatement extends StatementBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!(this.deoptimizeBody && this.directlyIncluded)) { this.included = true; this.directlyIncluded = true; if (this.deoptimizeBody) includeChildrenRecursively = true; for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) - node.include(context, includeChildrenRecursively); + node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } } diff --git a/src/ast/nodes/BreakStatement.ts b/src/ast/nodes/BreakStatement.ts index 836fb356c0c..b3e783e84ea 100644 --- a/src/ast/nodes/BreakStatement.ts +++ b/src/ast/nodes/BreakStatement.ts @@ -1,4 +1,9 @@ -import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; +import { + createInclusionContext, + type HasEffectsContext, + type InclusionContext +} from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; import { StatementBase } from './shared/Node'; @@ -19,10 +24,10 @@ export default class BreakStatement extends StatementBase { return false; } - include(context: InclusionContext): void { + includePath(_: ObjectPath, context: InclusionContext): void { this.included = true; if (this.label) { - this.label.include(); + this.label.includePath(UNKNOWN_PATH, createInclusionContext()); context.includedLabels.add(this.label.name); } else { context.hasBreak = true; diff --git a/src/ast/nodes/CallExpression.ts b/src/ast/nodes/CallExpression.ts index ae18f87580a..531a9c5d25e 100644 --- a/src/ast/nodes/CallExpression.ts +++ b/src/ast/nodes/CallExpression.ts @@ -8,20 +8,20 @@ import { type NodeRenderOptions, type RenderOptions } from '../../utils/renderHe import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { INTERACTION_CALLED } from '../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; -import { EMPTY_PATH, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; import Identifier from './Identifier'; import MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; -import type SpreadElement from './SpreadElement'; -import type Super from './Super'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import CallExpressionBase from './shared/CallExpressionBase'; +import { getChainElementLiteralValueAtPath } from './shared/chainElements'; import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expression'; import { UNKNOWN_RETURN_EXPRESSION } from './shared/Expression'; import type { ChainElement, ExpressionNode, IncludeChildren, SkippedChain } from './shared/Node'; import { INCLUDE_PARAMETERS, IS_SKIPPED_CHAIN } from './shared/Node'; -import { getChainElementLiteralValueAtPath } from './shared/chainElements'; +import type SpreadElement from './SpreadElement'; +import type Super from './Super'; export default class CallExpression extends CallExpressionBase @@ -67,7 +67,7 @@ export default class CallExpression getLiteralValueAtPathAsChainElement( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown | SkippedChain { return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin); @@ -111,10 +111,14 @@ export default class CallExpression ); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { - super.include(context, includeChildrenRecursively); + super.includePath(path, context, includeChildrenRecursively); if ( includeChildrenRecursively === INCLUDE_PARAMETERS && this.callee instanceof Identifier && @@ -124,9 +128,17 @@ export default class CallExpression } } else { this.included = true; - this.callee.include(context, false); + // If the callee is a member expression and does not have a variable, its + // object will already be included via the first argument of the + // interaction in includeCallArguments. Including it again can lead to + // severe performance problems. + if (this.callee instanceof MemberExpression && !this.callee.variable) { + this.callee.property.includePath(UNKNOWN_PATH, context, false); + } else { + this.callee.includePath(UNKNOWN_PATH, context, false); + } + this.callee.includeCallArguments(context, this.interaction); } - this.callee.includeCallArguments(context, this.arguments); } initialise() { @@ -162,7 +174,7 @@ export default class CallExpression } protected getReturnExpression( - recursionTracker: PathTracker = SHARED_RECURSION_TRACKER + recursionTracker: EntityPathTracker = SHARED_RECURSION_TRACKER ): [expression: ExpressionEntity, isPure: boolean] { if (this.returnExpression === null) { this.returnExpression = UNKNOWN_RETURN_EXPRESSION; diff --git a/src/ast/nodes/CatchClause.ts b/src/ast/nodes/CatchClause.ts index ae9743c2fa9..be2a9d6c23d 100644 --- a/src/ast/nodes/CatchClause.ts +++ b/src/ast/nodes/CatchClause.ts @@ -1,14 +1,15 @@ import type ChildScope from '../scopes/ChildScope'; import ParameterScope from '../scopes/ParameterScope'; +import { EMPTY_PATH } from '../utils/PathTracker'; import BlockStatement from './BlockStatement'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; import { type GenericEsTreeNode, NodeBase } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode } from './shared/Pattern'; export default class CatchClause extends NodeBase { declare body: BlockStatement; - declare param: PatternNode | null; + declare param: DeclarationPatternNode | null; declare preventChildBlockScope: true; declare scope: ParameterScope; declare type: NodeType.tCatchClause; @@ -24,8 +25,8 @@ export default class CatchClause extends NodeBase { this.param = new (this.scope.context.getNodeConstructor(param.type))( this, this.scope - ).parseNode(param) as unknown as PatternNode; - this.param!.declare('parameter', UNKNOWN_EXPRESSION); + ).parseNode(param) as unknown as DeclarationPatternNode; + this.param!.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION); } this.body = new BlockStatement(this, this.scope.bodyScope).parseNode(body); return super.parseNode(esTreeNode); diff --git a/src/ast/nodes/ChainExpression.ts b/src/ast/nodes/ChainExpression.ts index 28b58333231..5bd7868bc64 100644 --- a/src/ast/nodes/ChainExpression.ts +++ b/src/ast/nodes/ChainExpression.ts @@ -1,7 +1,7 @@ import type MagicString from 'magic-string'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext } from '../ExecutionContext'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import type CallExpression from './CallExpression'; import type MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; @@ -17,7 +17,7 @@ export default class ChainExpression extends NodeBase implements DeoptimizableEn getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { const literalValue = this.expression.getLiteralValueAtPathAsChainElement( diff --git a/src/ast/nodes/ClassBody.ts b/src/ast/nodes/ClassBody.ts index 845f21b1547..53590a4d4cb 100644 --- a/src/ast/nodes/ClassBody.ts +++ b/src/ast/nodes/ClassBody.ts @@ -1,13 +1,14 @@ import type { InclusionContext } from '../ExecutionContext'; import type ChildScope from '../scopes/ChildScope'; import ClassBodyScope from '../scopes/ClassBodyScope'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type MethodDefinition from './MethodDefinition'; import type * as NodeType from './NodeType'; import type PropertyDefinition from './PropertyDefinition'; -import type StaticBlock from './StaticBlock'; import type ClassNode from './shared/ClassNode'; import { type GenericEsTreeNode, type IncludeChildren, NodeBase } from './shared/Node'; +import type StaticBlock from './StaticBlock'; export default class ClassBody extends NodeBase { declare body: (MethodDefinition | PropertyDefinition | StaticBlock)[]; @@ -18,11 +19,15 @@ export default class ClassBody extends NodeBase { this.scope = new ClassBodyScope(parentScope, this.parent as ClassNode); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.scope.context.includeVariableInModule(this.scope.thisVariable); + this.scope.context.includeVariableInModule(this.scope.thisVariable, UNKNOWN_PATH); for (const definition of this.body) { - definition.include(context, includeChildrenRecursively); + definition.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/ConditionalExpression.ts b/src/ast/nodes/ConditionalExpression.ts index 1cb7219f739..eac39c2b357 100644 --- a/src/ast/nodes/ConditionalExpression.ts +++ b/src/ast/nodes/ConditionalExpression.ts @@ -9,11 +9,10 @@ import { import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; import { tryCastLiteralValueToBoolean } from '../utils/tryCastLiteralValueToBoolean'; import type * as NodeType from './NodeType'; -import type SpreadElement from './SpreadElement'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expression'; import { UnknownValue } from './shared/Expression'; @@ -40,7 +39,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.consequent.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); this.alternate.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); @@ -71,7 +70,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { const usedBranch = this.getUsedBranch(); @@ -83,7 +82,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { const usedBranch = this.getUsedBranch(); @@ -138,28 +137,29 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz return usedBranch.hasEffectsOnInteractionAtPath(path, interaction, context); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; const usedBranch = this.getUsedBranch(); if (includeChildrenRecursively || this.test.shouldBeIncluded(context) || usedBranch === null) { - this.test.include(context, includeChildrenRecursively); - this.consequent.include(context, includeChildrenRecursively); - this.alternate.include(context, includeChildrenRecursively); + this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.consequent.includePath(path, context, includeChildrenRecursively); + this.alternate.includePath(path, context, includeChildrenRecursively); } else { - usedBranch.include(context, includeChildrenRecursively); + usedBranch.includePath(path, context, includeChildrenRecursively); } } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { const usedBranch = this.getUsedBranch(); if (usedBranch) { - usedBranch.includeCallArguments(context, parameters); + usedBranch.includeCallArguments(context, interaction); } else { - this.consequent.includeCallArguments(context, parameters); - this.alternate.includeCallArguments(context, parameters); + this.consequent.includeCallArguments(context, interaction); + this.alternate.includeCallArguments(context, interaction); } } diff --git a/src/ast/nodes/ContinueStatement.ts b/src/ast/nodes/ContinueStatement.ts index 9e137e1afc6..16c4f8c7ad2 100644 --- a/src/ast/nodes/ContinueStatement.ts +++ b/src/ast/nodes/ContinueStatement.ts @@ -1,4 +1,9 @@ -import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; +import { + createInclusionContext, + type HasEffectsContext, + type InclusionContext +} from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; import { StatementBase } from './shared/Node'; @@ -19,10 +24,10 @@ export default class ContinueStatement extends StatementBase { return false; } - include(context: InclusionContext): void { + includePath(_: ObjectPath, context: InclusionContext): void { this.included = true; if (this.label) { - this.label.include(); + this.label.includePath(UNKNOWN_PATH, createInclusionContext()); context.includedLabels.add(this.label.name); } else { context.hasContinue = true; diff --git a/src/ast/nodes/DoWhileStatement.ts b/src/ast/nodes/DoWhileStatement.ts index 7b74b9ad71b..829aaae340c 100644 --- a/src/ast/nodes/DoWhileStatement.ts +++ b/src/ast/nodes/DoWhileStatement.ts @@ -1,4 +1,5 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, @@ -18,9 +19,13 @@ export default class DoWhileStatement extends StatementBase { return hasLoopBodyEffects(context, this.body); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.test.include(context, includeChildrenRecursively); + this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } } diff --git a/src/ast/nodes/ExportDefaultDeclaration.ts b/src/ast/nodes/ExportDefaultDeclaration.ts index 843a8385a8f..bb0ad2ee540 100644 --- a/src/ast/nodes/ExportDefaultDeclaration.ts +++ b/src/ast/nodes/ExportDefaultDeclaration.ts @@ -9,6 +9,7 @@ import { getSystemExportStatement } from '../../utils/systemJsRendering'; import { treeshakeNode } from '../../utils/treeshakeNode'; import type { InclusionContext } from '../ExecutionContext'; import type ModuleScope from '../scopes/ModuleScope'; +import type { ObjectPath } from '../utils/PathTracker'; import type ExportDefaultVariable from '../variables/ExportDefaultVariable'; import ClassDeclaration from './ClassDeclaration'; import FunctionDeclaration from './FunctionDeclaration'; @@ -41,10 +42,15 @@ export default class ExportDefaultDeclaration extends NodeBase { declare private declarationName: string | undefined; - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - super.include(context, includeChildrenRecursively); + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { + this.included = true; + this.declaration.includePath(path, context, includeChildrenRecursively); if (includeChildrenRecursively) { - this.scope.context.includeVariableInModule(this.variable); + this.scope.context.includeVariableInModule(this.variable, path); } } diff --git a/src/ast/nodes/ForInStatement.ts b/src/ast/nodes/ForInStatement.ts index c078d09e529..0cdb33b66ae 100644 --- a/src/ast/nodes/ForInStatement.ts +++ b/src/ast/nodes/ForInStatement.ts @@ -3,11 +3,11 @@ import { NO_SEMICOLON, type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import { EMPTY_PATH } from '../utils/PathTracker'; -import type MemberExpression from './MemberExpression'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; -import type VariableDeclaration from './VariableDeclaration'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; +import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, @@ -15,11 +15,11 @@ import { type StatementNode } from './shared/Node'; import type { PatternNode } from './shared/Pattern'; -import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; +import type VariableDeclaration from './VariableDeclaration'; export default class ForInStatement extends StatementBase { declare body: StatementNode; - declare left: VariableDeclaration | PatternNode | MemberExpression; + declare left: VariableDeclaration | PatternNode; declare right: ExpressionNode; declare type: NodeType.tForInStatement; @@ -34,12 +34,16 @@ export default class ForInStatement extends StatementBase { return hasLoopBodyEffects(context, body); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { const { body, deoptimized, left, right } = this; if (!deoptimized) this.applyDeoptimizations(); this.included = true; left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false); - right.include(context, includeChildrenRecursively); + right.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); includeLoopBody(context, body, includeChildrenRecursively); } diff --git a/src/ast/nodes/ForOfStatement.ts b/src/ast/nodes/ForOfStatement.ts index 227075a6942..17fc07b0209 100644 --- a/src/ast/nodes/ForOfStatement.ts +++ b/src/ast/nodes/ForOfStatement.ts @@ -3,12 +3,12 @@ import { NO_SEMICOLON, type RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; +import type { ObjectPath } from '../utils/PathTracker'; import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; -import type MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; -import type VariableDeclaration from './VariableDeclaration'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; +import { includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, @@ -16,11 +16,11 @@ import { type StatementNode } from './shared/Node'; import type { PatternNode } from './shared/Pattern'; -import { includeLoopBody } from './shared/loops'; +import type VariableDeclaration from './VariableDeclaration'; export default class ForOfStatement extends StatementBase { declare body: StatementNode; - declare left: VariableDeclaration | PatternNode | MemberExpression; + declare left: VariableDeclaration | PatternNode; declare right: ExpressionNode; declare type: NodeType.tForOfStatement; @@ -41,12 +41,16 @@ export default class ForOfStatement extends StatementBase { return true; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { const { body, deoptimized, left, right } = this; if (!deoptimized) this.applyDeoptimizations(); this.included = true; left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false); - right.include(context, includeChildrenRecursively); + right.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); includeLoopBody(context, body, includeChildrenRecursively); } diff --git a/src/ast/nodes/ForStatement.ts b/src/ast/nodes/ForStatement.ts index 1fe86e73eda..6f94edcc970 100644 --- a/src/ast/nodes/ForStatement.ts +++ b/src/ast/nodes/ForStatement.ts @@ -3,6 +3,7 @@ import { NO_SEMICOLON, type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import type VariableDeclaration from './VariableDeclaration'; import { @@ -35,11 +36,17 @@ export default class ForStatement extends StatementBase { return hasLoopBodyEffects(context, this.body); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.init?.include(context, includeChildrenRecursively, { asSingleStatement: true }); - this.test?.include(context, includeChildrenRecursively); - this.update?.include(context, includeChildrenRecursively); + this.init?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively, { + asSingleStatement: true + }); + this.test?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.update?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } diff --git a/src/ast/nodes/Identifier.ts b/src/ast/nodes/Identifier.ts index c513e800b9f..75a27641a1c 100644 --- a/src/ast/nodes/Identifier.ts +++ b/src/ast/nodes/Identifier.ts @@ -1,23 +1,39 @@ import isReference, { type NodeWithFieldDefinition } from 'is-reference'; import type MagicString from 'magic-string'; +import type { NormalizedTreeshakingOptions } from '../../rollup/types'; import { BLANK } from '../../utils/blank'; import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { createHasEffectsContext } from '../ExecutionContext'; +import { INTERACTION_ACCESSED, NODE_INTERACTION_UNKNOWN_ACCESS } from '../NodeInteractions'; import type FunctionScope from '../scopes/FunctionScope'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UnknownKey } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; import type Variable from '../variables/Variable'; import * as NodeType from './NodeType'; +import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { type ExpressionEntity } from './shared/Expression'; import IdentifierBase from './shared/IdentifierBase'; -import type { PatternNode } from './shared/Pattern'; +import { ObjectMember } from './shared/ObjectMember'; +import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; export type IdentifierWithVariable = Identifier & { variable: Variable }; -export default class Identifier extends IdentifierBase implements PatternNode { +export default class Identifier extends IdentifierBase implements DeclarationPatternNode { name!: string; type!: NodeType.tIdentifier; variable: Variable | null = null; + private get isDestructuringDeoptimized(): boolean { + return isFlagSet(this.flags, Flag.destructuringDeoptimized); + } + + private set isDestructuringDeoptimized(value: boolean) { + this.flags = setFlag(this.flags, Flag.destructuringDeoptimized, value); + } + addExportedVariables( variables: Variable[], exportNamesByVariable: ReadonlyMap @@ -35,44 +51,90 @@ export default class Identifier extends IdentifierBase implements PatternNode { } } - declare(kind: VariableKind, init: ExpressionEntity): LocalVariable[] { + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[] { let variable: LocalVariable; const { treeshake } = this.scope.context.options; - switch (kind) { - case 'var': { - variable = this.scope.addDeclaration(this, this.scope.context, init, kind); - if (treeshake && treeshake.correctVarValueBeforeDeclaration) { - // Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here. - variable.markInitializersForDeoptimization(); - } - break; - } - case 'function': { - // in strict mode, functions are only hoisted within a scope but not across block scopes - variable = this.scope.addDeclaration(this, this.scope.context, init, kind); - break; - } - case 'let': - case 'const': - case 'using': - case 'await using': - case 'class': { - variable = this.scope.addDeclaration(this, this.scope.context, init, kind); - break; - } - case 'parameter': { - variable = (this.scope as FunctionScope).addParameterDeclaration(this); - break; - } - /* istanbul ignore next */ - default: { - /* istanbul ignore next */ - throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`); + if (kind === 'parameter') { + variable = (this.scope as FunctionScope).addParameterDeclaration(this, destructuredInitPath); + } else { + variable = this.scope.addDeclaration( + this, + this.scope.context, + init, + destructuredInitPath, + kind + ); + if (kind === 'var' && treeshake && treeshake.correctVarValueBeforeDeclaration) { + // Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here. + variable.markInitializersForDeoptimization(); } } return [(this.variable = variable)]; } + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity) { + this.deoptimizePath(EMPTY_PATH); + init.deoptimizePath([...destructuredInitPath, UnknownKey]); + } + + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + return ( + destructuredInitPath.length > 0 && + init.hasEffectsOnInteractionAtPath( + destructuredInitPath, + NODE_INTERACTION_UNKNOWN_ACCESS, + context + ) + ); + } + + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + if (destructuredInitPath.length > 0 && !this.isDestructuringDeoptimized) { + this.isDestructuringDeoptimized = true; + init.deoptimizeArgumentsOnInteractionAtPath( + { + args: [new ObjectMember(init, destructuredInitPath.slice(0, -1))], + type: INTERACTION_ACCESSED + }, + destructuredInitPath, + SHARED_RECURSION_TRACKER + ); + } + const { propertyReadSideEffects } = this.scope.context.options + .treeshake as NormalizedTreeshakingOptions; + if ( + (this.included ||= + destructuredInitPath.length > 0 && + !context.brokenFlow && + propertyReadSideEffects && + (propertyReadSideEffects === 'always' || + init.hasEffectsOnInteractionAtPath( + destructuredInitPath, + NODE_INTERACTION_UNKNOWN_ACCESS, + createHasEffectsContext() + ))) + ) { + if (this.variable && !this.variable.included) { + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH); + } + init.includePath(destructuredInitPath, context, false); + return true; + } + return false; + } + markDeclarationReached(): void { this.variable!.initReached = true; } diff --git a/src/ast/nodes/IfStatement.ts b/src/ast/nodes/IfStatement.ts index f6497fe875d..4a2f8d57938 100644 --- a/src/ast/nodes/IfStatement.ts +++ b/src/ast/nodes/IfStatement.ts @@ -3,7 +3,8 @@ import type { RenderOptions } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import TrackingScope from '../scopes/TrackingScope'; -import { EMPTY_PATH, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; import { tryCastLiteralValueToBoolean } from '../utils/tryCastLiteralValueToBoolean'; import BlockStatement from './BlockStatement'; import type Identifier from './Identifier'; @@ -51,7 +52,11 @@ export default class IfStatement extends StatementBase implements DeoptimizableE return testValue ? this.consequent.hasEffects(context) : !!this.alternate?.hasEffects(context); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; if (includeChildrenRecursively) { this.includeRecursively(includeChildrenRecursively, context); @@ -134,13 +139,13 @@ export default class IfStatement extends StatementBase implements DeoptimizableE private includeKnownTest(context: InclusionContext, testValue: LiteralValueOrUnknown) { if (this.test.shouldBeIncluded(context)) { - this.test.include(context, false); + this.test.includePath(UNKNOWN_PATH, context, false); } if (testValue && this.consequent.shouldBeIncluded(context)) { - this.consequent.include(context, false, { asSingleStatement: true }); + this.consequent.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); } if (!testValue && this.alternate?.shouldBeIncluded(context)) { - this.alternate.include(context, false, { asSingleStatement: true }); + this.alternate.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); } } @@ -148,22 +153,22 @@ export default class IfStatement extends StatementBase implements DeoptimizableE includeChildrenRecursively: true | 'variables', context: InclusionContext ) { - this.test.include(context, includeChildrenRecursively); - this.consequent.include(context, includeChildrenRecursively); - this.alternate?.include(context, includeChildrenRecursively); + this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.consequent.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.alternate?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } private includeUnknownTest(context: InclusionContext) { - this.test.include(context, false); + this.test.includePath(UNKNOWN_PATH, context, false); const { brokenFlow } = context; let consequentBrokenFlow = false; if (this.consequent.shouldBeIncluded(context)) { - this.consequent.include(context, false, { asSingleStatement: true }); + this.consequent.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); consequentBrokenFlow = context.brokenFlow; context.brokenFlow = brokenFlow; } if (this.alternate?.shouldBeIncluded(context)) { - this.alternate.include(context, false, { asSingleStatement: true }); + this.alternate.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); context.brokenFlow = context.brokenFlow && consequentBrokenFlow; } } diff --git a/src/ast/nodes/ImportExpression.ts b/src/ast/nodes/ImportExpression.ts index 785d6b679f4..480dbcac51c 100644 --- a/src/ast/nodes/ImportExpression.ts +++ b/src/ast/nodes/ImportExpression.ts @@ -2,16 +2,17 @@ import type MagicString from 'magic-string'; import ExternalModule from '../../ExternalModule'; import type Module from '../../Module'; import type { AstNode, GetInterop, NormalizedOutputOptions } from '../../rollup/types'; -import type { PluginDriver } from '../../utils/PluginDriver'; import { EMPTY_ARRAY } from '../../utils/blank'; import type { GenerateCodeSnippets } from '../../utils/generateCodeSnippets'; import { INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE, namespaceInteropHelpersByInteropType } from '../../utils/interopHelpers'; +import type { PluginDriver } from '../../utils/PluginDriver'; import { findFirstOccurrenceOutsideComment, type RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; import type ChildScope from '../scopes/ChildScope'; +import { type ObjectPath, UnknownKey } from '../utils/PathTracker'; import type NamespaceVariable from '../variables/NamespaceVariable'; import ArrowFunctionExpression from './ArrowFunctionExpression'; import AwaitExpression from './AwaitExpression'; @@ -22,13 +23,13 @@ import Identifier from './Identifier'; import MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; import ObjectPattern from './ObjectPattern'; -import VariableDeclarator from './VariableDeclarator'; import { type ExpressionNode, type GenericEsTreeNode, type IncludeChildren, NodeBase } from './shared/Node'; +import VariableDeclarator from './VariableDeclarator'; interface DynamicImportMechanism { left: string; @@ -42,6 +43,8 @@ export default class ImportExpression extends NodeBase { declare type: NodeType.tImportExpression; declare sourceAstNode: AstNode; + private hasUnknownAccessedKey = false; + private accessedPropKey = new Set(); private attributes: string | null | true = null; private mechanism: DynamicImportMechanism | null = null; private namespaceExportName: string | false | undefined = undefined; @@ -79,12 +82,15 @@ export default class ImportExpression extends NodeBase { return EMPTY_ARRAY; } - // Case 1: const { foo } = await import('bar') + // Case 1: const { foo } / module = await import('bar') if (parent2 instanceof VariableDeclarator) { const declaration = parent2.id; - return declaration instanceof ObjectPattern - ? getDeterministicObjectDestructure(declaration) - : undefined; + if (declaration instanceof Identifier) { + return this.hasUnknownAccessedKey ? undefined : [...this.accessedPropKey]; + } + if (declaration instanceof ObjectPattern) { + return getDeterministicObjectDestructure(declaration); + } } // Case 2: (await import('bar')).foo @@ -151,13 +157,25 @@ export default class ImportExpression extends NodeBase { return true; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.included) { this.included = true; this.scope.context.includeDynamicImport(this); this.scope.addAccessedDynamicImport(this); + this.source.includePath(path, context, includeChildrenRecursively); + } + if (this.hasUnknownAccessedKey) return; + if (path[0] === UnknownKey) { + this.hasUnknownAccessedKey = true; + this.scope.context.includeDynamicImport(this); + } else if (typeof path[0] === 'string') { + this.accessedPropKey.add(path[0]); + this.scope.context.includeDynamicImport(this); } - this.source.include(context, includeChildrenRecursively); } initialise(): void { diff --git a/src/ast/nodes/JSXOpeningFragment.ts b/src/ast/nodes/JSXOpeningFragment.ts index 6d50740c150..ee127b3881a 100644 --- a/src/ast/nodes/JSXOpeningFragment.ts +++ b/src/ast/nodes/JSXOpeningFragment.ts @@ -2,6 +2,7 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../rollup/types'; import type { RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; +import type { ObjectPath } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { getAndIncludeFactoryVariable } from './shared/jsxHelpers'; @@ -15,7 +16,11 @@ export default class JSXOpeningFragment extends NodeBase { private fragment: string | null = null; private fragmentVariable: Variable | null = null; - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ) { if (!this.included) { const jsx = this.scope.context.options.jsx as NormalizedJsxOptions; if (jsx.mode === 'automatic') { @@ -39,7 +44,7 @@ export default class JSXOpeningFragment extends NodeBase { } } } - super.include(context, includeChildrenRecursively); + super.includePath(path, context, includeChildrenRecursively); } render(code: MagicString, options: RenderOptions): void { diff --git a/src/ast/nodes/LabeledStatement.ts b/src/ast/nodes/LabeledStatement.ts index 57162a566dd..bbdb401d14e 100644 --- a/src/ast/nodes/LabeledStatement.ts +++ b/src/ast/nodes/LabeledStatement.ts @@ -4,7 +4,12 @@ import { findNonWhiteSpace, type RenderOptions } from '../../utils/renderHelpers'; -import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { + createInclusionContext, + type HasEffectsContext, + type InclusionContext +} from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; import { type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; @@ -32,13 +37,17 @@ export default class LabeledStatement extends StatementBase { return bodyHasEffects; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; const { brokenFlow, includedLabels } = context; context.includedLabels = new Set(); - this.body.include(context, includeChildrenRecursively); + this.body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); if (includeChildrenRecursively || context.includedLabels.has(this.label.name)) { - this.label.include(); + this.label.includePath(UNKNOWN_PATH, createInclusionContext()); context.includedLabels.delete(this.label.name); context.brokenFlow = brokenFlow; } diff --git a/src/ast/nodes/LogicalExpression.ts b/src/ast/nodes/LogicalExpression.ts index 13d3addadac..e70dd499770 100644 --- a/src/ast/nodes/LogicalExpression.ts +++ b/src/ast/nodes/LogicalExpression.ts @@ -13,8 +13,8 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, - type PathTracker, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; @@ -61,7 +61,7 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.left.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); this.right.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); @@ -100,7 +100,7 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { const usedBranch = this.getUsedBranch(); @@ -127,7 +127,7 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { const usedBranch = this.getUsedBranch(); @@ -183,7 +183,11 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable return usedBranch.hasEffectsOnInteractionAtPath(path, interaction, context); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; const usedBranch = this.getUsedBranch(); if ( @@ -191,10 +195,10 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable (usedBranch === this.right && this.left.shouldBeIncluded(context)) || !usedBranch ) { - this.left.include(context, includeChildrenRecursively); - this.right.include(context, includeChildrenRecursively); + this.left.includePath(path, context, includeChildrenRecursively); + this.right.includePath(path, context, includeChildrenRecursively); } else { - usedBranch.include(context, includeChildrenRecursively); + usedBranch.includePath(path, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index 025201ce0a1..a65874bdc38 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -7,18 +7,24 @@ import { logIllegalImportReassignment, logMissingExport } from '../../utils/logs import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { createHasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionAccessed, NodeInteractionAssigned, NodeInteractionCalled } from '../NodeInteractions'; -import { INTERACTION_ACCESSED, INTERACTION_ASSIGNED } from '../NodeInteractions'; +import { + INTERACTION_ACCESSED, + INTERACTION_ASSIGNED, + NODE_INTERACTION_UNKNOWN_ACCESS +} from '../NodeInteractions'; +import { MAX_PATH_DEPTH } from '../utils/limitPathLength'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, type ObjectPathKey, - type PathTracker, SHARED_RECURSION_TRACKER, SymbolToStringTag, UNKNOWN_PATH, @@ -33,9 +39,8 @@ import Identifier from './Identifier'; import Literal from './Literal'; import type * as NodeType from './NodeType'; import type PrivateIdentifier from './PrivateIdentifier'; -import type SpreadElement from './SpreadElement'; -import type Super from './Super'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; +import { getChainElementLiteralValueAtPath } from './shared/chainElements'; import { deoptimizeInteraction, type ExpressionEntity, @@ -45,10 +50,8 @@ import { } from './shared/Expression'; import type { ChainElement, ExpressionNode, IncludeChildren, SkippedChain } from './shared/Node'; import { IS_SKIPPED_CHAIN, NodeBase } from './shared/Node'; -import { getChainElementLiteralValueAtPath } from './shared/chainElements'; - -// To avoid infinite recursions -const MAX_PATH_DEPTH = 7; +import type { PatternNode } from './shared/Pattern'; +import type Super from './Super'; function getResolvablePropertyKey(memberExpression: MemberExpression): string | null { return memberExpression.computed @@ -95,7 +98,7 @@ function getStringFromPath(path: PathWithPositions): string { export default class MemberExpression extends NodeBase - implements DeoptimizableEntity, ChainElement + implements DeoptimizableEntity, ChainElement, PatternNode { declare object: ExpressionNode | Super; declare property: ExpressionNode | PrivateIdentifier; @@ -167,7 +170,7 @@ export default class MemberExpression deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { if (this.variable) { this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); @@ -184,6 +187,11 @@ export default class MemberExpression } } + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity) { + this.deoptimizePath(EMPTY_PATH); + init.deoptimizePath([...destructuredInitPath, UnknownKey]); + } + deoptimizeCache(): void { const { expressionsToBeDeoptimized, object } = this; this.expressionsToBeDeoptimized = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; @@ -198,18 +206,20 @@ export default class MemberExpression if (path.length === 0) this.disallowNamespaceReassignment(); if (this.variable) { this.variable.deoptimizePath(path); - } else if (!this.isUndefined && path.length < MAX_PATH_DEPTH) { + } else if (!this.isUndefined) { const propertyKey = this.getPropertyKey(); this.object.deoptimizePath([ propertyKey === UnknownKey ? UnknownNonAccessorKey : propertyKey, - ...path + ...(path.length < MAX_PATH_DEPTH + ? path + : [...path.slice(0, MAX_PATH_DEPTH), UnknownKey as ObjectPathKey]) ]); } } getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { if (this.variable) { @@ -231,7 +241,7 @@ export default class MemberExpression getLiteralValueAtPathAsChainElement( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown | SkippedChain { if (this.variable) { @@ -246,7 +256,7 @@ export default class MemberExpression getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { if (this.variable) { @@ -331,9 +341,38 @@ export default class MemberExpression return true; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + return ( + destructuredInitPath.length > 0 && + init.hasEffectsOnInteractionAtPath( + destructuredInitPath, + NODE_INTERACTION_UNKNOWN_ACCESS, + context + ) + ); + } + + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.deoptimized) this.applyDeoptimizations(); - this.includeProperties(context, includeChildrenRecursively); + this.includeProperties( + path, + [ + this.getPropertyKey(), + ...(path.length < MAX_PATH_DEPTH + ? path + : [...path.slice(0, MAX_PATH_DEPTH), UnknownKey as ObjectPathKey]) + ], + context, + includeChildrenRecursively + ); } includeAsAssignmentTarget( @@ -343,21 +382,44 @@ export default class MemberExpression ): void { if (!this.assignmentDeoptimized) this.applyAssignmentDeoptimization(); if (deoptimizeAccess) { - this.include(context, includeChildrenRecursively); + this.includePath([this.getPropertyKey()], context, includeChildrenRecursively); } else { - this.includeProperties(context, includeChildrenRecursively); + this.includeProperties( + EMPTY_PATH, + [this.getPropertyKey()], + context, + includeChildrenRecursively + ); } } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { if (this.variable) { - this.variable.includeCallArguments(context, parameters); + this.variable.includeCallArguments(context, interaction); } else { - super.includeCallArguments(context, parameters); + super.includeCallArguments(context, interaction); + } + } + + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + if ( + (this.included ||= + destructuredInitPath.length > 0 && + !context.brokenFlow && + init.hasEffectsOnInteractionAtPath( + destructuredInitPath, + NODE_INTERACTION_UNKNOWN_ACCESS, + createHasEffectsContext() + )) + ) { + init.includePath(destructuredInitPath, context, false); + return true; } + return false; } initialise(): void { @@ -449,7 +511,7 @@ export default class MemberExpression const variable = this.scope.findVariable(this.object.name); if (variable.isNamespace) { if (this.variable) { - this.scope.context.includeVariableInModule(this.variable); + this.scope.context.includeVariableInModule(this.variable, UNKNOWN_PATH); } this.scope.context.log( LOGLEVEL_WARN, @@ -490,17 +552,21 @@ export default class MemberExpression } private includeProperties( + includedPath: ObjectPath, + objectPath: ObjectPath, context: InclusionContext, includeChildrenRecursively: IncludeChildren ) { if (!this.included) { this.included = true; if (this.variable) { - this.scope.context.includeVariableInModule(this.variable); + this.scope.context.includeVariableInModule(this.variable, includedPath); } + } else if (includedPath.length > 0) { + this.variable?.includePath(includedPath, context); } - this.object.include(context, includeChildrenRecursively); - this.property.include(context, includeChildrenRecursively); + this.object.includePath(objectPath, context, includeChildrenRecursively); + this.property.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/MetaProperty.ts b/src/ast/nodes/MetaProperty.ts index a16a85c0712..fa6bf8cefcd 100644 --- a/src/ast/nodes/MetaProperty.ts +++ b/src/ast/nodes/MetaProperty.ts @@ -46,7 +46,7 @@ export default class MetaProperty extends NodeBase { return path.length > 1 || type !== INTERACTION_ACCESSED; } - include(): void { + includePath(): void { if (!this.included) { this.included = true; if (this.meta.name === IMPORT) { diff --git a/src/ast/nodes/NewExpression.ts b/src/ast/nodes/NewExpression.ts index a70c3142ef2..5c2c9ed8698 100644 --- a/src/ast/nodes/NewExpression.ts +++ b/src/ast/nodes/NewExpression.ts @@ -5,7 +5,12 @@ import type { RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { INTERACTION_ACCESSED, INTERACTION_CALLED } from '../NodeInteractions'; -import { EMPTY_PATH, type ObjectPath, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; +import { + EMPTY_PATH, + type ObjectPath, + SHARED_RECURSION_TRACKER, + UNKNOWN_PATH +} from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; import { NodeBase } from './shared/Node'; @@ -36,15 +41,19 @@ export default class NewExpression extends NodeBase { return path.length > 0 || type !== INTERACTION_ACCESSED; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { - super.include(context, includeChildrenRecursively); + super.includePath(path, context, includeChildrenRecursively); } else { this.included = true; - this.callee.include(context, false); + this.callee.includePath(UNKNOWN_PATH, context, false); } - this.callee.includeCallArguments(context, this.arguments); + this.callee.includeCallArguments(context, this.interaction); } initialise(): void { diff --git a/src/ast/nodes/ObjectExpression.ts b/src/ast/nodes/ObjectExpression.ts index f9c0bb4d487..4c9950b1ac1 100644 --- a/src/ast/nodes/ObjectExpression.ts +++ b/src/ast/nodes/ObjectExpression.ts @@ -1,35 +1,40 @@ import type MagicString from 'magic-string'; import { BLANK } from '../../utils/blank'; import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers'; +import { getCommaSeparatedNodesWithBoundaries } from '../../utils/renderHelpers'; +import { treeshakeNode } from '../../utils/treeshakeNode'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, - type PathTracker, SHARED_RECURSION_TRACKER, + UNKNOWN_PATH, UnknownKey } from '../utils/PathTracker'; import Identifier from './Identifier'; import Literal from './Literal'; import * as NodeType from './NodeType'; import type Property from './Property'; -import SpreadElement from './SpreadElement'; -import { type ExpressionEntity, type LiteralValueOrUnknown } from './shared/Expression'; +import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expression'; +import type { IncludeChildren } from './shared/Node'; import { NodeBase } from './shared/Node'; import { ObjectEntity, type ObjectProperty } from './shared/ObjectEntity'; import { OBJECT_PROTOTYPE } from './shared/ObjectPrototype'; +import SpreadElement from './SpreadElement'; export default class ObjectExpression extends NodeBase implements DeoptimizableEntity { declare properties: readonly (Property | SpreadElement)[]; declare type: NodeType.tObjectExpression; private objectEntity: ObjectEntity | null = null; + private protoProp: Property | null = null; deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath( interaction, @@ -48,7 +53,7 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.getObjectEntity().getLiteralValueAtPath(path, recursionTracker, origin); @@ -57,7 +62,7 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return this.getObjectEntity().getReturnExpressionWhenCalledAtPath( @@ -76,12 +81,21 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context); } + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ) { + this.included = true; + this.getObjectEntity().includePath(path, context, includeChildrenRecursively); + this.protoProp?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + } + render( code: MagicString, options: RenderOptions, { renderedSurroundingElement }: NodeRenderOptions = BLANK ): void { - super.render(code, options); if ( renderedSurroundingElement === NodeType.ExpressionStatement || renderedSurroundingElement === NodeType.ArrowFunctionExpression @@ -89,6 +103,26 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE code.appendRight(this.start, '('); code.prependLeft(this.end, ')'); } + if (this.properties.length > 0) { + const separatedNodes = getCommaSeparatedNodesWithBoundaries( + this.properties, + code, + this.start + 1, + this.end - 1 + ); + let lastSeparatorPos: number | null = null; + for (const { node, separator, start, end } of separatedNodes) { + if (!node.included) { + treeshakeNode(node, code, start, end); + continue; + } + lastSeparatorPos = separator; + node.render(code, options); + } + if (lastSeparatorPos) { + code.remove(lastSeparatorPos, this.end - 1); + } + } } protected applyDeoptimizations() {} @@ -123,6 +157,7 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE ? property.key.name : String((property.key as Literal).value); if (key === '__proto__' && property.kind === 'init') { + this.protoProp = property; prototype = property.value instanceof Literal && property.value.value === null ? null diff --git a/src/ast/nodes/ObjectPattern.ts b/src/ast/nodes/ObjectPattern.ts index df8b9ef37b0..dba5598e000 100644 --- a/src/ast/nodes/ObjectPattern.ts +++ b/src/ast/nodes/ObjectPattern.ts @@ -1,4 +1,8 @@ -import type { HasEffectsContext } from '../ExecutionContext'; +import type MagicString from 'magic-string'; +import type { RenderOptions } from '../../utils/renderHelpers'; +import { getCommaSeparatedNodesWithBoundaries } from '../../utils/renderHelpers'; +import { treeshakeNode } from '../../utils/treeshakeNode'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteractionAssigned } from '../NodeInteractions'; import { EMPTY_PATH, type ObjectPath } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; @@ -8,10 +12,10 @@ import type Property from './Property'; import type RestElement from './RestElement'; import type { ExpressionEntity } from './shared/Expression'; import { NodeBase } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; -export default class ObjectPattern extends NodeBase implements PatternNode { +export default class ObjectPattern extends NodeBase implements DeclarationPatternNode { declare properties: readonly (Property | RestElement)[]; declare type: NodeType.tObjectPattern; @@ -21,24 +25,31 @@ export default class ObjectPattern extends NodeBase implements PatternNode { ): void { for (const property of this.properties) { if (property.type === NodeType.Property) { - (property.value as unknown as PatternNode).addExportedVariables( - variables, - exportNamesByVariable - ); + property.value.addExportedVariables(variables, exportNamesByVariable); } else { property.argument.addExportedVariables(variables, exportNamesByVariable); } } } - declare(kind: VariableKind, init: ExpressionEntity): LocalVariable[] { + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[] { const variables: LocalVariable[] = []; for (const property of this.properties) { - variables.push(...property.declare(kind, init)); + variables.push(...property.declare(kind, destructuredInitPath, init)); } return variables; } + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity): void { + for (const property of this.properties) { + property.deoptimizeAssignment(destructuredInitPath, init); + } + } + deoptimizePath(path: ObjectPath): void { if (path.length === 0) { for (const property of this.properties) { @@ -60,9 +71,58 @@ export default class ObjectPattern extends NodeBase implements PatternNode { return false; } + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + for (const property of this.properties) { + if (property.hasEffectsWhenDestructuring(context, destructuredInitPath, init)) return true; + } + return false; + } + + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + let included = false; + for (const property of this.properties) { + included = + property.includeDestructuredIfNecessary(context, destructuredInitPath, init) || included; + } + return (this.included ||= included); + } + markDeclarationReached(): void { for (const property of this.properties) { property.markDeclarationReached(); } } + + render(code: MagicString, options: RenderOptions): void { + if (this.properties.length > 0) { + const separatedNodes = getCommaSeparatedNodesWithBoundaries( + this.properties, + code, + this.start + 1, + this.end - 1 + ); + let lastSeparatorPos: number | null = null; + for (const { node, separator, start, end } of separatedNodes) { + if (!node.included) { + treeshakeNode(node, code, start, end); + continue; + } + lastSeparatorPos = separator; + node.render(code, options); + } + if (lastSeparatorPos) { + code.remove(lastSeparatorPos, this.end - 1); + } + } + } + + protected applyDeoptimizations() {} } diff --git a/src/ast/nodes/Program.ts b/src/ast/nodes/Program.ts index 0441eb8b919..0079db695e1 100644 --- a/src/ast/nodes/Program.ts +++ b/src/ast/nodes/Program.ts @@ -10,6 +10,7 @@ import { } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { createHasEffectsContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type IncludeChildren, NodeBase, type StatementNode } from './shared/Node'; @@ -49,11 +50,15 @@ export default class Program extends NodeBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) { - node.include(context, includeChildrenRecursively); + node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } } diff --git a/src/ast/nodes/Property.ts b/src/ast/nodes/Property.ts index 10b5a32c0fe..b71f96a9be4 100644 --- a/src/ast/nodes/Property.ts +++ b/src/ast/nodes/Property.ts @@ -1,22 +1,24 @@ import type MagicString from 'magic-string'; -import type { NormalizedTreeshakingOptions } from '../../rollup/types'; import type { RenderOptions } from '../../utils/renderHelpers'; -import type { HasEffectsContext } from '../ExecutionContext'; -import { UnknownKey } from '../utils/PathTracker'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { createHasEffectsContext } from '../ExecutionContext'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, UnknownKey } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; +import Identifier from './Identifier'; +import type Literal from './Literal'; import type * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; -import { type ExpressionEntity, UNKNOWN_EXPRESSION } from './shared/Expression'; +import { type ExpressionEntity } from './shared/Expression'; import MethodBase from './shared/MethodBase'; -import type { ExpressionNode } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { ExpressionNode, IncludeChildren } from './shared/Node'; +import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; -export default class Property extends MethodBase implements PatternNode { +export default class Property extends MethodBase implements DeclarationPatternNode { declare key: ExpressionNode; declare kind: 'init' | 'get' | 'set'; declare type: NodeType.tProperty; - private declarationInit: ExpressionEntity | null = null; //declare method: boolean; get method(): boolean { @@ -34,25 +36,75 @@ export default class Property extends MethodBase implements PatternNode { this.flags = setFlag(this.flags, Flag.shorthand, value); } - declare(kind: VariableKind, init: ExpressionEntity): LocalVariable[] { - this.declarationInit = init; - return (this.value as PatternNode).declare(kind, UNKNOWN_EXPRESSION); + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[] { + return (this.value as DeclarationPatternNode).declare( + kind, + this.getPathInProperty(destructuredInitPath), + init + ); + } + + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity): void { + (this.value as PatternNode).deoptimizeAssignment?.( + this.getPathInProperty(destructuredInitPath), + init + ); } hasEffects(context: HasEffectsContext): boolean { if (!this.deoptimized) this.applyDeoptimizations(); - const propertyReadSideEffects = ( - this.scope.context.options.treeshake as NormalizedTreeshakingOptions - ).propertyReadSideEffects; - return ( - (this.parent.type === 'ObjectPattern' && propertyReadSideEffects === 'always') || - this.key.hasEffects(context) || - this.value.hasEffects(context) + return this.key.hasEffects(context) || this.value.hasEffects(context); + } + + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + return (this.value as PatternNode).hasEffectsWhenDestructuring?.( + context, + this.getPathInProperty(destructuredInitPath), + init ); } + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + const path = this.getPathInProperty(destructuredInitPath); + let included = + (this.value as PatternNode).includeDestructuredIfNecessary(context, path, init) || + this.included; + if ((included ||= this.key.hasEffects(createHasEffectsContext()))) { + this.key.includePath(EMPTY_PATH, context, false); + if (!this.value.included) { + this.value.included = true; + // Unfortunately, we need to include the value again now, so that any + // declared variables are properly included. + (this.value as PatternNode).includeDestructuredIfNecessary(context, path, init); + } + } + return (this.included = included); + } + + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ) { + this.included = true; + this.key.includePath(EMPTY_PATH, context, includeChildrenRecursively); + this.value.includePath(path, context, includeChildrenRecursively); + } + markDeclarationReached(): void { - (this.value as PatternNode).markDeclarationReached(); + (this.value as DeclarationPatternNode).markDeclarationReached(); } render(code: MagicString, options: RenderOptions): void { @@ -62,11 +114,17 @@ export default class Property extends MethodBase implements PatternNode { this.value.render(code, options, { isShorthandProperty: this.shorthand }); } - protected applyDeoptimizations(): void { - this.deoptimized = true; - if (this.declarationInit !== null) { - this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]); - this.scope.context.requestTreeshakingPass(); - } + protected applyDeoptimizations(): void {} + + private getPathInProperty(destructuredInitPath: ObjectPath): ObjectPath { + return destructuredInitPath.at(-1) === UnknownKey + ? destructuredInitPath + : // For now, we only consider static paths as we do not know how to + // deoptimize the path in the dynamic case. + this.computed + ? [...destructuredInitPath, UnknownKey] + : this.key instanceof Identifier + ? [...destructuredInitPath, this.key.name] + : [...destructuredInitPath, String((this.key as Literal).value)]; } } diff --git a/src/ast/nodes/PropertyDefinition.ts b/src/ast/nodes/PropertyDefinition.ts index bb1e9903de3..a5a2d5e5335 100644 --- a/src/ast/nodes/PropertyDefinition.ts +++ b/src/ast/nodes/PropertyDefinition.ts @@ -1,7 +1,7 @@ import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import { checkEffectForNodes } from '../utils/checkEffectForNodes'; import type Decorator from './Decorator'; import type * as NodeType from './NodeType'; @@ -32,7 +32,7 @@ export default class PropertyDefinition extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.value?.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); } @@ -43,7 +43,7 @@ export default class PropertyDefinition extends NodeBase { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.value @@ -54,7 +54,7 @@ export default class PropertyDefinition extends NodeBase { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return this.value diff --git a/src/ast/nodes/RestElement.ts b/src/ast/nodes/RestElement.ts index 85cbb2e9f2c..02148edbe6d 100644 --- a/src/ast/nodes/RestElement.ts +++ b/src/ast/nodes/RestElement.ts @@ -1,15 +1,16 @@ -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteractionAssigned } from '../NodeInteractions'; import { EMPTY_PATH, type ObjectPath, UnknownKey } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; -import { type ExpressionEntity, UNKNOWN_EXPRESSION } from './shared/Expression'; +import { type ExpressionEntity } from './shared/Expression'; +import type { IncludeChildren } from './shared/Node'; import { NodeBase } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; -export default class RestElement extends NodeBase implements PatternNode { +export default class RestElement extends NodeBase implements DeclarationPatternNode { declare argument: PatternNode; declare type: NodeType.tRestElement; private declarationInit: ExpressionEntity | null = null; @@ -21,9 +22,21 @@ export default class RestElement extends NodeBase implements PatternNode { this.argument.addExportedVariables(variables, exportNamesByVariable); } - declare(kind: VariableKind, init: ExpressionEntity): LocalVariable[] { + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[] { this.declarationInit = init; - return this.argument.declare(kind, UNKNOWN_EXPRESSION); + return (this.argument as DeclarationPatternNode).declare( + kind, + getIncludedPatternPath(destructuredInitPath), + init + ); + } + + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity): void { + this.argument.deoptimizeAssignment(getIncludedPatternPath(destructuredInitPath), init); } deoptimizePath(path: ObjectPath): void { @@ -43,8 +56,44 @@ export default class RestElement extends NodeBase implements PatternNode { ); } + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + return this.argument.hasEffectsWhenDestructuring( + context, + getIncludedPatternPath(destructuredInitPath), + init + ); + } + + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean { + return (this.included = + this.argument.includeDestructuredIfNecessary( + context, + getIncludedPatternPath(destructuredInitPath), + init + ) || this.included); + } + + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ) { + this.included = true; + // This should just include the identifier, its properties should be + // included where the variable is used. + this.argument.includePath(EMPTY_PATH, context, includeChildrenRecursively); + } + markDeclarationReached(): void { - this.argument.markDeclarationReached(); + (this.argument as DeclarationPatternNode).markDeclarationReached(); } protected applyDeoptimizations(): void { @@ -55,3 +104,8 @@ export default class RestElement extends NodeBase implements PatternNode { } } } + +const getIncludedPatternPath = (destructuredInitPath: ObjectPath): ObjectPath => + destructuredInitPath.at(-1) === UnknownKey + ? destructuredInitPath + : [...destructuredInitPath, UnknownKey]; diff --git a/src/ast/nodes/ReturnStatement.ts b/src/ast/nodes/ReturnStatement.ts index 624a5216567..6f3d08a4147 100644 --- a/src/ast/nodes/ReturnStatement.ts +++ b/src/ast/nodes/ReturnStatement.ts @@ -1,6 +1,7 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; @@ -15,9 +16,13 @@ export default class ReturnStatement extends StatementBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.argument?.include(context, includeChildrenRecursively); + this.argument?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); context.brokenFlow = true; } diff --git a/src/ast/nodes/SequenceExpression.ts b/src/ast/nodes/SequenceExpression.ts index 8ca3f731dcf..a753b227ce4 100644 --- a/src/ast/nodes/SequenceExpression.ts +++ b/src/ast/nodes/SequenceExpression.ts @@ -10,7 +10,7 @@ import { treeshakeNode } from '../../utils/treeshakeNode'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import { type EntityPathTracker, type ObjectPath } from '../utils/PathTracker'; import ExpressionStatement from './ExpressionStatement'; import type * as NodeType from './NodeType'; import type { LiteralValueOrUnknown } from './shared/Expression'; @@ -23,7 +23,7 @@ export default class SequenceExpression extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.expressions[this.expressions.length - 1].deoptimizeArgumentsOnInteractionAtPath( interaction, @@ -38,7 +38,7 @@ export default class SequenceExpression extends NodeBase { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.expressions[this.expressions.length - 1].getLiteralValueAtPath( @@ -67,7 +67,11 @@ export default class SequenceExpression extends NodeBase { ); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; const lastExpression = this.expressions[this.expressions.length - 1]; for (const expression of this.expressions) { @@ -76,7 +80,7 @@ export default class SequenceExpression extends NodeBase { (expression === lastExpression && !(this.parent instanceof ExpressionStatement)) || expression.shouldBeIncluded(context) ) - expression.include(context, includeChildrenRecursively); + expression.includePath(path, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/SpreadElement.ts b/src/ast/nodes/SpreadElement.ts index e7605a0cedc..be6e8c72f21 100644 --- a/src/ast/nodes/SpreadElement.ts +++ b/src/ast/nodes/SpreadElement.ts @@ -2,7 +2,12 @@ import type { NormalizedTreeshakingOptions } from '../../rollup/types'; import type { HasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { NODE_INTERACTION_UNKNOWN_ACCESS } from '../NodeInteractions'; -import { type ObjectPath, type PathTracker, UNKNOWN_PATH, UnknownKey } from '../utils/PathTracker'; +import { + type EntityPathTracker, + type ObjectPath, + UNKNOWN_PATH, + UnknownKey +} from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, NodeBase } from './shared/Node'; @@ -13,7 +18,7 @@ export default class SpreadElement extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { if (path.length > 0) { this.argument.deoptimizeArgumentsOnInteractionAtPath( diff --git a/src/ast/nodes/StaticBlock.ts b/src/ast/nodes/StaticBlock.ts index d97dad164e2..ff087897749 100644 --- a/src/ast/nodes/StaticBlock.ts +++ b/src/ast/nodes/StaticBlock.ts @@ -7,6 +7,7 @@ import { import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import * as NodeType from './NodeType'; import { type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; @@ -25,11 +26,15 @@ export default class StaticBlock extends StatementBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) - node.include(context, includeChildrenRecursively); + node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/Super.ts b/src/ast/nodes/Super.ts index 5db71aed448..470d4cac363 100644 --- a/src/ast/nodes/Super.ts +++ b/src/ast/nodes/Super.ts @@ -1,5 +1,6 @@ +import type { InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { NodeBase } from './shared/Node'; @@ -15,7 +16,7 @@ export default class Super extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ) { this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); } @@ -24,10 +25,12 @@ export default class Super extends NodeBase { this.variable.deoptimizePath(path); } - include(): void { + includePath(path: ObjectPath, context: InclusionContext): void { if (!this.included) { this.included = true; - this.scope.context.includeVariableInModule(this.variable); + this.scope.context.includeVariableInModule(this.variable, path); + } else if (path.length > 0) { + this.variable.includePath(path, context); } } } diff --git a/src/ast/nodes/SwitchCase.ts b/src/ast/nodes/SwitchCase.ts index fd78688e03a..3437460b7b5 100644 --- a/src/ast/nodes/SwitchCase.ts +++ b/src/ast/nodes/SwitchCase.ts @@ -6,6 +6,7 @@ import { renderStatementList } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, @@ -29,12 +30,16 @@ export default class SwitchCase extends NodeBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.test?.include(context, includeChildrenRecursively); + this.test?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); for (const node of this.consequent) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) - node.include(context, includeChildrenRecursively); + node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/SwitchStatement.ts b/src/ast/nodes/SwitchStatement.ts index 34ced809994..490fb6b10a9 100644 --- a/src/ast/nodes/SwitchStatement.ts +++ b/src/ast/nodes/SwitchStatement.ts @@ -7,6 +7,7 @@ import { } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import type SwitchCase from './SwitchCase'; import type { ExpressionNode, GenericEsTreeNode, IncludeChildren } from './shared/Node'; @@ -46,9 +47,13 @@ export default class SwitchStatement extends StatementBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.discriminant.include(context, includeChildrenRecursively); + this.discriminant.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); const { brokenFlow, hasBreak } = context; context.hasBreak = false; let onlyHasBrokenFlow = true; @@ -66,7 +71,7 @@ export default class SwitchStatement extends StatementBase { isCaseIncluded = switchCase.hasEffects(hasEffectsContext); } if (isCaseIncluded) { - switchCase.include(context, includeChildrenRecursively); + switchCase.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak; context.hasBreak = false; context.brokenFlow = brokenFlow; diff --git a/src/ast/nodes/TaggedTemplateExpression.ts b/src/ast/nodes/TaggedTemplateExpression.ts index 0aae62095a2..9478cbde0b5 100644 --- a/src/ast/nodes/TaggedTemplateExpression.ts +++ b/src/ast/nodes/TaggedTemplateExpression.ts @@ -4,16 +4,16 @@ import { logCannotCallNamespace } from '../../utils/logs'; import { type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { INTERACTION_CALLED } from '../NodeInteractions'; -import type { PathTracker } from '../utils/PathTracker'; -import { EMPTY_PATH, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; import type Identifier from './Identifier'; import MemberExpression from './MemberExpression'; import * as NodeType from './NodeType'; -import type TemplateLiteral from './TemplateLiteral'; import CallExpressionBase from './shared/CallExpressionBase'; import type { ExpressionEntity } from './shared/Expression'; import { UNKNOWN_EXPRESSION, UNKNOWN_RETURN_EXPRESSION } from './shared/Expression'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; +import type TemplateLiteral from './TemplateLiteral'; export default class TaggedTemplateExpression extends CallExpressionBase { declare quasi: TemplateLiteral; @@ -44,19 +44,23 @@ export default class TaggedTemplateExpression extends CallExpressionBase { ); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { - super.include(context, includeChildrenRecursively); + super.includePath(path, context, includeChildrenRecursively); } else { this.included = true; - this.tag.include(context, includeChildrenRecursively); - this.quasi.include(context, includeChildrenRecursively); + this.tag.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.quasi.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } - this.tag.includeCallArguments(context, this.args); + this.tag.includeCallArguments(context, this.interaction); const [returnExpression] = this.getReturnExpression(); if (!returnExpression.included) { - returnExpression.include(context, false); + returnExpression.includePath(UNKNOWN_PATH, context, false); } } @@ -89,7 +93,7 @@ export default class TaggedTemplateExpression extends CallExpressionBase { } protected getReturnExpression( - recursionTracker: PathTracker = SHARED_RECURSION_TRACKER + recursionTracker: EntityPathTracker = SHARED_RECURSION_TRACKER ): [expression: ExpressionEntity, isPure: boolean] { if (this.returnExpression === null) { this.returnExpression = UNKNOWN_RETURN_EXPRESSION; diff --git a/src/ast/nodes/TemplateElement.ts b/src/ast/nodes/TemplateElement.ts index 69f54ff337d..1489655d43f 100644 --- a/src/ast/nodes/TemplateElement.ts +++ b/src/ast/nodes/TemplateElement.ts @@ -23,7 +23,7 @@ export default class TemplateElement extends NodeBase { return false; } - include(): void { + includePath(): void { this.included = true; } diff --git a/src/ast/nodes/ThisExpression.ts b/src/ast/nodes/ThisExpression.ts index 71e1c4a8969..371d0a87a22 100644 --- a/src/ast/nodes/ThisExpression.ts +++ b/src/ast/nodes/ThisExpression.ts @@ -1,11 +1,11 @@ import type MagicString from 'magic-string'; import { LOGLEVEL_WARN } from '../../utils/logging'; import { logThisIsUndefined } from '../../utils/logs'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import ModuleScope from '../scopes/ModuleScope'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { NodeBase } from './shared/Node'; @@ -22,7 +22,7 @@ export default class ThisExpression extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.variable.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); } @@ -42,10 +42,12 @@ export default class ThisExpression extends NodeBase { return this.variable.hasEffectsOnInteractionAtPath(path, interaction, context); } - include(): void { + includePath(path: ObjectPath, context: InclusionContext): void { if (!this.included) { this.included = true; - this.scope.context.includeVariableInModule(this.variable); + this.scope.context.includeVariableInModule(this.variable, path); + } else if (path.length > 0) { + this.variable.includePath(path, context); } } diff --git a/src/ast/nodes/ThrowStatement.ts b/src/ast/nodes/ThrowStatement.ts index 2d9956e820b..7b64de077c4 100644 --- a/src/ast/nodes/ThrowStatement.ts +++ b/src/ast/nodes/ThrowStatement.ts @@ -1,6 +1,7 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; import { type InclusionContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; @@ -12,9 +13,13 @@ export default class ThrowStatement extends StatementBase { return true; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.argument.include(context, includeChildrenRecursively); + this.argument.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); context.brokenFlow = true; } diff --git a/src/ast/nodes/TryStatement.ts b/src/ast/nodes/TryStatement.ts index 851d2cdd0a4..76fdfa4b6a6 100644 --- a/src/ast/nodes/TryStatement.ts +++ b/src/ast/nodes/TryStatement.ts @@ -1,5 +1,6 @@ import type { NormalizedTreeshakingOptions } from '../../rollup/types'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type BlockStatement from './BlockStatement'; import type CatchClause from './CatchClause'; import type * as NodeType from './NodeType'; @@ -22,7 +23,11 @@ export default class TryStatement extends StatementBase { ); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { const tryCatchDeoptimization = ( this.scope.context.options.treeshake as NormalizedTreeshakingOptions )?.tryCatchDeoptimization; @@ -30,7 +35,8 @@ export default class TryStatement extends StatementBase { if (!this.directlyIncluded || !tryCatchDeoptimization) { this.included = true; this.directlyIncluded = true; - this.block.include( + this.block.includePath( + UNKNOWN_PATH, context, tryCatchDeoptimization ? INCLUDE_PARAMETERS : includeChildrenRecursively ); @@ -44,9 +50,9 @@ export default class TryStatement extends StatementBase { } } if (this.handler !== null) { - this.handler.include(context, includeChildrenRecursively); + this.handler.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } - this.finalizer?.include(context, includeChildrenRecursively); + this.finalizer?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/UnaryExpression.ts b/src/ast/nodes/UnaryExpression.ts index aa8f325c340..b8f72c42d5e 100644 --- a/src/ast/nodes/UnaryExpression.ts +++ b/src/ast/nodes/UnaryExpression.ts @@ -2,7 +2,7 @@ import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED, NODE_INTERACTION_UNKNOWN_ASSIGNMENT } from '../NodeInteractions'; -import { EMPTY_PATH, type ObjectPath, type PathTracker } from '../utils/PathTracker'; +import { EMPTY_PATH, type EntityPathTracker, type ObjectPath } from '../utils/PathTracker'; import Identifier from './Identifier'; import type { LiteralValue } from './Literal'; import type * as NodeType from './NodeType'; @@ -34,7 +34,7 @@ export default class UnaryExpression extends NodeBase { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { if (path.length > 0) return UnknownValue; diff --git a/src/ast/nodes/UnknownNode.ts b/src/ast/nodes/UnknownNode.ts index 60ebf1360f4..112eb1269c8 100644 --- a/src/ast/nodes/UnknownNode.ts +++ b/src/ast/nodes/UnknownNode.ts @@ -1,4 +1,5 @@ import type { InclusionContext } from '../ExecutionContext'; +import type { ObjectPath } from '../utils/PathTracker'; import { NodeBase } from './shared/Node'; export default class UnknownNode extends NodeBase { @@ -6,7 +7,7 @@ export default class UnknownNode extends NodeBase { return true; } - include(context: InclusionContext): void { - super.include(context, true); + includePath(path: ObjectPath, context: InclusionContext): void { + super.includePath(path, context, true); } } diff --git a/src/ast/nodes/UpdateExpression.ts b/src/ast/nodes/UpdateExpression.ts index 74672179534..1ef952bbd81 100644 --- a/src/ast/nodes/UpdateExpression.ts +++ b/src/ast/nodes/UpdateExpression.ts @@ -31,7 +31,11 @@ export default class UpdateExpression extends NodeBase { return path.length > 1 || type !== INTERACTION_ACCESSED; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + includePath( + _: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ) { if (!this.deoptimized) this.applyDeoptimizations(); this.included = true; this.argument.includeAsAssignmentTarget(context, includeChildrenRecursively, true); diff --git a/src/ast/nodes/VariableDeclaration.ts b/src/ast/nodes/VariableDeclaration.ts index dd787ab79b0..89be6e470c1 100644 --- a/src/ast/nodes/VariableDeclaration.ts +++ b/src/ast/nodes/VariableDeclaration.ts @@ -12,8 +12,10 @@ import { getSystemExportStatement, renderSystemExportExpression } from '../../utils/systemJsRendering'; +import { treeshakeNode } from '../../utils/treeshakeNode'; import type { InclusionContext } from '../ExecutionContext'; -import { EMPTY_PATH } from '../utils/PathTracker'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import ArrayPattern from './ArrayPattern'; import Identifier, { type IdentifierWithVariable } from './Identifier'; @@ -57,7 +59,8 @@ export default class VariableDeclaration extends NodeBase { return false; } - include( + includePath( + _path: ObjectPath, context: InclusionContext, includeChildrenRecursively: IncludeChildren, { asSingleStatement }: InclusionOptions = BLANK @@ -65,10 +68,10 @@ export default class VariableDeclaration extends NodeBase { this.included = true; for (const declarator of this.declarations) { if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) - declarator.include(context, includeChildrenRecursively); + declarator.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); const { id, init } = declarator; if (asSingleStatement) { - id.include(context, includeChildrenRecursively); + id.includePath(EMPTY_PATH, context, includeChildrenRecursively); } if ( init && @@ -76,7 +79,7 @@ export default class VariableDeclaration extends NodeBase { !init.included && (id instanceof ObjectPattern || id instanceof ArrayPattern) ) { - init.include(context, includeChildrenRecursively); + init.includePath(EMPTY_PATH, context, includeChildrenRecursively); } } } @@ -183,8 +186,7 @@ export default class VariableDeclaration extends NodeBase { ); for (const { node, start, separator, contentEnd, end } of separatedNodes) { if (!node.included) { - code.remove(start, end); - node.removeAnnotations(code); + treeshakeNode(node, code, start, end); continue; } node.render(code, options); diff --git a/src/ast/nodes/VariableDeclarator.ts b/src/ast/nodes/VariableDeclarator.ts index 2a96aba449c..f48a97737e0 100644 --- a/src/ast/nodes/VariableDeclarator.ts +++ b/src/ast/nodes/VariableDeclarator.ts @@ -1,4 +1,5 @@ import type MagicString from 'magic-string'; +import type { NormalizedTreeshakingOptions } from '../../rollup/types'; import { BLANK } from '../../utils/blank'; import { isReassignedExportsMember } from '../../utils/reassignedExportsMember'; import { @@ -7,24 +8,24 @@ import { type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, type ObjectPath } from '../utils/PathTracker'; import { UNDEFINED_EXPRESSION } from '../values'; import ClassExpression from './ClassExpression'; import Identifier from './Identifier'; import * as NodeType from './NodeType'; import { type ExpressionNode, type IncludeChildren, NodeBase } from './shared/Node'; -import type { PatternNode } from './shared/Pattern'; +import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; export default class VariableDeclarator extends NodeBase { - declare id: PatternNode; + declare id: DeclarationPatternNode; declare init: ExpressionNode | null; declare type: NodeType.tVariableDeclarator; declare isUsingDeclaration: boolean; declareDeclarator(kind: VariableKind, isUsingDeclaration: boolean): void { this.isUsingDeclaration = isUsingDeclaration; - this.id.declare(kind, this.init || UNDEFINED_EXPRESSION); + this.id.declare(kind, EMPTY_PATH, this.init || UNDEFINED_EXPRESSION); } deoptimizePath(path: ObjectPath): void { @@ -35,17 +36,30 @@ export default class VariableDeclarator extends NodeBase { if (!this.deoptimized) this.applyDeoptimizations(); const initEffect = this.init?.hasEffects(context); this.id.markDeclarationReached(); - return initEffect || this.id.hasEffects(context) || this.isUsingDeclaration; + return ( + initEffect || + this.isUsingDeclaration || + this.id.hasEffects(context) || + ((this.scope.context.options.treeshake as NormalizedTreeshakingOptions) + .propertyReadSideEffects && + this.id.hasEffectsWhenDestructuring(context, EMPTY_PATH, this.init || UNDEFINED_EXPRESSION)) + ); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { const { deoptimized, id, init } = this; if (!deoptimized) this.applyDeoptimizations(); this.included = true; - init?.include(context, includeChildrenRecursively); + init?.includePath(EMPTY_PATH, context, includeChildrenRecursively); id.markDeclarationReached(); - if (includeChildrenRecursively || id.shouldBeIncluded(context)) { - id.include(context, includeChildrenRecursively); + if (includeChildrenRecursively) { + id.includePath(EMPTY_PATH, context, includeChildrenRecursively); + } else { + id.includeDestructuredIfNecessary(context, EMPTY_PATH, init || UNDEFINED_EXPRESSION); } } diff --git a/src/ast/nodes/WhileStatement.ts b/src/ast/nodes/WhileStatement.ts index a710564cd21..65f1a8506c8 100644 --- a/src/ast/nodes/WhileStatement.ts +++ b/src/ast/nodes/WhileStatement.ts @@ -1,4 +1,5 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, @@ -18,9 +19,13 @@ export default class WhileStatement extends StatementBase { return hasLoopBodyEffects(context, this.body); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { this.included = true; - this.test.include(context, includeChildrenRecursively); + this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } } diff --git a/src/ast/nodes/shared/BitFlags.ts b/src/ast/nodes/shared/BitFlags.ts index eeb657d668f..581e09ecb78 100644 --- a/src/ast/nodes/shared/BitFlags.ts +++ b/src/ast/nodes/shared/BitFlags.ts @@ -23,7 +23,8 @@ export const enum Flag { prefix = 1 << 21, generator = 1 << 22, expression = 1 << 23, - hasDeoptimizedCache = 1 << 24 + destructuringDeoptimized = 1 << 24, + hasDeoptimizedCache = 1 << 25 } export function isFlagSet(flags: number, flag: Flag): boolean { diff --git a/src/ast/nodes/shared/CallExpressionBase.ts b/src/ast/nodes/shared/CallExpressionBase.ts index d86a9b11bfa..c63a0d314c0 100644 --- a/src/ast/nodes/shared/CallExpressionBase.ts +++ b/src/ast/nodes/shared/CallExpressionBase.ts @@ -3,7 +3,7 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; import type { HasEffectsContext } from '../../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteractions'; import { INTERACTION_ASSIGNED, INTERACTION_CALLED } from '../../NodeInteractions'; -import { type ObjectPath, type PathTracker, UNKNOWN_PATH } from '../../utils/PathTracker'; +import { type EntityPathTracker, type ObjectPath, UNKNOWN_PATH } from '../../utils/PathTracker'; import { type ExpressionEntity, type LiteralValueOrUnknown, @@ -22,7 +22,7 @@ export default abstract class CallExpressionBase extends NodeBase implements Deo deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { const { args } = interaction; const [returnExpression, isPure] = this.getReturnExpression(recursionTracker); @@ -84,7 +84,7 @@ export default abstract class CallExpressionBase extends NodeBase implements Deo getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { const [returnExpression] = this.getReturnExpression(recursionTracker); @@ -105,7 +105,7 @@ export default abstract class CallExpressionBase extends NodeBase implements Deo getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { const returnExpression = this.getReturnExpression(recursionTracker); @@ -162,6 +162,6 @@ export default abstract class CallExpressionBase extends NodeBase implements Deo } protected abstract getReturnExpression( - recursionTracker?: PathTracker + recursionTracker?: EntityPathTracker ): [expression: ExpressionEntity, isPure: boolean]; } diff --git a/src/ast/nodes/shared/ClassNode.ts b/src/ast/nodes/shared/ClassNode.ts index a5622b9b685..abf9ff26e0b 100644 --- a/src/ast/nodes/shared/ClassNode.ts +++ b/src/ast/nodes/shared/ClassNode.ts @@ -1,17 +1,21 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; -import type { HasEffectsContext, InclusionContext } from '../../ExecutionContext'; +import { + createInclusionContext, + type HasEffectsContext, + type InclusionContext +} from '../../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteractions'; import { INTERACTION_CALLED } from '../../NodeInteractions'; import ChildScope from '../../scopes/ChildScope'; +import { checkEffectForNodes } from '../../utils/checkEffectForNodes'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, - type PathTracker, SHARED_RECURSION_TRACKER, UNKNOWN_PATH, UnknownKey } from '../../utils/PathTracker'; -import { checkEffectForNodes } from '../../utils/checkEffectForNodes'; import type ClassBody from '../ClassBody'; import type Decorator from '../Decorator'; import Identifier from '../Identifier'; @@ -39,7 +43,7 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath( interaction, @@ -58,7 +62,7 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.getObjectEntity().getLiteralValueAtPath(path, recursionTracker, origin); @@ -67,7 +71,7 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return this.getObjectEntity().getReturnExpressionWhenCalledAtPath( @@ -99,21 +103,26 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { : this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context); } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { if (!this.deoptimized) this.applyDeoptimizations(); this.included = true; - this.superClass?.include(context, includeChildrenRecursively); - this.body.include(context, includeChildrenRecursively); - for (const decorator of this.decorators) decorator.include(context, includeChildrenRecursively); + this.superClass?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + for (const decorator of this.decorators) + decorator.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); if (this.id) { this.id.markDeclarationReached(); - this.id.include(); + this.id.includePath(UNKNOWN_PATH, createInclusionContext()); } } initialise(): void { super.initialise(); - this.id?.declare('class', this); + this.id?.declare('class', EMPTY_PATH, this); for (const method of this.body.body) { if (method instanceof MethodDefinition && method.kind === 'constructor') { this.classConstructor = method; @@ -179,7 +188,7 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { kind: 'init', property: new ObjectEntity( dynamicMethods, - this.superClass ? new ObjectMember(this.superClass, 'prototype') : OBJECT_PROTOTYPE + this.superClass ? new ObjectMember(this.superClass, ['prototype']) : OBJECT_PROTOTYPE ) }); return (this.objectEntity = new ObjectEntity( diff --git a/src/ast/nodes/shared/Expression.ts b/src/ast/nodes/shared/Expression.ts index 0a19137be35..5496e953ef2 100644 --- a/src/ast/nodes/shared/Expression.ts +++ b/src/ast/nodes/shared/Expression.ts @@ -2,10 +2,9 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; import type { WritableEntity } from '../../Entity'; import type { HasEffectsContext, InclusionContext } from '../../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteractions'; -import type { ObjectPath, PathTracker, SymbolToStringTag } from '../../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath, SymbolToStringTag } from '../../utils/PathTracker'; import { UNKNOWN_PATH } from '../../utils/PathTracker'; import type { LiteralValue } from '../Literal'; -import type SpreadElement from '../SpreadElement'; import { Flag, isFlagSet, setFlag } from './BitFlags'; import type { IncludeChildren } from './Node'; @@ -41,7 +40,7 @@ export class ExpressionEntity implements WritableEntity { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, _path: ObjectPath, - _recursionTracker: PathTracker + _recursionTracker: EntityPathTracker ): void { deoptimizeInteraction(interaction); } @@ -55,7 +54,7 @@ export class ExpressionEntity implements WritableEntity { */ getLiteralValueAtPath( _path: ObjectPath, - _recursionTracker: PathTracker, + _recursionTracker: EntityPathTracker, _origin: DeoptimizableEntity ): LiteralValueOrUnknown { return UnknownValue; @@ -64,7 +63,7 @@ export class ExpressionEntity implements WritableEntity { getReturnExpressionWhenCalledAtPath( _path: ObjectPath, _interaction: NodeInteractionCalled, - _recursionTracker: PathTracker, + _recursionTracker: EntityPathTracker, _origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return UNKNOWN_RETURN_EXPRESSION; @@ -78,7 +77,8 @@ export class ExpressionEntity implements WritableEntity { return true; } - include( + includePath( + _path: ObjectPath, _context: InclusionContext, _includeChildrenRecursively: IncludeChildren, _options?: InclusionOptions @@ -86,12 +86,9 @@ export class ExpressionEntity implements WritableEntity { this.included = true; } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { - for (const argument of parameters) { - argument.include(context, false); + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { + for (const argument of interaction.args) { + argument?.includePath(UNKNOWN_PATH, context, false); } } diff --git a/src/ast/nodes/shared/FunctionBase.ts b/src/ast/nodes/shared/FunctionBase.ts index e57af88d001..5f363b6e6bb 100644 --- a/src/ast/nodes/shared/FunctionBase.ts +++ b/src/ast/nodes/shared/FunctionBase.ts @@ -8,17 +8,15 @@ import { NODE_INTERACTION_UNKNOWN_CALL } from '../../NodeInteractions'; import type ReturnValueScope from '../../scopes/ReturnValueScope'; -import type { ObjectPath, PathTracker } from '../../utils/PathTracker'; -import { UNKNOWN_PATH, UnknownKey } from '../../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../../utils/PathTracker'; +import { EMPTY_PATH, UNKNOWN_PATH, UnknownKey } from '../../utils/PathTracker'; import { UNDEFINED_EXPRESSION } from '../../values'; import type ParameterVariable from '../../variables/ParameterVariable'; import type Variable from '../../variables/Variable'; import BlockStatement from '../BlockStatement'; import type ExportDefaultDeclaration from '../ExportDefaultDeclaration'; -import Identifier from '../Identifier'; import * as NodeType from '../NodeType'; import RestElement from '../RestElement'; -import SpreadElement from '../SpreadElement'; import type VariableDeclarator from '../VariableDeclarator'; import { Flag, isFlagSet, setFlag } from './BitFlags'; import type { ExpressionEntity, LiteralValueOrUnknown } from './Expression'; @@ -30,13 +28,11 @@ import { NodeBase } from './Node'; import type { ObjectEntity } from './ObjectEntity'; -import type { PatternNode } from './Pattern'; - -type InteractionCalledArguments = NodeInteractionCalled['args']; +import type { DeclarationPatternNode } from './Pattern'; export default abstract class FunctionBase extends NodeBase { declare body: BlockStatement | ExpressionNode; - declare params: PatternNode[]; + declare params: DeclarationPatternNode[]; declare preventChildBlockScope: true; declare scope: ReturnValueScope; @@ -64,58 +60,13 @@ export default abstract class FunctionBase extends NodeBase { this.flags = setFlag(this.flags, Flag.generator, value); } - private updateParameterVariableValues(_arguments: InteractionCalledArguments): void { - for (let position = 0; position < this.params.length; position++) { - const parameter = this.params[position]; - if (!(parameter instanceof Identifier)) { - continue; - } - const parameterVariable = parameter.variable as ParameterVariable; - const argument = _arguments[position + 1] ?? UNDEFINED_EXPRESSION; - parameterVariable.updateKnownValue(argument); - } - } - - private deoptimizeParameterVariableValues() { - for (const parameter of this.params) { - if (parameter instanceof Identifier) { - const parameterVariable = parameter.variable as ParameterVariable; - parameterVariable.markReassigned(); - } - } - } - - protected objectEntity: ObjectEntity | null = null; - deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { - if (interaction.type === INTERACTION_CALLED) { - const { parameters } = this.scope; - const { args } = interaction; - let hasRest = false; - for (let position = 0; position < args.length - 1; position++) { - const parameter = this.params[position]; - // Only the "this" argument arg[0] can be null - const argument = args[position + 1]!; - if (argument instanceof SpreadElement) { - this.deoptimizeParameterVariableValues(); - } - if (hasRest || parameter instanceof RestElement) { - hasRest = true; - argument.deoptimizePath(UNKNOWN_PATH); - } else if (parameter instanceof Identifier) { - parameters[position][0].addEntityToBeDeoptimized(argument); - this.addArgumentToBeDeoptimized(argument); - } else if (parameter) { - argument.deoptimizePath(UNKNOWN_PATH); - } else { - this.addArgumentToBeDeoptimized(argument); - } - } - this.updateParameterVariableValues(args); + if (interaction.type === INTERACTION_CALLED && path.length === 0) { + this.scope.deoptimizeArgumentsOnCall(interaction); } else { this.getObjectEntity().deoptimizeArgumentsOnInteractionAtPath( interaction, @@ -131,18 +82,13 @@ export default abstract class FunctionBase extends NodeBase { // A reassignment of UNKNOWN_PATH is considered equivalent to having lost track // which means the return expression and parameters need to be reassigned this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH); - for (const parameterList of this.scope.parameters) { - for (const parameter of parameterList) { - parameter.deoptimizePath(UNKNOWN_PATH); - parameter.markReassigned(); - } - } + this.scope.deoptimizeAllParameters(); } } getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.getObjectEntity().getLiteralValueAtPath(path, recursionTracker, origin); @@ -151,7 +97,7 @@ export default abstract class FunctionBase extends NodeBase { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { if (path.length > 0) { @@ -207,8 +153,20 @@ export default abstract class FunctionBase extends NodeBase { return true; } } - for (const parameter of this.params) { - if (parameter.hasEffects(context)) return true; + const { propertyReadSideEffects } = this.scope.context.options + .treeshake as NormalizedTreeshakingOptions; + for (let index = 0; index < this.params.length; index++) { + const parameter = this.params[index]; + if ( + parameter.hasEffects(context) || + (propertyReadSideEffects && + parameter.hasEffectsWhenDestructuring( + context, + EMPTY_PATH, + interaction.args[index + 1] || UNDEFINED_EXPRESSION + )) + ) + return true; } return false; } @@ -228,25 +186,25 @@ export default abstract class FunctionBase extends NodeBase { } private parameterVariableValuesDeoptimized = false; - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.parameterVariableValuesDeoptimized && !this.onlyFunctionCallUsed()) { + + includePath( + _path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { + if (!(this.parameterVariableValuesDeoptimized || this.onlyFunctionCallUsed())) { this.parameterVariableValuesDeoptimized = true; - this.deoptimizeParameterVariableValues(); + this.scope.reassignAllParameters(); } if (!this.deoptimized) this.applyDeoptimizations(); this.included = true; const { brokenFlow } = context; context.brokenFlow = false; - this.body.include(context, includeChildrenRecursively); + this.body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { - this.scope.includeCallArguments(context, parameters); - } + includeCallArguments = this.scope.includeCallArguments.bind(this.scope); initialise(): void { super.initialise(); @@ -276,11 +234,12 @@ export default abstract class FunctionBase extends NodeBase { (parameter: GenericEsTreeNode) => new (context.getNodeConstructor(parameter.type))(this, scope).parseNode( parameter - ) as unknown as PatternNode + ) as unknown as DeclarationPatternNode )); scope.addParameterVariables( parameters.map( - parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION) as ParameterVariable[] + parameter => + parameter.declare('parameter', EMPTY_PATH, UNKNOWN_EXPRESSION) as ParameterVariable[] ), parameters[parameters.length - 1] instanceof RestElement ); @@ -288,8 +247,6 @@ export default abstract class FunctionBase extends NodeBase { return super.parseNode(esTreeNode); } - protected addArgumentToBeDeoptimized(_argument: ExpressionEntity) {} - protected applyDeoptimizations() {} protected abstract getObjectEntity(): ObjectEntity; diff --git a/src/ast/nodes/shared/FunctionNode.ts b/src/ast/nodes/shared/FunctionNode.ts index 17f1788e424..0ffa1225e96 100644 --- a/src/ast/nodes/shared/FunctionNode.ts +++ b/src/ast/nodes/shared/FunctionNode.ts @@ -1,23 +1,31 @@ -import { type HasEffectsContext, type InclusionContext } from '../../ExecutionContext'; +import { + createInclusionContext, + type HasEffectsContext, + type InclusionContext +} from '../../ExecutionContext'; import type { NodeInteraction } from '../../NodeInteractions'; import { INTERACTION_CALLED } from '../../NodeInteractions'; import type ChildScope from '../../scopes/ChildScope'; import FunctionScope from '../../scopes/FunctionScope'; -import type { ObjectPath, PathTracker } from '../../utils/PathTracker'; +import { + EMPTY_PATH, + type EntityPathTracker, + type ObjectPath, + UNKNOWN_PATH +} from '../../utils/PathTracker'; import type BlockStatement from '../BlockStatement'; import Identifier, { type IdentifierWithVariable } from '../Identifier'; -import type { ExpressionEntity } from './Expression'; import { UNKNOWN_EXPRESSION } from './Expression'; import FunctionBase from './FunctionBase'; import { type IncludeChildren } from './Node'; import { ObjectEntity } from './ObjectEntity'; import { OBJECT_PROTOTYPE } from './ObjectPrototype'; -import type { PatternNode } from './Pattern'; +import type { DeclarationPatternNode } from './Pattern'; export default class FunctionNode extends FunctionBase { declare body: BlockStatement; declare id: IdentifierWithVariable | null; - declare params: PatternNode[]; + declare params: DeclarationPatternNode[]; declare preventChildBlockScope: true; declare scope: FunctionScope; protected objectEntity: ObjectEntity | null = null; @@ -28,18 +36,18 @@ export default class FunctionNode extends FunctionBase { this.constructedEntity = new ObjectEntity(Object.create(null), OBJECT_PROTOTYPE); // This makes sure that all deoptimizations of "this" are applied to the // constructed entity. - this.scope.thisVariable.addEntityToBeDeoptimized(this.constructedEntity); + this.scope.thisVariable.addArgumentValue(this.constructedEntity); } deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { super.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); if (interaction.type === INTERACTION_CALLED && path.length === 0 && interaction.args[0]) { // args[0] is the "this" argument - this.scope.thisVariable.addEntityToBeDeoptimized(interaction.args[0]); + this.scope.thisVariable.addArgumentValue(interaction.args[0]); } } @@ -90,24 +98,24 @@ export default class FunctionNode extends FunctionBase { return false; } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - super.include(context, includeChildrenRecursively); - this.id?.include(); + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ): void { + super.includePath(path, context, includeChildrenRecursively); + this.id?.includePath(UNKNOWN_PATH, createInclusionContext()); const hasArguments = this.scope.argumentsVariable.included; for (const parameter of this.params) { if (!(parameter instanceof Identifier) || hasArguments) { - parameter.include(context, includeChildrenRecursively); + parameter.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); } } } initialise(): void { super.initialise(); - this.id?.declare('function', this); - } - - protected addArgumentToBeDeoptimized(argument: ExpressionEntity) { - this.scope.argumentsVariable.addArgumentToBeDeoptimized(argument); + this.id?.declare('function', EMPTY_PATH, this); } protected getObjectEntity(): ObjectEntity { diff --git a/src/ast/nodes/shared/IdentifierBase.ts b/src/ast/nodes/shared/IdentifierBase.ts index 684d7f2de81..72241cc67cb 100644 --- a/src/ast/nodes/shared/IdentifierBase.ts +++ b/src/ast/nodes/shared/IdentifierBase.ts @@ -11,12 +11,11 @@ import { INTERACTION_CALLED, NODE_INTERACTION_UNKNOWN_ACCESS } from '../../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../../utils/PathTracker'; import { EMPTY_PATH } from '../../utils/PathTracker'; import GlobalVariable from '../../variables/GlobalVariable'; import LocalVariable from '../../variables/LocalVariable'; import type Variable from '../../variables/Variable'; -import type SpreadElement from '../SpreadElement'; import { Flag, isFlagSet, setFlag } from './BitFlags'; import type { ExpressionEntity, LiteralValueOrUnknown } from './Expression'; import { UNKNOWN_EXPRESSION } from './Expression'; @@ -45,7 +44,7 @@ export default class IdentifierBase extends NodeBase { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.variable!.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker); } @@ -61,7 +60,7 @@ export default class IdentifierBase extends NodeBase { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.getVariableRespectingTDZ()!.getLiteralValueAtPath(path, recursionTracker, origin); @@ -70,7 +69,7 @@ export default class IdentifierBase extends NodeBase { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { const [expression, isPure] = @@ -128,21 +127,20 @@ export default class IdentifierBase extends NodeBase { } } - include(): void { + includePath(path: ObjectPath, context: InclusionContext): void { if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) { this.included = true; if (this.variable !== null) { - this.scope.context.includeVariableInModule(this.variable); + this.scope.context.includeVariableInModule(this.variable, path); } + } else if (path.length > 0) { + this.variable?.includePath(path, context); } } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { - this.variable!.includeCallArguments(context, parameters); + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { + this.variable!.includeCallArguments(context, interaction); } isPossibleTDZ(): boolean { diff --git a/src/ast/nodes/shared/JSXElementBase.ts b/src/ast/nodes/shared/JSXElementBase.ts index b5f4ef2c1c5..ee2f85cd7ec 100644 --- a/src/ast/nodes/shared/JSXElementBase.ts +++ b/src/ast/nodes/shared/JSXElementBase.ts @@ -3,6 +3,7 @@ import type { NormalizedJsxOptions } from '../../../rollup/types'; import { getRenderedJsxChildren } from '../../../utils/jsx'; import type { RenderOptions } from '../../../utils/renderHelpers'; import type { InclusionContext } from '../../ExecutionContext'; +import type { ObjectPath } from '../../utils/PathTracker'; import type Variable from '../../variables/Variable'; import JSXEmptyExpression from '../JSXEmptyExpression'; import JSXExpressionContainer from '../JSXExpressionContainer'; @@ -26,7 +27,11 @@ export default class JSXElementBase extends NodeBase { } } - include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + includePath( + path: ObjectPath, + context: InclusionContext, + includeChildrenRecursively: IncludeChildren + ) { if (!this.included) { const { factory, importSource, mode } = this.jsxMode; if (factory) { @@ -39,7 +44,7 @@ export default class JSXElementBase extends NodeBase { ); } } - super.include(context, includeChildrenRecursively); + super.includePath(path, context, includeChildrenRecursively); } protected applyDeoptimizations() {} diff --git a/src/ast/nodes/shared/MethodBase.ts b/src/ast/nodes/shared/MethodBase.ts index b893dbc61be..5ca69cfa066 100644 --- a/src/ast/nodes/shared/MethodBase.ts +++ b/src/ast/nodes/shared/MethodBase.ts @@ -9,8 +9,8 @@ import { } from '../../NodeInteractions'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, - type PathTracker, SHARED_RECURSION_TRACKER } from '../../utils/PathTracker'; import type PrivateIdentifier from '../PrivateIdentifier'; @@ -21,12 +21,12 @@ import { UNKNOWN_RETURN_EXPRESSION } from './Expression'; import { type ExpressionNode, NodeBase } from './Node'; -import type { PatternNode } from './Pattern'; +import type { DeclarationPatternNode } from './Pattern'; export default class MethodBase extends NodeBase implements DeoptimizableEntity { declare key: ExpressionNode | PrivateIdentifier; declare kind: 'constructor' | 'method' | 'init' | 'get' | 'set'; - declare value: ExpressionNode | (ExpressionNode & PatternNode); + declare value: ExpressionNode | (ExpressionNode & DeclarationPatternNode); get computed(): boolean { return isFlagSet(this.flags, Flag.computed); @@ -40,7 +40,7 @@ export default class MethodBase extends NodeBase implements DeoptimizableEntity deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { if (interaction.type === INTERACTION_ACCESSED && this.kind === 'get' && path.length === 0) { return this.value.deoptimizeArgumentsOnInteractionAtPath( @@ -81,7 +81,7 @@ export default class MethodBase extends NodeBase implements DeoptimizableEntity getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { return this.getAccessedValue()[0].getLiteralValueAtPath(path, recursionTracker, origin); @@ -90,7 +90,7 @@ export default class MethodBase extends NodeBase implements DeoptimizableEntity getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return this.getAccessedValue()[0].getReturnExpressionWhenCalledAtPath( diff --git a/src/ast/nodes/shared/MultiExpression.ts b/src/ast/nodes/shared/MultiExpression.ts index 5981af20b8c..5b1279355c0 100644 --- a/src/ast/nodes/shared/MultiExpression.ts +++ b/src/ast/nodes/shared/MultiExpression.ts @@ -1,7 +1,7 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; import type { HasEffectsContext } from '../../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../../utils/PathTracker'; import { ExpressionEntity } from './Expression'; export class MultiExpression extends ExpressionEntity { @@ -18,7 +18,7 @@ export class MultiExpression extends ExpressionEntity { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return [ diff --git a/src/ast/nodes/shared/Node.ts b/src/ast/nodes/shared/Node.ts index 8c75fb4e13c..44429b37cb0 100644 --- a/src/ast/nodes/shared/Node.ts +++ b/src/ast/nodes/shared/Node.ts @@ -18,8 +18,8 @@ import { INTERACTION_ASSIGNED } from '../../NodeInteractions'; import type ChildScope from '../../scopes/ChildScope'; import { EMPTY_PATH, + type EntityPathTracker, type ObjectPath, - type PathTracker, UNKNOWN_PATH } from '../../utils/PathTracker'; import type Variable from '../../variables/Variable'; @@ -78,11 +78,19 @@ export interface Node extends Entity { hasEffectsAsAssignmentTarget(context: HasEffectsContext, checkAccess: boolean): boolean; /** - * Includes the node in the bundle. If the flag is not set, children are - * usually included if they are necessary for this node (e.g. a function body) - * or if they have effects. Necessary variables need to be included as well. + * Includes the given path of the Node in the bundle. If + * "includeChildrenRecursively" is true, children of this path are included + * unconditionally. Otherwise, including a given path means that the value of + * this path is needed, but not necessarily its children if it is an object. + * Example: + * if (x.a.b) { ... } + * would include the path ['a','b'] of the variable x but none of its children + * because those are not needed to get the literal value. + * On the other hand to include all children, we extend the path with + * "UnknownNode". */ - include( + includePath( + path: ObjectPath, context: InclusionContext, includeChildrenRecursively: IncludeChildren, options?: InclusionOptions @@ -131,7 +139,7 @@ export interface ExpressionNode extends ExpressionEntity, Node, Partial= 0; index--) { const { key, kind, property } = properties[index]; allProperties.push(property); diff --git a/src/ast/nodes/shared/ObjectMember.ts b/src/ast/nodes/shared/ObjectMember.ts index 676b7548c0c..8bda71fbc9e 100644 --- a/src/ast/nodes/shared/ObjectMember.ts +++ b/src/ast/nodes/shared/ObjectMember.ts @@ -1,13 +1,13 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; import type { HasEffectsContext } from '../../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteractions'; -import type { ObjectPath, PathTracker } from '../../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../../utils/PathTracker'; import { ExpressionEntity, type LiteralValueOrUnknown } from './Expression'; export class ObjectMember extends ExpressionEntity { constructor( private readonly object: ExpressionEntity, - private readonly key: string + private readonly path: ObjectPath ) { super(); } @@ -15,35 +15,35 @@ export class ObjectMember extends ExpressionEntity { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { this.object.deoptimizeArgumentsOnInteractionAtPath( interaction, - [this.key, ...path], + [...this.path, ...path], recursionTracker ); } deoptimizePath(path: ObjectPath): void { - this.object.deoptimizePath([this.key, ...path]); + this.object.deoptimizePath([...this.path, ...path]); } getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { - return this.object.getLiteralValueAtPath([this.key, ...path], recursionTracker, origin); + return this.object.getLiteralValueAtPath([...this.path, ...path], recursionTracker, origin); } getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { return this.object.getReturnExpressionWhenCalledAtPath( - [this.key, ...path], + [...this.path, ...path], interaction, recursionTracker, origin @@ -55,6 +55,6 @@ export class ObjectMember extends ExpressionEntity { interaction: NodeInteraction, context: HasEffectsContext ): boolean { - return this.object.hasEffectsOnInteractionAtPath([this.key, ...path], interaction, context); + return this.object.hasEffectsOnInteractionAtPath([...this.path, ...path], interaction, context); } } diff --git a/src/ast/nodes/shared/Pattern.ts b/src/ast/nodes/shared/Pattern.ts index e53385d285e..4591bf46e30 100644 --- a/src/ast/nodes/shared/Pattern.ts +++ b/src/ast/nodes/shared/Pattern.ts @@ -1,10 +1,34 @@ import type { WritableEntity } from '../../Entity'; +import type { HasEffectsContext, InclusionContext } from '../../ExecutionContext'; +import type { ObjectPath } from '../../utils/PathTracker'; import type LocalVariable from '../../variables/LocalVariable'; import type { ExpressionEntity } from './Expression'; import type { Node } from './Node'; import type { VariableKind } from './VariableKinds'; export interface PatternNode extends WritableEntity, Node { - declare(kind: VariableKind, init: ExpressionEntity): LocalVariable[]; + // This should deoptimize both the left-hand and right-hand side + deoptimizeAssignment(destructuredInitPath: ObjectPath, init: ExpressionEntity): void; + + hasEffectsWhenDestructuring( + context: HasEffectsContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean; + + includeDestructuredIfNecessary( + context: InclusionContext, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): boolean; +} + +export interface DeclarationPatternNode extends PatternNode { + declare( + kind: VariableKind, + destructuredInitPath: ObjectPath, + init: ExpressionEntity + ): LocalVariable[]; + markDeclarationReached(): void; } diff --git a/src/ast/nodes/shared/chainElements.ts b/src/ast/nodes/shared/chainElements.ts index d7baa0a2549..390e4029a9f 100644 --- a/src/ast/nodes/shared/chainElements.ts +++ b/src/ast/nodes/shared/chainElements.ts @@ -1,5 +1,5 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; -import type { ObjectPath, PathTracker } from '../../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../../utils/PathTracker'; import { EMPTY_PATH, SHARED_RECURSION_TRACKER } from '../../utils/PathTracker'; import type CallExpression from '../CallExpression'; import type MemberExpression from '../MemberExpression'; @@ -11,7 +11,7 @@ export function getChainElementLiteralValueAtPath( element: CallExpression | MemberExpression, object: ExpressionNode, path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown | SkippedChain { if ('getLiteralValueAtPathAsChainElement' in object) { diff --git a/src/ast/nodes/shared/jsxHelpers.ts b/src/ast/nodes/shared/jsxHelpers.ts index bdbdfe8ef20..f90376e8228 100644 --- a/src/ast/nodes/shared/jsxHelpers.ts +++ b/src/ast/nodes/shared/jsxHelpers.ts @@ -1,3 +1,5 @@ +import { createInclusionContext } from '../../ExecutionContext'; +import { UNKNOWN_PATH } from '../../utils/PathTracker'; import LocalVariable from '../../variables/LocalVariable'; import type Variable from '../../variables/Variable'; import type JSXElement from '../JSXElement'; @@ -35,14 +37,14 @@ export function getAndIncludeFactoryVariable( if (preserve) { // This pretends we are accessing an included global variable of the same name const globalVariable = node.scope.findGlobal(baseName); - globalVariable.include(); + globalVariable.includePath(UNKNOWN_PATH, createInclusionContext()); // This excludes this variable from renaming factoryVariable.globalName = baseName; } } else { factoryVariable = node.scope.findGlobal(baseName); } - node.scope.context.includeVariableInModule(factoryVariable); + node.scope.context.includeVariableInModule(factoryVariable, UNKNOWN_PATH); if (factoryVariable instanceof LocalVariable) { factoryVariable.consolidateInitializers(); factoryVariable.addUsedPlace(node); diff --git a/src/ast/nodes/shared/loops.ts b/src/ast/nodes/shared/loops.ts index dcc2dc6b41d..0782260def7 100644 --- a/src/ast/nodes/shared/loops.ts +++ b/src/ast/nodes/shared/loops.ts @@ -1,4 +1,5 @@ import type { HasEffectsContext, InclusionContext } from '../../ExecutionContext'; +import { UNKNOWN_PATH } from '../../utils/PathTracker'; import type { StatementNode } from './Node'; export function hasLoopBodyEffects(context: HasEffectsContext, body: StatementNode): boolean { @@ -25,7 +26,7 @@ export function includeLoopBody( const { brokenFlow, hasBreak, hasContinue } = context; context.hasBreak = false; context.hasContinue = false; - body.include(context, includeChildrenRecursively, { asSingleStatement: true }); + body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively, { asSingleStatement: true }); context.hasBreak = hasBreak; context.hasContinue = hasContinue; context.brokenFlow = brokenFlow; diff --git a/src/ast/scopes/BlockScope.ts b/src/ast/scopes/BlockScope.ts index 77e9f530735..278e4096ca6 100644 --- a/src/ast/scopes/BlockScope.ts +++ b/src/ast/scopes/BlockScope.ts @@ -3,6 +3,7 @@ import { logRedeclarationError } from '../../utils/logs'; import type Identifier from '../nodes/Identifier'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import type { VariableKind } from '../nodes/shared/VariableKinds'; +import type { ObjectPath } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; import ChildScope from './ChildScope'; @@ -15,6 +16,7 @@ export default class BlockScope extends ChildScope { identifier: Identifier, context: AstContext, init: ExpressionEntity, + destructuredInitPath: ObjectPath, kind: VariableKind ): LocalVariable { if (kind === 'var') { @@ -31,7 +33,13 @@ export default class BlockScope extends ChildScope { } return context.error(logRedeclarationError(name), identifier.start); } - const declaredVariable = this.parent.addDeclaration(identifier, context, init, kind); + const declaredVariable = this.parent.addDeclaration( + identifier, + context, + init, + destructuredInitPath, + kind + ); // Necessary to make sure the init is deoptimized for conditional declarations. // We cannot call deoptimizePath here. declaredVariable.markInitializersForDeoptimization(); @@ -39,6 +47,6 @@ export default class BlockScope extends ChildScope { this.addHoistedVariable(name, declaredVariable); return declaredVariable; } - return super.addDeclaration(identifier, context, init, kind); + return super.addDeclaration(identifier, context, init, destructuredInitPath, kind); } } diff --git a/src/ast/scopes/CatchBodyScope.ts b/src/ast/scopes/CatchBodyScope.ts index 40dad8caec5..46cc32b6894 100644 --- a/src/ast/scopes/CatchBodyScope.ts +++ b/src/ast/scopes/CatchBodyScope.ts @@ -4,6 +4,7 @@ import type Identifier from '../nodes/Identifier'; import * as NodeType from '../nodes/NodeType'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import type { VariableKind } from '../nodes/shared/VariableKinds'; +import type { ObjectPath } from '../utils/PathTracker'; import { UNDEFINED_EXPRESSION } from '../values'; import type LocalVariable from '../variables/LocalVariable'; import ChildScope from './ChildScope'; @@ -18,6 +19,7 @@ export default class CatchBodyScope extends ChildScope { identifier: Identifier, context: AstContext, init: ExpressionEntity, + destructuredInitPath: ObjectPath, kind: VariableKind ): LocalVariable { if (kind === 'var') { @@ -39,6 +41,7 @@ export default class CatchBodyScope extends ChildScope { identifier, context, UNDEFINED_EXPRESSION, + destructuredInitPath, kind ); // To avoid the need to rewrite the declaration, we link the variable @@ -59,7 +62,13 @@ export default class CatchBodyScope extends ChildScope { return context.error(logRedeclarationError(name), identifier.start); } // We only add parameters to parameter scopes - const declaredVariable = this.parent.parent.addDeclaration(identifier, context, init, kind); + const declaredVariable = this.parent.parent.addDeclaration( + identifier, + context, + init, + destructuredInitPath, + kind + ); // Necessary to make sure the init is deoptimized for conditional declarations. // We cannot call deoptimizePath here. declaredVariable.markInitializersForDeoptimization(); @@ -67,6 +76,6 @@ export default class CatchBodyScope extends ChildScope { this.addHoistedVariable(name, declaredVariable); return declaredVariable; } - return super.addDeclaration(identifier, context, init, kind); + return super.addDeclaration(identifier, context, init, destructuredInitPath, kind); } } diff --git a/src/ast/scopes/ClassBodyScope.ts b/src/ast/scopes/ClassBodyScope.ts index c8f7f1f62f0..a9c086444ba 100644 --- a/src/ast/scopes/ClassBodyScope.ts +++ b/src/ast/scopes/ClassBodyScope.ts @@ -1,4 +1,5 @@ import type ClassNode from '../nodes/shared/ClassNode'; +import { EMPTY_PATH } from '../utils/PathTracker'; import LocalVariable from '../variables/LocalVariable'; import ThisVariable from '../variables/ThisVariable'; import ChildScope from './ChildScope'; @@ -12,7 +13,7 @@ export default class ClassBodyScope extends ChildScope { super(parent, context); this.variables.set( 'this', - (this.thisVariable = new LocalVariable('this', null, classNode, context, 'other')) + (this.thisVariable = new LocalVariable('this', null, classNode, EMPTY_PATH, context, 'other')) ); this.instanceScope = new ChildScope(this, context); this.instanceScope.variables.set('this', new ThisVariable(context)); diff --git a/src/ast/scopes/FunctionBodyScope.ts b/src/ast/scopes/FunctionBodyScope.ts index 7343ac03352..6edab0c0ba5 100644 --- a/src/ast/scopes/FunctionBodyScope.ts +++ b/src/ast/scopes/FunctionBodyScope.ts @@ -3,6 +3,7 @@ import { logRedeclarationError } from '../../utils/logs'; import type Identifier from '../nodes/Identifier'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import type { VariableKind } from '../nodes/shared/VariableKinds'; +import type { ObjectPath } from '../utils/PathTracker'; import LocalVariable from '../variables/LocalVariable'; import ChildScope from './ChildScope'; import type ParameterScope from './ParameterScope'; @@ -18,6 +19,7 @@ export default class FunctionBodyScope extends ChildScope { identifier: Identifier, context: AstContext, init: ExpressionEntity, + destructuredInitPath: ObjectPath, kind: VariableKind ): LocalVariable { const name = identifier.name; @@ -34,7 +36,14 @@ export default class FunctionBodyScope extends ChildScope { } context.error(logRedeclarationError(name), identifier.start); } - const newVariable = new LocalVariable(identifier.name, identifier, init, context, kind); + const newVariable = new LocalVariable( + identifier.name, + identifier, + init, + destructuredInitPath, + context, + kind + ); this.variables.set(name, newVariable); return newVariable; } diff --git a/src/ast/scopes/FunctionScope.ts b/src/ast/scopes/FunctionScope.ts index ed1d918630f..b6bbd6cefc7 100644 --- a/src/ast/scopes/FunctionScope.ts +++ b/src/ast/scopes/FunctionScope.ts @@ -1,6 +1,7 @@ import type { InclusionContext } from '../ExecutionContext'; -import type SpreadElement from '../nodes/SpreadElement'; +import type { NodeInteractionCalled } from '../NodeInteractions'; import type { ExpressionEntity } from '../nodes/shared/Expression'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import ArgumentsVariable from '../variables/ArgumentsVariable'; import ThisVariable from '../variables/ThisVariable'; import type ChildScope from './ChildScope'; @@ -11,8 +12,8 @@ export default class FunctionScope extends ReturnValueScope { readonly thisVariable: ThisVariable; constructor(parent: ChildScope) { - const { context } = parent; super(parent, false); + const { context } = parent; this.variables.set('arguments', (this.argumentsVariable = new ArgumentsVariable(context))); this.variables.set('this', (this.thisVariable = new ThisVariable(context))); } @@ -21,17 +22,17 @@ export default class FunctionScope extends ReturnValueScope { return this; } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { - super.includeCallArguments(context, parameters); + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { + super.includeCallArguments(context, interaction); if (this.argumentsVariable.included) { - for (const argument of parameters) { - if (!argument.included) { - argument.include(context, false); - } + const { args } = interaction; + for (let argumentIndex = 1; argumentIndex < args.length; argumentIndex++) { + args[argumentIndex]?.includePath(UNKNOWN_PATH, context, false); } } } + + protected addArgumentToBeDeoptimized(argument: ExpressionEntity) { + this.argumentsVariable.addArgumentToBeDeoptimized(argument); + } } diff --git a/src/ast/scopes/ModuleScope.ts b/src/ast/scopes/ModuleScope.ts index 2902fe66656..af7ba723505 100644 --- a/src/ast/scopes/ModuleScope.ts +++ b/src/ast/scopes/ModuleScope.ts @@ -5,6 +5,8 @@ import type ExportDefaultDeclaration from '../nodes/ExportDefaultDeclaration'; import type Identifier from '../nodes/Identifier'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import type { VariableKind } from '../nodes/shared/VariableKinds'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH } from '../utils/PathTracker'; import { UNDEFINED_EXPRESSION } from '../values'; import ExportDefaultVariable from '../variables/ExportDefaultVariable'; import GlobalVariable from '../variables/GlobalVariable'; @@ -20,7 +22,7 @@ export default class ModuleScope extends ChildScope { super(parent, context); this.variables.set( 'this', - new LocalVariable('this', null, UNDEFINED_EXPRESSION, context, 'other') + new LocalVariable('this', null, UNDEFINED_EXPRESSION, EMPTY_PATH, context, 'other') ); } @@ -28,12 +30,13 @@ export default class ModuleScope extends ChildScope { identifier: Identifier, context: AstContext, init: ExpressionEntity, + destructuredInitPath: ObjectPath, kind: VariableKind ): LocalVariable { if (this.context.module.importDescriptions.has(identifier.name)) { context.error(logRedeclarationError(identifier.name), identifier.start); } - return super.addDeclaration(identifier, context, init, kind); + return super.addDeclaration(identifier, context, init, destructuredInitPath, kind); } addExportDefaultDeclaration( diff --git a/src/ast/scopes/ParameterScope.ts b/src/ast/scopes/ParameterScope.ts index 8cc03c02ce1..de5ccdd74e4 100644 --- a/src/ast/scopes/ParameterScope.ts +++ b/src/ast/scopes/ParameterScope.ts @@ -1,8 +1,10 @@ import { logDuplicateArgumentNameError } from '../../utils/logs'; import type { InclusionContext } from '../ExecutionContext'; +import type { NodeInteractionCalled } from '../NodeInteractions'; import type Identifier from '../nodes/Identifier'; import SpreadElement from '../nodes/SpreadElement'; -import type { ExpressionEntity } from '../nodes/shared/Expression'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import ParameterVariable from '../variables/ParameterVariable'; import CatchBodyScope from './CatchBodyScope'; import ChildScope from './ChildScope'; @@ -10,9 +12,9 @@ import FunctionBodyScope from './FunctionBodyScope'; export default class ParameterScope extends ChildScope { readonly bodyScope: ChildScope; - parameters: readonly ParameterVariable[][] = []; - private hasRest = false; + protected hasRest = false; + protected parameters: readonly ParameterVariable[][] = []; constructor(parent: ChildScope, isCatchScope: boolean) { super(parent, parent.context); @@ -23,13 +25,13 @@ export default class ParameterScope extends ChildScope { * Adds a parameter to this scope. Parameters must be added in the correct * order, i.e. from left to right. */ - addParameterDeclaration(identifier: Identifier): ParameterVariable { + addParameterDeclaration(identifier: Identifier, argumentPath: ObjectPath): ParameterVariable { const { name, start } = identifier; const existingParameter = this.variables.get(name); if (existingParameter) { return this.context.error(logDuplicateArgumentNameError(name), start); } - const variable = new ParameterVariable(name, identifier, this.context); + const variable = new ParameterVariable(name, identifier, argumentPath, this.context); this.variables.set(name, variable); // We also add it to the body scope to detect name conflicts with local // variables. We still need the intermediate scope, though, as parameter @@ -49,45 +51,52 @@ export default class ParameterScope extends ChildScope { this.hasRest = hasRest; } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { let calledFromTryStatement = false; let argumentIncluded = false; const restParameter = this.hasRest && this.parameters[this.parameters.length - 1]; - for (const checkedArgument of parameters) { - if (checkedArgument instanceof SpreadElement) { - for (const argument of parameters) { - argument.include(context, false); - } - break; + const { args } = interaction; + let lastExplicitlyIncludedIndex = args.length - 1; + // If there is a SpreadElement, we need to include all arguments after it + // because we no longer know which argument corresponds to which parameter. + for (let argumentIndex = 1; argumentIndex < args.length; argumentIndex++) { + if (args[argumentIndex] instanceof SpreadElement && !argumentIncluded) { + argumentIncluded = true; + lastExplicitlyIncludedIndex = argumentIndex - 1; + } + if (argumentIncluded) { + args[argumentIndex]!.includePath(UNKNOWN_PATH, context, false); } } - for (let index = parameters.length - 1; index >= 0; index--) { - const parameterVariables = this.parameters[index] || restParameter; - const argument = parameters[index]; + // Now we go backwards either starting from the last argument or before the + // first SpreadElement to ensure all arguments before are included as needed + for (let index = lastExplicitlyIncludedIndex; index >= 1; index--) { + const parameterVariables = this.parameters[index - 1] || restParameter; + const argument = args[index]!; if (parameterVariables) { calledFromTryStatement = false; if (parameterVariables.length === 0) { - // handle empty destructuring + // handle empty destructuring to avoid destructuring undefined argumentIncluded = true; } else { for (const variable of parameterVariables) { - if (variable.included) { - argumentIncluded = true; - } if (variable.calledFromTryStatement) { calledFromTryStatement = true; } + if (variable.included) { + argumentIncluded = true; + if (calledFromTryStatement) { + argument.includePath(UNKNOWN_PATH, context, true); + } else { + variable.includeArgumentPaths(argument, context); + } + } } } } - if (!argumentIncluded && argument.shouldBeIncluded(context)) { + if (!argument.included && (argumentIncluded || argument.shouldBeIncluded(context))) { argumentIncluded = true; - } - if (argumentIncluded) { - argument.include(context, calledFromTryStatement); + argument.includePath(EMPTY_PATH, context, calledFromTryStatement); } } } diff --git a/src/ast/scopes/ReturnValueScope.ts b/src/ast/scopes/ReturnValueScope.ts index be4a522f332..0aedb66e81b 100644 --- a/src/ast/scopes/ReturnValueScope.ts +++ b/src/ast/scopes/ReturnValueScope.ts @@ -1,5 +1,8 @@ +import type { NodeInteractionCalled } from '../NodeInteractions'; import { type ExpressionEntity, UNKNOWN_EXPRESSION } from '../nodes/shared/Expression'; +import SpreadElement from '../nodes/SpreadElement'; import { UNKNOWN_PATH } from '../utils/PathTracker'; +import { UNDEFINED_EXPRESSION } from '../values'; import ParameterScope from './ParameterScope'; export default class ReturnValueScope extends ParameterScope { @@ -10,11 +13,64 @@ export default class ReturnValueScope extends ParameterScope { this.returnExpressions.push(expression); } + deoptimizeArgumentsOnCall(interaction: NodeInteractionCalled): void { + const { parameters } = this; + const { args } = interaction; + let position = 0; + for (; position < args.length - 1; position++) { + // Only the "this" argument arg[0] can be null + const argument = args[position + 1]!; + if (argument instanceof SpreadElement) { + // This deoptimizes the current and remaining parameters and arguments + for (; position < parameters.length; position++) { + args[position + 1]?.deoptimizePath(UNKNOWN_PATH); + parameters[position].forEach(variable => variable.markReassigned()); + } + break; + } + if (this.hasRest && position >= parameters.length - 1) { + argument.deoptimizePath(UNKNOWN_PATH); + } else { + const variables = parameters[position]; + if (variables) { + for (const variable of variables) { + variable.addArgumentValue(argument); + } + } + this.addArgumentToBeDeoptimized(argument); + } + } + for (; position < parameters.length; position++) { + for (const variable of parameters[position]) { + variable.addArgumentValue(UNDEFINED_EXPRESSION); + } + } + } + getReturnExpression(): ExpressionEntity { if (this.returnExpression === null) this.updateReturnExpression(); return this.returnExpression!; } + deoptimizeAllParameters() { + for (const parameter of this.parameters) { + for (const variable of parameter) { + variable.deoptimizePath(UNKNOWN_PATH); + variable.markReassigned(); + } + } + } + + reassignAllParameters() { + for (const parameter of this.parameters) { + for (const variable of parameter) { + variable.markReassigned(); + } + } + } + + protected addArgumentToBeDeoptimized(_argument: ExpressionEntity) {} + private updateReturnExpression() { if (this.returnExpressions.length === 1) { this.returnExpression = this.returnExpressions[0]; diff --git a/src/ast/scopes/Scope.ts b/src/ast/scopes/Scope.ts index eaeea352d7d..3be6b64292c 100644 --- a/src/ast/scopes/Scope.ts +++ b/src/ast/scopes/Scope.ts @@ -3,6 +3,7 @@ import { logRedeclarationError } from '../../utils/logs'; import type Identifier from '../nodes/Identifier'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import type { VariableKind } from '../nodes/shared/VariableKinds'; +import type { ObjectPath } from '../utils/PathTracker'; import LocalVariable from '../variables/LocalVariable'; import type Variable from '../variables/Variable'; import type ChildScope from './ChildScope'; @@ -28,20 +29,27 @@ export default class Scope { identifier: Identifier, context: AstContext, init: ExpressionEntity, + destructuredInitPath: ObjectPath, kind: VariableKind ): LocalVariable { const name = identifier.name; const existingVariable = this.hoistedVariables?.get(name) || (this.variables.get(name) as LocalVariable); if (existingVariable) { - const existingKind = existingVariable.kind; - if (kind === 'var' && existingKind === 'var') { + if (kind === 'var' && existingVariable.kind === 'var') { existingVariable.addDeclaration(identifier, init); return existingVariable; } context.error(logRedeclarationError(name), identifier.start); } - const newVariable = new LocalVariable(identifier.name, identifier, init, context, kind); + const newVariable = new LocalVariable( + identifier.name, + identifier, + init, + destructuredInitPath, + context, + kind + ); this.variables.set(name, newVariable); return newVariable; } diff --git a/src/ast/scopes/TrackingScope.ts b/src/ast/scopes/TrackingScope.ts index 7449c5e0f40..616fcafafa8 100644 --- a/src/ast/scopes/TrackingScope.ts +++ b/src/ast/scopes/TrackingScope.ts @@ -2,6 +2,7 @@ import type { AstContext } from '../../Module'; import type Identifier from '../nodes/Identifier'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import type { VariableKind } from '../nodes/shared/VariableKinds'; +import type { ObjectPath } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; import BlockScope from './BlockScope'; @@ -12,9 +13,10 @@ export default class TrackingScope extends BlockScope { identifier: Identifier, context: AstContext, init: ExpressionEntity, + destructuredInitPath: ObjectPath, kind: VariableKind ): LocalVariable { this.hoistedDeclarations.push(identifier); - return super.addDeclaration(identifier, context, init, kind); + return super.addDeclaration(identifier, context, init, destructuredInitPath, kind); } } diff --git a/src/ast/utils/PathTracker.ts b/src/ast/utils/PathTracker.ts index 406ffd661c6..3b70c4add12 100644 --- a/src/ast/utils/PathTracker.ts +++ b/src/ast/utils/PathTracker.ts @@ -1,5 +1,8 @@ +import { EMPTY_OBJECT } from '../../utils/blank'; import { getNewSet, getOrCreate } from '../../utils/getOrCreate'; import type { Entity } from '../Entity'; +import type { InclusionContext } from '../ExecutionContext'; +import type { ExpressionEntity } from '../nodes/shared/Expression'; export const UnknownKey = Symbol('Unknown Key'); export const UnknownNonAccessorKey = Symbol('Unknown Non-Accessor Key'); @@ -34,7 +37,7 @@ interface EntityPaths { [UnknownNonAccessorKey]?: EntityPaths; } -export class PathTracker { +export class EntityPathTracker { private entityPaths: EntityPaths = Object.create(null, { [EntitiesKey]: { value: new Set() } }); @@ -63,15 +66,15 @@ export class PathTracker { private getEntities(path: ObjectPath): Set { let currentPaths = this.entityPaths; for (const pathSegment of path) { - currentPaths = currentPaths[pathSegment] = - currentPaths[pathSegment] || - Object.create(null, { [EntitiesKey]: { value: new Set() } }); + currentPaths = currentPaths[pathSegment] ||= Object.create(null, { + [EntitiesKey]: { value: new Set() } + }); } return currentPaths[EntitiesKey]; } } -export const SHARED_RECURSION_TRACKER = new PathTracker(); +export const SHARED_RECURSION_TRACKER = new EntityPathTracker(); interface DiscriminatedEntityPaths { [pathSegment: string]: DiscriminatedEntityPaths; @@ -94,9 +97,9 @@ export class DiscriminatedPathTracker { ): boolean { let currentPaths = this.entityPaths; for (const pathSegment of path) { - currentPaths = currentPaths[pathSegment] = - currentPaths[pathSegment] || - Object.create(null, { [EntitiesKey]: { value: new Map>() } }); + currentPaths = currentPaths[pathSegment] ||= Object.create(null, { + [EntitiesKey]: { value: new Map>() } + }); } const trackedEntities = getOrCreate( currentPaths[EntitiesKey], @@ -108,3 +111,65 @@ export class DiscriminatedPathTracker { return false; } } + +interface IncludedPaths { + [pathSegment: string]: IncludedPaths; + [UnknownKey]?: IncludedPaths; +} + +const UNKNOWN_INCLUDED_PATH: IncludedPaths = Object.freeze({ [UnknownKey]: EMPTY_OBJECT }); + +export class IncludedPathTracker { + private includedPaths: IncludedPaths | null = null; + + includePathAndGetIfIncluded(path: ObjectPath): boolean { + let included = true; + let parent = this as unknown as IncludedPaths; + let parentSegment = 'includedPaths'; + let currentPaths: IncludedPaths = (this.includedPaths ||= + ((included = false), Object.create(null))); + for (const pathSegment of path) { + // This means from here, all paths are included + if (currentPaths[UnknownKey]) { + return true; + } + // Including UnknownKey automatically includes all nested paths. + // From above, we know that UnknownKey is not included yet. + if (typeof pathSegment === 'symbol') { + // Hopefully, this saves some memory over just setting + // currentPaths[UnknownKey] = EMPTY_OBJECT + parent[parentSegment] = UNKNOWN_INCLUDED_PATH; + return false; + } + parent = currentPaths; + parentSegment = pathSegment; + currentPaths = currentPaths[pathSegment] ||= ((included = false), Object.create(null)); + } + return included; + } + + includeAllPaths(entity: ExpressionEntity, context: InclusionContext, basePath: ObjectPath) { + const { includedPaths } = this; + if (includedPaths) { + includeAllPaths(entity, context, basePath, includedPaths); + } + } +} + +function includeAllPaths( + entity: ExpressionEntity, + context: InclusionContext, + basePath: ObjectPath, + currentPaths: IncludedPaths +): void { + if (currentPaths[UnknownKey]) { + return entity.includePath([...basePath, UnknownKey], context, false); + } + const keys = Object.keys(currentPaths); + if (keys.length === 0) { + return entity.includePath(basePath, context, false); + } + for (const key of keys) { + includeAllPaths(entity, context, [...basePath, key], currentPaths[key]); + } +} diff --git a/src/ast/variables/ArgumentsVariable.ts b/src/ast/variables/ArgumentsVariable.ts index a623b235be2..531d5e7f9a9 100644 --- a/src/ast/variables/ArgumentsVariable.ts +++ b/src/ast/variables/ArgumentsVariable.ts @@ -1,17 +1,18 @@ import type { AstContext } from '../../Module'; +import type { InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import type { ExpressionEntity } from '../nodes/shared/Expression'; import { UNKNOWN_EXPRESSION } from '../nodes/shared/Expression'; import type { ObjectPath } from '../utils/PathTracker'; -import { UNKNOWN_PATH } from '../utils/PathTracker'; +import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import LocalVariable from './LocalVariable'; export default class ArgumentsVariable extends LocalVariable { private deoptimizedArguments: ExpressionEntity[] = []; constructor(context: AstContext) { - super('arguments', null, UNKNOWN_EXPRESSION, context, 'other'); + super('arguments', null, UNKNOWN_EXPRESSION, EMPTY_PATH, context, 'other'); } addArgumentToBeDeoptimized(argument: ExpressionEntity): void { @@ -26,8 +27,8 @@ export default class ArgumentsVariable extends LocalVariable { return type !== INTERACTION_ACCESSED || path.length > 1; } - include() { - super.include(); + includePath(path: ObjectPath, context: InclusionContext) { + super.includePath(path, context); for (const argument of this.deoptimizedArguments) { argument.deoptimizePath(UNKNOWN_PATH); } diff --git a/src/ast/variables/ExportDefaultVariable.ts b/src/ast/variables/ExportDefaultVariable.ts index baed0873c12..f619de19b51 100644 --- a/src/ast/variables/ExportDefaultVariable.ts +++ b/src/ast/variables/ExportDefaultVariable.ts @@ -5,6 +5,7 @@ import FunctionDeclaration from '../nodes/FunctionDeclaration'; import Identifier, { type IdentifierWithVariable } from '../nodes/Identifier'; import type IdentifierBase from '../nodes/shared/IdentifierBase'; import type { NodeBase } from '../nodes/shared/Node'; +import { EMPTY_PATH } from '../utils/PathTracker'; import LocalVariable from './LocalVariable'; import UndefinedVariable from './UndefinedVariable'; import type Variable from './Variable'; @@ -12,7 +13,7 @@ import type Variable from './Variable'; export default class ExportDefaultVariable extends LocalVariable { hasId = false; - private originalId: IdentifierWithVariable | null = null; + private readonly originalId: IdentifierWithVariable | null = null; private originalVariable: Variable | null = null; constructor( @@ -20,7 +21,14 @@ export default class ExportDefaultVariable extends LocalVariable { exportDefaultDeclaration: ExportDefaultDeclaration, context: AstContext ) { - super(name, exportDefaultDeclaration, exportDefaultDeclaration.declaration, context, 'other'); + super( + name, + exportDefaultDeclaration, + exportDefaultDeclaration.declaration, + EMPTY_PATH, + context, + 'other' + ); const declaration = exportDefaultDeclaration.declaration; if ( (declaration instanceof FunctionDeclaration || declaration instanceof ClassDeclaration) && diff --git a/src/ast/variables/ExportShimVariable.ts b/src/ast/variables/ExportShimVariable.ts index f473c49c875..f936e32c3bb 100644 --- a/src/ast/variables/ExportShimVariable.ts +++ b/src/ast/variables/ExportShimVariable.ts @@ -1,5 +1,7 @@ import type Module from '../../Module'; import { MISSING_EXPORT_SHIM_VARIABLE } from '../../utils/variableNames'; +import type { InclusionContext } from '../ExecutionContext'; +import type { ObjectPath } from '../utils/PathTracker'; import Variable from './Variable'; export default class ExportShimVariable extends Variable { @@ -10,8 +12,8 @@ export default class ExportShimVariable extends Variable { this.module = module; } - include(): void { - super.include(); + includePath(path: ObjectPath, context: InclusionContext): void { + super.includePath(path, context); this.module.needsExportShim = true; } } diff --git a/src/ast/variables/ExternalVariable.ts b/src/ast/variables/ExternalVariable.ts index 0775fc03682..ceda7380bd1 100644 --- a/src/ast/variables/ExternalVariable.ts +++ b/src/ast/variables/ExternalVariable.ts @@ -1,8 +1,9 @@ import type ExternalModule from '../../ExternalModule'; +import type { InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import type IdentifierBase from '../nodes/shared/IdentifierBase'; -import type { ObjectPath } from '../utils/PathTracker'; +import { type ObjectPath } from '../utils/PathTracker'; import Variable from './Variable'; export default class ExternalVariable extends Variable { @@ -27,8 +28,8 @@ export default class ExternalVariable extends Variable { return type !== INTERACTION_ACCESSED || path.length > (this.isNamespace ? 1 : 0); } - include(): void { - super.include(); + includePath(path: ObjectPath, context: InclusionContext): void { + super.includePath(path, context); this.module.used = true; } } diff --git a/src/ast/variables/GlobalVariable.ts b/src/ast/variables/GlobalVariable.ts index 4f168ac8f86..d6be0ebab4d 100644 --- a/src/ast/variables/GlobalVariable.ts +++ b/src/ast/variables/GlobalVariable.ts @@ -9,7 +9,7 @@ import { import type { LiteralValueOrUnknown } from '../nodes/shared/Expression'; import { UnknownValue } from '../nodes/shared/Expression'; import { getGlobalAtPath } from '../nodes/shared/knownGlobals'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import { type EntityPathTracker, type ObjectPath } from '../utils/PathTracker'; import Variable from './Variable'; export default class GlobalVariable extends Variable { @@ -23,7 +23,7 @@ export default class GlobalVariable extends Variable { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ) { switch (interaction.type) { // While there is no point in testing these cases as at the moment, they @@ -49,7 +49,7 @@ export default class GlobalVariable extends Variable { getLiteralValueAtPath( path: ObjectPath, - _recursionTracker: PathTracker, + _recursionTracker: EntityPathTracker, _origin: DeoptimizableEntity ): LiteralValueOrUnknown { const globalAtPath = getGlobalAtPath([this.name, ...path]); diff --git a/src/ast/variables/LocalVariable.ts b/src/ast/variables/LocalVariable.ts index 83b32a81ef7..97d262a4c2d 100644 --- a/src/ast/variables/LocalVariable.ts +++ b/src/ast/variables/LocalVariable.ts @@ -2,7 +2,6 @@ import type { AstContext, default as Module } from '../../Module'; import { EMPTY_ARRAY } from '../../utils/blank'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import { createInclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { INTERACTION_ACCESSED, @@ -12,7 +11,6 @@ import { import type ExportDefaultDeclaration from '../nodes/ExportDefaultDeclaration'; import type Identifier from '../nodes/Identifier'; import * as NodeType from '../nodes/NodeType'; -import type SpreadElement from '../nodes/SpreadElement'; import { deoptimizeInteraction, type ExpressionEntity, @@ -23,33 +21,43 @@ import { } from '../nodes/shared/Expression'; import type { Node } from '../nodes/shared/Node'; import type { VariableKind } from '../nodes/shared/VariableKinds'; -import { type ObjectPath, type PathTracker, UNKNOWN_PATH } from '../utils/PathTracker'; +import { limitConcatenatedPathDepth, MAX_PATH_DEPTH } from '../utils/limitPathLength'; +import { + EMPTY_PATH, + type EntityPathTracker, + IncludedPathTracker, + type ObjectPath, + UNKNOWN_PATH, + UnknownKey +} from '../utils/PathTracker'; import Variable from './Variable'; export default class LocalVariable extends Variable { calledFromTryStatement = false; + readonly declarations: (Identifier | ExportDefaultDeclaration)[]; readonly module: Module; - readonly kind: VariableKind; protected additionalInitializers: ExpressionEntity[] | null = null; // Caching and deoptimization: // We track deoptimization when we do not return something unknown - protected deoptimizationTracker: PathTracker; + protected deoptimizationTracker: EntityPathTracker; + protected includedPathTracker = new IncludedPathTracker(); private expressionsToBeDeoptimized: DeoptimizableEntity[] = []; constructor( name: string, declarator: Identifier | ExportDefaultDeclaration | null, private init: ExpressionEntity, + /** if this is non-empty, the actual init is this path of this.init */ + protected initPath: ObjectPath, context: AstContext, - kind: VariableKind + readonly kind: VariableKind ) { super(name); this.declarations = declarator ? [declarator] : []; this.deoptimizationTracker = context.deoptimizationTracker; this.module = context.module; - this.kind = kind; } addDeclaration(identifier: Identifier, init: ExpressionEntity): void { @@ -62,23 +70,28 @@ export default class LocalVariable extends Variable { for (const initializer of this.additionalInitializers) { initializer.deoptimizePath(UNKNOWN_PATH); } - this.additionalInitializers = null; } } deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ): void { - if (this.isReassigned) { + if (this.isReassigned || path.length + this.initPath.length > MAX_PATH_DEPTH) { deoptimizeInteraction(interaction); return; } recursionTracker.withTrackedEntityAtPath( path, this.init, - () => this.init.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker), + () => { + this.init.deoptimizeArgumentsOnInteractionAtPath( + interaction, + [...this.initPath, ...path], + recursionTracker + ); + }, undefined ); } @@ -97,18 +110,18 @@ export default class LocalVariable extends Variable { for (const expression of expressionsToBeDeoptimized) { expression.deoptimizeCache(); } - this.init.deoptimizePath(UNKNOWN_PATH); + this.init.deoptimizePath([...this.initPath, UnknownKey]); } else { - this.init.deoptimizePath(path); + this.init.deoptimizePath(limitConcatenatedPathDepth(this.initPath, path)); } } getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { - if (this.isReassigned) { + if (this.isReassigned || path.length + this.initPath.length > MAX_PATH_DEPTH) { return UnknownValue; } return recursionTracker.withTrackedEntityAtPath( @@ -116,7 +129,11 @@ export default class LocalVariable extends Variable { this.init, () => { this.expressionsToBeDeoptimized.push(origin); - return this.init.getLiteralValueAtPath(path, recursionTracker, origin); + return this.init.getLiteralValueAtPath( + [...this.initPath, ...path], + recursionTracker, + origin + ); }, UnknownValue ); @@ -125,10 +142,10 @@ export default class LocalVariable extends Variable { getReturnExpressionWhenCalledAtPath( path: ObjectPath, interaction: NodeInteractionCalled, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { - if (this.isReassigned) { + if (this.isReassigned || path.length + this.initPath.length > MAX_PATH_DEPTH) { return UNKNOWN_RETURN_EXPRESSION; } return recursionTracker.withTrackedEntityAtPath( @@ -137,7 +154,7 @@ export default class LocalVariable extends Variable { () => { this.expressionsToBeDeoptimized.push(origin); return this.init.getReturnExpressionWhenCalledAtPath( - path, + [...this.initPath, ...path], interaction, recursionTracker, origin @@ -152,12 +169,15 @@ export default class LocalVariable extends Variable { interaction: NodeInteraction, context: HasEffectsContext ): boolean { + if (path.length + this.initPath.length > MAX_PATH_DEPTH) { + return true; + } switch (interaction.type) { case INTERACTION_ACCESSED: { if (this.isReassigned) return true; return ( !context.accessed.trackEntityAtPathAndGetIfTracked(path, this) && - this.init.hasEffectsOnInteractionAtPath(path, interaction, context) + this.init.hasEffectsOnInteractionAtPath([...this.initPath, ...path], interaction, context) ); } case INTERACTION_ASSIGNED: { @@ -166,7 +186,7 @@ export default class LocalVariable extends Variable { if (this.isReassigned) return true; return ( !context.assigned.trackEntityAtPathAndGetIfTracked(path, this) && - this.init.hasEffectsOnInteractionAtPath(path, interaction, context) + this.init.hasEffectsOnInteractionAtPath([...this.initPath, ...path], interaction, context) ); } case INTERACTION_CALLED: { @@ -175,18 +195,18 @@ export default class LocalVariable extends Variable { !( interaction.withNew ? context.instantiated : context.called ).trackEntityAtPathAndGetIfTracked(path, interaction.args, this) && - this.init.hasEffectsOnInteractionAtPath(path, interaction, context) + this.init.hasEffectsOnInteractionAtPath([...this.initPath, ...path], interaction, context) ); } } } - include(): void { - if (!this.included) { - super.include(); + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.includedPathTracker.includePathAndGetIfIncluded(path)) { + super.includePath(path, context); for (const declaration of this.declarations) { // If node is a default export, it can save a tree-shaking run to include the full declaration now - if (!declaration.included) declaration.include(createInclusionContext(), false); + if (!declaration.included) declaration.includePath(EMPTY_PATH, context, false); let node = declaration.parent as Node; while (!node.included) { // We do not want to properly include parents in case they are part of a dead branch @@ -196,20 +216,30 @@ export default class LocalVariable extends Variable { node = node.parent as Node; } } + // We need to make sure we include the correct path of the init + if (path.length > 0) { + this.init.includePath(limitConcatenatedPathDepth(this.initPath, path), context, false); + this.additionalInitializers?.forEach(initializer => + initializer.includePath(UNKNOWN_PATH, context, false) + ); + } } } - includeCallArguments( - context: InclusionContext, - parameters: readonly (ExpressionEntity | SpreadElement)[] - ): void { - if (this.isReassigned || context.includedCallArguments.has(this.init)) { - for (const argument of parameters) { - argument.include(context, false); + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { + if ( + this.isReassigned || + context.includedCallArguments.has(this.init) || + // This can be removed again once we can include arguments when called at + // a specific path + this.initPath.length > 0 + ) { + for (const argument of interaction.args) { + argument?.includePath(UNKNOWN_PATH, context, false); } } else { context.includedCallArguments.add(this.init); - this.init.includeCallArguments(context, parameters); + this.init.includeCallArguments(context, interaction); context.includedCallArguments.delete(this.init); } } diff --git a/src/ast/variables/NamespaceVariable.ts b/src/ast/variables/NamespaceVariable.ts index 6085c435b76..91006e53625 100644 --- a/src/ast/variables/NamespaceVariable.ts +++ b/src/ast/variables/NamespaceVariable.ts @@ -3,14 +3,14 @@ import { stringifyObjectKeyIfNeeded } from '../../utils/identifierHelpers'; import { getToStringTagValue, MERGE_NAMESPACES_VARIABLE } from '../../utils/interopHelpers'; import type { RenderOptions } from '../../utils/renderHelpers'; import { getSystemExportStatement } from '../../utils/systemJsRendering'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ASSIGNED, INTERACTION_CALLED } from '../NodeInteractions'; import type { LiteralValueOrUnknown } from '../nodes/shared/Expression'; import { deoptimizeInteraction, UnknownValue } from '../nodes/shared/Expression'; import type IdentifierBase from '../nodes/shared/IdentifierBase'; import type ChildScope from '../scopes/ChildScope'; -import type { ObjectPath, PathTracker } from '../utils/PathTracker'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import { SymbolToStringTag } from '../utils/PathTracker'; import Variable from './Variable'; @@ -38,7 +38,7 @@ export default class NamespaceVariable extends Variable { deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, - recursionTracker: PathTracker + recursionTracker: EntityPathTracker ) { if (path.length > 1 || (path.length === 1 && interaction.type === INTERACTION_CALLED)) { const key = path[0]; @@ -113,8 +113,8 @@ export default class NamespaceVariable extends Variable { ); } - include(): void { - super.include(); + includePath(path: ObjectPath, context: InclusionContext): void { + super.includePath(path, context); this.context.includeAllExports(); } diff --git a/src/ast/variables/ParameterVariable.ts b/src/ast/variables/ParameterVariable.ts index a17bf3b1152..b9f354fcf67 100644 --- a/src/ast/variables/ParameterVariable.ts +++ b/src/ast/variables/ParameterVariable.ts @@ -1,7 +1,8 @@ import type { AstContext } from '../../Module'; import { EMPTY_ARRAY } from '../../utils/blank'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { InclusionContext } from '../ExecutionContext'; +import { type HasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ASSIGNED, INTERACTION_CALLED } from '../NodeInteractions'; import type ExportDefaultDeclaration from '../nodes/ExportDefaultDeclaration'; @@ -13,10 +14,10 @@ import { UNKNOWN_RETURN_EXPRESSION, UnknownValue } from '../nodes/shared/Expression'; +import { MAX_PATH_DEPTH } from '../utils/limitPathLength'; import type { ObjectPath, ObjectPathKey } from '../utils/PathTracker'; import { - EMPTY_PATH, - PathTracker, + EntityPathTracker, SHARED_RECURSION_TRACKER, UNKNOWN_PATH, UnknownKey @@ -31,31 +32,33 @@ interface DeoptimizationInteraction { const MAX_TRACKED_INTERACTIONS = 20; const NO_INTERACTIONS = EMPTY_ARRAY as unknown as DeoptimizationInteraction[]; const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]); -const EMPTY_PATH_TRACKER = new PathTracker(); +const EMPTY_PATH_TRACKER = new EntityPathTracker(); const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]); export default class ParameterVariable extends LocalVariable { private deoptimizationInteractions: DeoptimizationInteraction[] = []; - private deoptimizations = new PathTracker(); + private deoptimizations = new EntityPathTracker(); private deoptimizedFields = new Set(); - private entitiesToBeDeoptimized = new Set(); - private expressionsUseTheKnownValue: DeoptimizableEntity[] = []; + private argumentsToBeDeoptimized = new Set(); + private expressionsDependingOnKnownValue: DeoptimizableEntity[] = []; constructor( name: string, declarator: Identifier | ExportDefaultDeclaration | null, + argumentPath: ObjectPath, context: AstContext ) { - super(name, declarator, UNKNOWN_EXPRESSION, context, 'parameter'); + super(name, declarator, UNKNOWN_EXPRESSION, argumentPath, context, 'parameter'); } - addEntityToBeDeoptimized(entity: ExpressionEntity): void { + addArgumentValue(entity: ExpressionEntity): void { + this.updateKnownValue(entity); if (entity === UNKNOWN_EXPRESSION) { // As unknown expressions fully deoptimize all interactions, we can clear // the interaction cache at this point provided we keep this optimization // in mind when adding new interactions - if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) { - this.entitiesToBeDeoptimized.add(UNKNOWN_EXPRESSION); + if (!this.argumentsToBeDeoptimized.has(UNKNOWN_EXPRESSION)) { + this.argumentsToBeDeoptimized.add(UNKNOWN_EXPRESSION); for (const { interaction } of this.deoptimizationInteractions) { deoptimizeInteraction(interaction); } @@ -64,27 +67,38 @@ export default class ParameterVariable extends LocalVariable { } else if (this.deoptimizedFields.has(UnknownKey)) { // This means that we already deoptimized all interactions and no longer // track them - entity.deoptimizePath(UNKNOWN_PATH); - } else if (!this.entitiesToBeDeoptimized.has(entity)) { - this.entitiesToBeDeoptimized.add(entity); + entity.deoptimizePath([...this.initPath, UnknownKey]); + } else if (!this.argumentsToBeDeoptimized.has(entity)) { + this.argumentsToBeDeoptimized.add(entity); for (const field of this.deoptimizedFields) { - entity.deoptimizePath([field]); + entity.deoptimizePath([...this.initPath, field]); } for (const { interaction, path } of this.deoptimizationInteractions) { - entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER); + if (this.initPath.length + path.length > MAX_PATH_DEPTH) { + deoptimizeInteraction(interaction); + continue; + } + entity.deoptimizeArgumentsOnInteractionAtPath( + interaction, + [...this.initPath, ...path], + SHARED_RECURSION_TRACKER + ); } } } + /** This says we should not make assumptions about the value of the parameter. + * This is different from deoptimization that will also cause argument values + * to be deoptimized. */ markReassigned(): void { if (this.isReassigned) { return; } super.markReassigned(); - for (const expression of this.expressionsUseTheKnownValue) { + for (const expression of this.expressionsDependingOnKnownValue) { expression.deoptimizeCache(); } - this.expressionsUseTheKnownValue = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; + this.expressionsDependingOnKnownValue = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; } deoptimizeCache(): void { @@ -99,7 +113,7 @@ export default class ParameterVariable extends LocalVariable { * and deoptimizeCache itself to mark reassigned if the argument is changed. * @param argument The argument of the function call */ - updateKnownValue(argument: ExpressionEntity) { + private updateKnownValue(argument: ExpressionEntity) { if (this.isReassigned) { return; } @@ -107,7 +121,7 @@ export default class ParameterVariable extends LocalVariable { if (this.knownValue === null) { this.knownValue = argument; this.knownValueLiteral = argument.getLiteralValueAtPath( - EMPTY_PATH, + this.initPath, SHARED_RECURSION_TRACKER, this ); @@ -130,7 +144,7 @@ export default class ParameterVariable extends LocalVariable { return; } // add tracking for the new argument - const newValue = argument.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this); + const newValue = argument.getLiteralValueAtPath(this.initPath, SHARED_RECURSION_TRACKER, this); if (newValue !== oldValue) { this.markReassigned(); } @@ -152,18 +166,18 @@ export default class ParameterVariable extends LocalVariable { getLiteralValueAtPath( path: ObjectPath, - recursionTracker: PathTracker, + recursionTracker: EntityPathTracker, origin: DeoptimizableEntity ): LiteralValueOrUnknown { - if (this.isReassigned) { + if (this.isReassigned || path.length + this.initPath.length > MAX_PATH_DEPTH) { return UnknownValue; } const knownValue = this.getKnownValue(); - this.expressionsUseTheKnownValue.push(origin); + this.expressionsDependingOnKnownValue.push(origin); return recursionTracker.withTrackedEntityAtPath( path, knownValue, - () => knownValue.getLiteralValueAtPath(path, recursionTracker, origin), + () => knownValue.getLiteralValueAtPath([...this.initPath, ...path], recursionTracker, origin), UnknownValue ); } @@ -173,18 +187,34 @@ export default class ParameterVariable extends LocalVariable { interaction: NodeInteraction, context: HasEffectsContext ): boolean { - if (this.isReassigned || interaction.type === INTERACTION_ASSIGNED) { + const { type } = interaction; + if ( + this.isReassigned || + type === INTERACTION_ASSIGNED || + path.length + this.initPath.length > MAX_PATH_DEPTH + ) { return super.hasEffectsOnInteractionAtPath(path, interaction, context); } - const knownValue = this.getKnownValue(); - return knownValue.hasEffectsOnInteractionAtPath(path, interaction, context); + return ( + !(type === INTERACTION_CALLED + ? (interaction.withNew + ? context.instantiated + : context.called + ).trackEntityAtPathAndGetIfTracked(path, interaction.args, this) + : context.accessed.trackEntityAtPathAndGetIfTracked(path, this)) && + this.getKnownValue().hasEffectsOnInteractionAtPath( + [...this.initPath, ...path], + interaction, + context + ) + ); } deoptimizeArgumentsOnInteractionAtPath(interaction: NodeInteraction, path: ObjectPath): void { // For performance reasons, we fully deoptimize all deeper interactions if ( path.length >= 2 || - this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION) || + this.argumentsToBeDeoptimized.has(UNKNOWN_EXPRESSION) || this.deoptimizationInteractions.length >= MAX_TRACKED_INTERACTIONS || (path.length === 1 && (this.deoptimizedFields.has(UnknownKey) || @@ -194,10 +224,14 @@ export default class ParameterVariable extends LocalVariable { return; } if (!this.deoptimizations.trackEntityAtPathAndGetIfTracked(path, interaction.args)) { - for (const entity of this.entitiesToBeDeoptimized) { - entity.deoptimizeArgumentsOnInteractionAtPath(interaction, path, SHARED_RECURSION_TRACKER); + for (const entity of this.argumentsToBeDeoptimized) { + entity.deoptimizeArgumentsOnInteractionAtPath( + interaction, + [...this.initPath, ...path], + SHARED_RECURSION_TRACKER + ); } - if (!this.entitiesToBeDeoptimized.has(UNKNOWN_EXPRESSION)) { + if (!this.argumentsToBeDeoptimized.has(UNKNOWN_EXPRESSION)) { this.deoptimizationInteractions.push({ interaction, path @@ -219,17 +253,17 @@ export default class ParameterVariable extends LocalVariable { return; } this.deoptimizedFields.add(key); - for (const entity of this.entitiesToBeDeoptimized) { + for (const entity of this.argumentsToBeDeoptimized) { // We do not need a recursion tracker here as we already track whether // this field is deoptimized - entity.deoptimizePath([key]); + entity.deoptimizePath([...this.initPath, key]); } if (key === UnknownKey) { // save some memory this.deoptimizationInteractions = NO_INTERACTIONS; this.deoptimizations = EMPTY_PATH_TRACKER; this.deoptimizedFields = UNKNOWN_DEOPTIMIZED_FIELD; - this.entitiesToBeDeoptimized = UNKNOWN_DEOPTIMIZED_ENTITY; + this.argumentsToBeDeoptimized = UNKNOWN_DEOPTIMIZED_ENTITY; } } @@ -246,4 +280,8 @@ export default class ParameterVariable extends LocalVariable { } return UNKNOWN_RETURN_EXPRESSION; } + + includeArgumentPaths(entity: ExpressionEntity, context: InclusionContext) { + this.includedPathTracker.includeAllPaths(entity, context, this.initPath); + } } diff --git a/src/ast/variables/SyntheticNamedExportVariable.ts b/src/ast/variables/SyntheticNamedExportVariable.ts index ce10f442ede..685b4e78b3d 100644 --- a/src/ast/variables/SyntheticNamedExportVariable.ts +++ b/src/ast/variables/SyntheticNamedExportVariable.ts @@ -1,5 +1,7 @@ import type Module from '../../Module'; import type { AstContext } from '../../Module'; +import type { InclusionContext } from '../ExecutionContext'; +import { type ObjectPath } from '../utils/PathTracker'; import ExportDefaultVariable from './ExportDefaultVariable'; import Variable from './Variable'; @@ -44,9 +46,9 @@ export default class SyntheticNamedExportVariable extends Variable { return `${this.syntheticNamespace.getName(getPropertyAccess)}${getPropertyAccess(this.name)}`; } - include(): void { - super.include(); - this.context.includeVariableInModule(this.syntheticNamespace); + includePath(path: ObjectPath, context: InclusionContext): void { + super.includePath(path, context); + this.context.includeVariableInModule(this.syntheticNamespace, path); } setRenderNames(baseName: string | null, name: string | null): void { diff --git a/src/ast/variables/ThisVariable.ts b/src/ast/variables/ThisVariable.ts index 1d8ea9bcd47..b55b2c1f4b1 100644 --- a/src/ast/variables/ThisVariable.ts +++ b/src/ast/variables/ThisVariable.ts @@ -2,12 +2,12 @@ import type { AstContext } from '../../Module'; import type { HasEffectsContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { UNKNOWN_EXPRESSION } from '../nodes/shared/Expression'; -import { type ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH, type ObjectPath } from '../utils/PathTracker'; import ParameterVariable from './ParameterVariable'; export default class ThisVariable extends ParameterVariable { constructor(context: AstContext) { - super('this', null, context); + super('this', null, EMPTY_PATH, context); } hasEffectsOnInteractionAtPath( diff --git a/src/ast/variables/Variable.ts b/src/ast/variables/Variable.ts index 2b8a1924f47..319608171dc 100644 --- a/src/ast/variables/Variable.ts +++ b/src/ast/variables/Variable.ts @@ -1,7 +1,7 @@ import type ExternalModule from '../../ExternalModule'; import type Module from '../../Module'; import type { RenderOptions } from '../../utils/renderHelpers'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import type CallExpression from '../nodes/CallExpression'; @@ -112,9 +112,9 @@ export default class Variable extends ExpressionEntity { * has not been included previously. Once a variable is included, it should * take care all its declarations are included. */ - include(): void { + includePath(path: ObjectPath, context: InclusionContext): void { this.included = true; - this.renderedLikeHoisted?.include(); + this.renderedLikeHoisted?.includePath(path, context); } /** diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_config.js b/test/chunking-form/samples/dynamic-import-with-namespace/_config.js new file mode 100644 index 00000000000..e2744888c32 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_config.js @@ -0,0 +1,22 @@ +const fs = require('node:fs'); +const path = require('node:path'); + +const moduleContent = fs.readFileSync(path.resolve(__dirname, './module.js'), 'utf8'); +let count = 1; +module.exports = defineTest({ + description: 'The all cases of tree-shaking for dynamic import with namespace', + options: { + plugins: [ + { + resolveId(id) { + if (id.startsWith('./module')) return id + count++; + return this.resolve(id); + }, + load(id) { + if (id.endsWith('main.js')) return null; + return moduleContent; + } + } + ] + } +}); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module1.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module1.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module1.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module10.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module10.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module10.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module2.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module2.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module2.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module3.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module3.js new file mode 100644 index 00000000000..3123adef9b9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module3.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + + exports.foo = foo; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module4.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module4.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module4.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module5.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module5.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module5.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module6.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module6.js new file mode 100644 index 00000000000..3123adef9b9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module6.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + + exports.foo = foo; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module7.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module7.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module7.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module8.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module8.js new file mode 100644 index 00000000000..0317e08cea9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module8.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + const bar = () => {}; + const baz = () => {}; + const qux = () => {}; + + exports.bar = bar; + exports.baz = baz; + exports.foo = foo; + exports.qux = qux; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module9.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module9.js new file mode 100644 index 00000000000..3123adef9b9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/generated-module9.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const foo = () => {}; + + exports.foo = foo; + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/main.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/main.js new file mode 100644 index 00000000000..012563bd0b4 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/amd/main.js @@ -0,0 +1,87 @@ +define(['require'], (function (require) { 'use strict'; + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module1'], resolve, reject); }); + module.foo(); + // disabled + module[global.unknown](); + module.baz(); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module2'], resolve, reject); }); + const module1 = module; + module1.foo(); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module3'], resolve, reject); }); + const { foo } = module; + foo(); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module4'], resolve, reject); }); + // disabled + const { foo, ...rest } = module; + foo(); + rest.bar(); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module5'], resolve, reject); }); + readFoo({ foo: () => {} }); + readFoo(module); + function readFoo(module1) { + module1.foo(); + } + function readBar(module2) { + module2.bar(); + } + readBar(module); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module6'], resolve, reject); }); + function b({ foo }) { + foo(); + } + b(module); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module7'], resolve, reject); }); + // disabled + function b({ foo, ...rest }) { + foo(); + assert.ok(rest); + } + b(module); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module8'], resolve, reject); }); + // disabled + function b(o1, ...rest) { + assert.ok(rest); + } + b(o1, o2, module); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module9'], resolve, reject); }); + // disabled + function b({ foo = 1 }) { + assert.ok(foo); + } + b(module); + })(); + + (async () => { + const module = await new Promise(function (resolve, reject) { require(['./generated-module10'], resolve, reject); }); + (module).bar(); + (global.unknown && module).foo(); + (global.unknown ? module : 'foo').baz(); + })(); + +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module1.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module1.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module1.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module10.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module10.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module10.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module2.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module2.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module2.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module3.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module3.js new file mode 100644 index 00000000000..02ce8a98f32 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module3.js @@ -0,0 +1,5 @@ +'use strict'; + +const foo = () => {}; + +exports.foo = foo; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module4.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module4.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module4.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module5.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module5.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module5.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module6.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module6.js new file mode 100644 index 00000000000..02ce8a98f32 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module6.js @@ -0,0 +1,5 @@ +'use strict'; + +const foo = () => {}; + +exports.foo = foo; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module7.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module7.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module7.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module8.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module8.js new file mode 100644 index 00000000000..32b8c4cc05f --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module8.js @@ -0,0 +1,11 @@ +'use strict'; + +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +exports.bar = bar; +exports.baz = baz; +exports.foo = foo; +exports.qux = qux; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module9.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module9.js new file mode 100644 index 00000000000..02ce8a98f32 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/generated-module9.js @@ -0,0 +1,5 @@ +'use strict'; + +const foo = () => {}; + +exports.foo = foo; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/main.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/main.js new file mode 100644 index 00000000000..9afab559262 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/cjs/main.js @@ -0,0 +1,85 @@ +'use strict'; + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module1.js'); }); + module.foo(); + // disabled + module[global.unknown](); + module.baz(); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module2.js'); }); + const module1 = module; + module1.foo(); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module3.js'); }); + const { foo } = module; + foo(); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module4.js'); }); + // disabled + const { foo, ...rest } = module; + foo(); + rest.bar(); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module5.js'); }); + readFoo({ foo: () => {} }); + readFoo(module); + function readFoo(module1) { + module1.foo(); + } + function readBar(module2) { + module2.bar(); + } + readBar(module); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module6.js'); }); + function b({ foo }) { + foo(); + } + b(module); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module7.js'); }); + // disabled + function b({ foo, ...rest }) { + foo(); + assert.ok(rest); + } + b(module); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module8.js'); }); + // disabled + function b(o1, ...rest) { + assert.ok(rest); + } + b(o1, o2, module); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module9.js'); }); + // disabled + function b({ foo = 1 }) { + assert.ok(foo); + } + b(module); +})(); + +(async () => { + const module = await Promise.resolve().then(function () { return require('./generated-module10.js'); }); + (module).bar(); + (global.unknown && module).foo(); + (global.unknown ? module : 'foo').baz(); +})(); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module1.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module1.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module1.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module10.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module10.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module10.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module2.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module2.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module2.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module3.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module3.js new file mode 100644 index 00000000000..4ac31b619b3 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module3.js @@ -0,0 +1,3 @@ +const foo = () => {}; + +export { foo }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module4.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module4.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module4.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module5.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module5.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module5.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module6.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module6.js new file mode 100644 index 00000000000..4ac31b619b3 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module6.js @@ -0,0 +1,3 @@ +const foo = () => {}; + +export { foo }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module7.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module7.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module7.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module8.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module8.js new file mode 100644 index 00000000000..79e04081470 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module8.js @@ -0,0 +1,6 @@ +const foo = () => {}; +const bar = () => {}; +const baz = () => {}; +const qux = () => {}; + +export { bar, baz, foo, qux }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module9.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module9.js new file mode 100644 index 00000000000..4ac31b619b3 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/generated-module9.js @@ -0,0 +1,3 @@ +const foo = () => {}; + +export { foo }; diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/main.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/main.js new file mode 100644 index 00000000000..9d78ab9ac03 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/es/main.js @@ -0,0 +1,83 @@ +(async () => { + const module = await import('./generated-module1.js'); + module.foo(); + // disabled + module[global.unknown](); + module.baz(); +})(); + +(async () => { + const module = await import('./generated-module2.js'); + const module1 = module; + module1.foo(); +})(); + +(async () => { + const module = await import('./generated-module3.js'); + const { foo } = module; + foo(); +})(); + +(async () => { + const module = await import('./generated-module4.js'); + // disabled + const { foo, ...rest } = module; + foo(); + rest.bar(); +})(); + +(async () => { + const module = await import('./generated-module5.js'); + readFoo({ foo: () => {} }); + readFoo(module); + function readFoo(module1) { + module1.foo(); + } + function readBar(module2) { + module2.bar(); + } + readBar(module); +})(); + +(async () => { + const module = await import('./generated-module6.js'); + function b({ foo }) { + foo(); + } + b(module); +})(); + +(async () => { + const module = await import('./generated-module7.js'); + // disabled + function b({ foo, ...rest }) { + foo(); + assert.ok(rest); + } + b(module); +})(); + +(async () => { + const module = await import('./generated-module8.js'); + // disabled + function b(o1, ...rest) { + assert.ok(rest); + } + b(o1, o2, module); +})(); + +(async () => { + const module = await import('./generated-module9.js'); + // disabled + function b({ foo = 1 }) { + assert.ok(foo); + } + b(module); +})(); + +(async () => { + const module = await import('./generated-module10.js'); + (module).bar(); + (global.unknown && module).foo(); + (global.unknown ? module : 'foo').baz(); +})(); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module1.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module1.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module1.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module10.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module10.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module10.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module2.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module2.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module2.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module3.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module3.js new file mode 100644 index 00000000000..72f26099c8c --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module3.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module4.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module4.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module4.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module5.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module5.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module5.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module6.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module6.js new file mode 100644 index 00000000000..72f26099c8c --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module6.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module7.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module7.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module7.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module8.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module8.js new file mode 100644 index 00000000000..e683d313eb5 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module8.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + const bar = exports("bar", () => {}); + const baz = exports("baz", () => {}); + const qux = exports("qux", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module9.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module9.js new file mode 100644 index 00000000000..72f26099c8c --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/generated-module9.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const foo = exports("foo", () => {}); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/main.js b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/main.js new file mode 100644 index 00000000000..e5eda4d493c --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/_expected/system/main.js @@ -0,0 +1,92 @@ +System.register([], (function (exports, module) { + 'use strict'; + return { + execute: (function () { + + (async () => { + const module$1 = await module.import('./generated-module1.js'); + module$1.foo(); + // disabled + module$1[global.unknown](); + module$1.baz(); + })(); + + (async () => { + const module$1 = await module.import('./generated-module2.js'); + const module1 = module$1; + module1.foo(); + })(); + + (async () => { + const module$1 = await module.import('./generated-module3.js'); + const { foo } = module$1; + foo(); + })(); + + (async () => { + const module$1 = await module.import('./generated-module4.js'); + // disabled + const { foo, ...rest } = module$1; + foo(); + rest.bar(); + })(); + + (async () => { + const module$1 = await module.import('./generated-module5.js'); + readFoo({ foo: () => {} }); + readFoo(module$1); + function readFoo(module1) { + module1.foo(); + } + function readBar(module2) { + module2.bar(); + } + readBar(module$1); + })(); + + (async () => { + const module$1 = await module.import('./generated-module6.js'); + function b({ foo }) { + foo(); + } + b(module$1); + })(); + + (async () => { + const module$1 = await module.import('./generated-module7.js'); + // disabled + function b({ foo, ...rest }) { + foo(); + assert.ok(rest); + } + b(module$1); + })(); + + (async () => { + const module$1 = await module.import('./generated-module8.js'); + // disabled + function b(o1, ...rest) { + assert.ok(rest); + } + b(o1, o2, module$1); + })(); + + (async () => { + const module$1 = await module.import('./generated-module9.js'); + // disabled + function b({ foo = 1 }) { + assert.ok(foo); + } + b(module$1); + })(); + + (async () => { + const module$1 = await module.import('./generated-module10.js'); + (module$1).bar(); + (global.unknown && module$1).foo(); + (global.unknown ? module$1 : 'foo').baz(); + })(); + + }) + }; +})); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/main.js b/test/chunking-form/samples/dynamic-import-with-namespace/main.js new file mode 100644 index 00000000000..d7ad776d7a9 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/main.js @@ -0,0 +1,83 @@ +(async () => { + const module = await import('./module'); + module.foo(); + // disabled + module[global.unknown](); + module.baz(); +})(); + +(async () => { + const module = await import('./module'); + const module1 = module; + module1.foo(); +})(); + +(async () => { + const module = await import('./module'); + const { foo } = module; + foo(); +})(); + +(async () => { + const module = await import('./module'); + // disabled + const { foo, ...rest } = module; + foo(); + rest.bar(); +})(); + +(async () => { + const module = await import('./module'); + readFoo({ foo: () => {} }); + readFoo(module); + function readFoo(module1) { + module1.foo(); + } + function readBar(module2) { + module2.bar(); + } + readBar(module); +})(); + +(async () => { + const module = await import('./module'); + function b({ foo }) { + foo(); + } + b(module); +})(); + +(async () => { + const module = await import('./module'); + // disabled + function b({ foo, ...rest }) { + foo(); + assert.ok(rest); + } + b(module); +})(); + +(async () => { + const module = await import('./module'); + // disabled + function b(o1, ...rest) { + assert.ok(rest); + } + b(o1, o2, module); +})(); + +(async () => { + const module = await import('./module'); + // disabled + function b({ foo = 1 }) { + assert.ok(foo); + } + b(module); +})(); + +(async () => { + const module = await import('./module'); + ('foo', module).bar(); + (global.unknown && module).foo(); + (global.unknown ? module : 'foo').baz(); +})(); diff --git a/test/chunking-form/samples/dynamic-import-with-namespace/module.js b/test/chunking-form/samples/dynamic-import-with-namespace/module.js new file mode 100644 index 00000000000..711d5691650 --- /dev/null +++ b/test/chunking-form/samples/dynamic-import-with-namespace/module.js @@ -0,0 +1,4 @@ +export const foo = () => {}; +export const bar = () => {}; +export const baz = () => {}; +export const qux = () => {}; diff --git a/test/form/samples/argument-deoptimization/no-default-deoptimization/_expected.js b/test/form/samples/argument-deoptimization/no-default-deoptimization/_expected.js index d8c0c92e38d..4825187a84f 100644 --- a/test/form/samples/argument-deoptimization/no-default-deoptimization/_expected.js +++ b/test/form/samples/argument-deoptimization/no-default-deoptimization/_expected.js @@ -1,4 +1,4 @@ -const obj = { mutated: false, noEffect() {} }; +const obj = { mutated: false}; function updateObj(target) { target.mutated = true; diff --git a/test/form/samples/computed-properties/_expected/es.js b/test/form/samples/computed-properties/_expected.js similarity index 100% rename from test/form/samples/computed-properties/_expected/es.js rename to test/form/samples/computed-properties/_expected.js diff --git a/test/form/samples/computed-properties/_expected/amd.js b/test/form/samples/computed-properties/_expected/amd.js deleted file mode 100644 index 2d2e59712a8..00000000000 --- a/test/form/samples/computed-properties/_expected/amd.js +++ /dev/null @@ -1,19 +0,0 @@ -define(['exports'], (function (exports) { 'use strict'; - - var foo = 'foo'; - var bar = 'bar'; - var baz = 'baz'; - var bam = 'bam'; - - var x = { [foo]: 'bar' }; - - class X { - [bar] () {} - get [baz] () {} - set [bam] ( value ) {} - } - - exports.X = X; - exports.x = x; - -})); diff --git a/test/form/samples/computed-properties/_expected/cjs.js b/test/form/samples/computed-properties/_expected/cjs.js deleted file mode 100644 index 605d4a3e54e..00000000000 --- a/test/form/samples/computed-properties/_expected/cjs.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -var foo = 'foo'; -var bar = 'bar'; -var baz = 'baz'; -var bam = 'bam'; - -var x = { [foo]: 'bar' }; - -class X { - [bar] () {} - get [baz] () {} - set [bam] ( value ) {} -} - -exports.X = X; -exports.x = x; diff --git a/test/form/samples/computed-properties/_expected/iife.js b/test/form/samples/computed-properties/_expected/iife.js deleted file mode 100644 index 07c70d5cc19..00000000000 --- a/test/form/samples/computed-properties/_expected/iife.js +++ /dev/null @@ -1,22 +0,0 @@ -var computedProperties = (function (exports) { - 'use strict'; - - var foo = 'foo'; - var bar = 'bar'; - var baz = 'baz'; - var bam = 'bam'; - - var x = { [foo]: 'bar' }; - - class X { - [bar] () {} - get [baz] () {} - set [bam] ( value ) {} - } - - exports.X = X; - exports.x = x; - - return exports; - -})({}); diff --git a/test/form/samples/computed-properties/_expected/system.js b/test/form/samples/computed-properties/_expected/system.js deleted file mode 100644 index ec34fc724d3..00000000000 --- a/test/form/samples/computed-properties/_expected/system.js +++ /dev/null @@ -1,21 +0,0 @@ -System.register('computedProperties', [], (function (exports) { - 'use strict'; - return { - execute: (function () { - - var foo = 'foo'; - var bar = 'bar'; - var baz = 'baz'; - var bam = 'bam'; - - var x = exports("x", { [foo]: 'bar' }); - - class X { - [bar] () {} - get [baz] () {} - set [bam] ( value ) {} - } exports("X", X); - - }) - }; -})); diff --git a/test/form/samples/computed-properties/_expected/umd.js b/test/form/samples/computed-properties/_expected/umd.js deleted file mode 100644 index 44eec078c82..00000000000 --- a/test/form/samples/computed-properties/_expected/umd.js +++ /dev/null @@ -1,23 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.computedProperties = {})); -})(this, (function (exports) { 'use strict'; - - var foo = 'foo'; - var bar = 'bar'; - var baz = 'baz'; - var bam = 'bam'; - - var x = { [foo]: 'bar' }; - - class X { - [bar] () {} - get [baz] () {} - set [bam] ( value ) {} - } - - exports.X = X; - exports.x = x; - -})); diff --git a/test/form/samples/destructured-known-arguments/_config.js b/test/form/samples/destructured-known-arguments/_config.js new file mode 100644 index 00000000000..62a46d2e945 --- /dev/null +++ b/test/form/samples/destructured-known-arguments/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'tracks known argument values through destructuring' +}); diff --git a/test/form/samples/destructured-known-arguments/_expected.js b/test/form/samples/destructured-known-arguments/_expected.js new file mode 100644 index 00000000000..cfd0627c142 --- /dev/null +++ b/test/form/samples/destructured-known-arguments/_expected.js @@ -0,0 +1,28 @@ +function test1({ a, noEffect, effect }) { + console.log('OK'); + effect(); +} + +test1({ + a: true, + noEffect() {}, + effect() { + console.log('effect'); + } +}); + +function test2({ a, noEffect, effect }) { + console.log('OK'); + effect(); +} + +const obj2 = { + a: true, + noEffect() {}, + effect() { + console.log('effect'); + } +}; + +test2(obj2); +test2(obj2); diff --git a/test/form/samples/destructured-known-arguments/main.js b/test/form/samples/destructured-known-arguments/main.js new file mode 100644 index 00000000000..c4a22063cb9 --- /dev/null +++ b/test/form/samples/destructured-known-arguments/main.js @@ -0,0 +1,32 @@ +function test1({ a, noEffect, effect }) { + if (a) console.log('OK'); + else console.log('REMOVED'); + noEffect(); + effect(); +} + +test1({ + a: true, + noEffect() {}, + effect() { + console.log('effect'); + } +}); + +function test2({ a, noEffect, effect }) { + if (a) console.log('OK'); + else console.log('REMOVED'); + noEffect(); + effect(); +} + +const obj2 = { + a: true, + noEffect() {}, + effect() { + console.log('effect'); + } +}; + +test2(obj2); +test2(obj2); diff --git a/test/form/samples/early-bind-member-expressions/_expected.js b/test/form/samples/early-bind-member-expressions/_expected.js index 9fefa5dfc12..b3755754a13 100644 --- a/test/form/samples/early-bind-member-expressions/_expected.js +++ b/test/form/samples/early-bind-member-expressions/_expected.js @@ -1,3 +1,3 @@ import * as stuff from 'external'; -stuff.y(); +const {x} = stuff.y(); diff --git a/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_config.js b/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_config.js new file mode 100644 index 00000000000..2871b74fd01 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_config.js @@ -0,0 +1,4 @@ +module.exports = defineTest({ + description: 'ignores property read side effects via option', + options: { treeshake: { propertyReadSideEffects: false } } +}); diff --git a/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_expected.js b/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_expected.js new file mode 100644 index 00000000000..59b5fe8e2e5 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/_expected.js @@ -0,0 +1,4 @@ +const { a} = { + a: true}; + +console.log(a.b); diff --git a/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/main.js b/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/main.js new file mode 100644 index 00000000000..2a5bf6c92e8 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/ignore-property-read-side-effects/main.js @@ -0,0 +1,8 @@ +const { a, b } = { + a: true, + get b() { + console.log('effect'); + } +}; + +console.log(a.b); diff --git a/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_config.js b/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_config.js new file mode 100644 index 00000000000..a9129d7fb64 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'only includes destructured parameter props' +}); diff --git a/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_expected.js b/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_expected.js new file mode 100644 index 00000000000..b822667d2ff --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/_expected.js @@ -0,0 +1,7 @@ +function test({ a, d: { e } }) { + console.log(a, e); +} + +test({ + a: { b: 1, c: 2 }, + d: { e: 4}}); diff --git a/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/main.js b/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/main.js new file mode 100644 index 00000000000..d7e782dbd5a --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/only-include-destructured-parameter-props/main.js @@ -0,0 +1,9 @@ +function test({ a, d: { e } }) { + console.log(a, e); +} + +test({ + a: { b: 1, c: 2 }, + d: { e: 4, f: 5 }, + g: 6 +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_config.js b/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_config.js new file mode 100644 index 00000000000..c25c9638e99 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'removes unused nested properties through destructuring declarations' +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_expected.js b/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_expected.js new file mode 100644 index 00000000000..48ef3c76dbd --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/_expected.js @@ -0,0 +1,9 @@ +const { + a: { b } +} = { a: { b: { c: 1}}}; +console.log(b.c); + +const { + a: { ...rest } +} = { a: { b: { c: 1, d: 1 }, e: 1 }}; +console.log(rest); diff --git a/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/main.js b/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/main.js new file mode 100644 index 00000000000..be4bfe8b797 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-props-via-destructuring/main.js @@ -0,0 +1,9 @@ +const { + a: { b } +} = { a: { b: { c: 1, d: 1 }, e: 1 }, f: 1 }; +console.log(b.c); + +const { + a: { ...rest } +} = { a: { b: { c: 1, d: 1 }, e: 1 }, f: 1 }; +console.log(rest); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_config.js b/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_config.js new file mode 100644 index 00000000000..b0f0e703a50 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'removes unused nested properties' +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_expected.js b/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_expected.js new file mode 100644 index 00000000000..a87f92cf005 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/_expected.js @@ -0,0 +1,2 @@ +const obj = { y: { a: 1} }; +console.log(obj.y.a); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/main.js b/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/main.js new file mode 100644 index 00000000000..1a46a5cf649 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-nested-props/main.js @@ -0,0 +1,2 @@ +const obj = { x: 1, y: { a: 1, b: 2 } }; +console.log(obj.y.a); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_config.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_config.js new file mode 100644 index 00000000000..780dd0a5068 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_config.js @@ -0,0 +1,4 @@ +module.exports = defineTest({ + description: + 'removes props that are not used in a function when part of the parameter is passed to an external function' +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_expected.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_expected.js new file mode 100644 index 00000000000..7e3e405c4ad --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/_expected.js @@ -0,0 +1,6 @@ +function test(obj) { + externalFunc(obj.a); +} + +test({ + a: { b: 1, c: 2 }}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/main.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/main.js new file mode 100644 index 00000000000..4f29aed21b4 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props-external-call/main.js @@ -0,0 +1,8 @@ +function test(obj) { + externalFunc(obj.a); +} + +test({ + a: { b: 1, c: 2 }, + d: { e: 4, f: 5 } +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_config.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_config.js new file mode 100644 index 00000000000..8a144734955 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'removes props that are not used in a function' +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js new file mode 100644 index 00000000000..ed6b0d51236 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js @@ -0,0 +1,18 @@ +function test1(obj) { + return [obj.a, obj.d.e]; +} + +console.log( + test1({ + a: { b: 1, c: 2 }, + d: { e: 4}}) +); + +function test2(obj) { + console.log(obj.a); + console.log(obj.d.e); +} + +test2({ + a: { b: 1, c: 2 }, + d: { e: 4}}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/main.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/main.js new file mode 100644 index 00000000000..3c381fe9637 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/main.js @@ -0,0 +1,22 @@ +function test1(obj) { + return [obj.a, obj.d.e]; +} + +console.log( + test1({ + a: { b: 1, c: 2 }, + d: { e: 4, f: 5 }, + g: 6 + }) +); + +function test2(obj) { + console.log(obj.a); + console.log(obj.d.e); +} + +test2({ + a: { b: 1, c: 2 }, + d: { e: 4, f: 5 }, + g: 6 +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-props/_config.js b/test/form/samples/object-expression-treeshaking/remove-unused-props/_config.js new file mode 100644 index 00000000000..efeec207d65 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-props/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'removes unused object properties' +}); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-props/_expected.js b/test/form/samples/object-expression-treeshaking/remove-unused-props/_expected.js new file mode 100644 index 00000000000..f730158871d --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-props/_expected.js @@ -0,0 +1,5 @@ +const obj1 = { x: 1}; +const obj2 = { y: { a: 1, b: 2 } }; +const obj3 = { y: { a: 1} }; +const obj4 = { }; +console.log(obj1.x, obj2.y, obj3.y.a, obj4.z); diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-props/main.js b/test/form/samples/object-expression-treeshaking/remove-unused-props/main.js new file mode 100644 index 00000000000..3b2940aaa76 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/remove-unused-props/main.js @@ -0,0 +1,5 @@ +const obj1 = { x: 1, y: { a: 1, b: 2 } }; +const obj2 = { x: 1, y: { a: 1, b: 2 } }; +const obj3 = { x: 1, y: { a: 1, b: 2 } }; +const obj4 = { x: 1, y: { a: 1, b: 2 } }; +console.log(obj1.x, obj2.y, obj3.y.a, obj4.z); diff --git a/test/form/samples/object-literal-property-overwrites/_expected.js b/test/form/samples/object-literal-property-overwrites/_expected.js index ecd783e1d52..0d2ad4b1dcd 100644 --- a/test/form/samples/object-literal-property-overwrites/_expected.js +++ b/test/form/samples/object-literal-property-overwrites/_expected.js @@ -18,20 +18,14 @@ const retained3 = { retained3.bar(); const retained4 = { - foo: {}, foo: globalThis.unknown }; retained4.foo.bar = 1; const retained5 = { - foo: {}, - ['f' + 'oo']: globalThis.unknown, - ['b' + 'ar']: {}, -}; + ['f' + 'oo']: globalThis.unknown}; retained5.foo.bar = 1; const retained6 = { - ['fo' + 'o']: {}, - ['f' + 'oo']: {} -}; + }; retained6.bar.baz = 1; diff --git a/test/form/samples/optional-chaining-namespace/_expected.js b/test/form/samples/optional-chaining-namespace/_expected.js index fcffb6f8f18..3a638fc2eee 100644 --- a/test/form/samples/optional-chaining-namespace/_expected.js +++ b/test/form/samples/optional-chaining-namespace/_expected.js @@ -1,4 +1,4 @@ -const foo = { nullVal: null }; +const foo = { }; foo?.x.x; // retained diff --git a/test/form/samples/recursive-destructuring/_config.js b/test/form/samples/recursive-destructuring/_config.js new file mode 100644 index 00000000000..36b2eac7831 --- /dev/null +++ b/test/form/samples/recursive-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'does not fail for recursive variables declarations with destructuring' +}); diff --git a/test/form/samples/recursive-destructuring/_expected.js b/test/form/samples/recursive-destructuring/_expected.js new file mode 100644 index 00000000000..5e79f768e81 --- /dev/null +++ b/test/form/samples/recursive-destructuring/_expected.js @@ -0,0 +1 @@ +var { x } = x; // retained as this should throw diff --git a/test/form/samples/recursive-destructuring/main.js b/test/form/samples/recursive-destructuring/main.js new file mode 100644 index 00000000000..5e79f768e81 --- /dev/null +++ b/test/form/samples/recursive-destructuring/main.js @@ -0,0 +1 @@ +var { x } = x; // retained as this should throw diff --git a/test/form/samples/side-effects-getters-and-setters/_expected.js b/test/form/samples/side-effects-getters-and-setters/_expected.js index 31917077c8e..b7214fb1d1b 100644 --- a/test/form/samples/side-effects-getters-and-setters/_expected.js +++ b/test/form/samples/side-effects-getters-and-setters/_expected.js @@ -1,12 +1,7 @@ const retained1 = { get effect() { console.log('effect'); - }, - get noEffect() { - const x = 1; - return x; - } -}; + }}; //retained retained1.effect; diff --git a/test/form/samples/side-effects-logical-expressions/_expected/amd.js b/test/form/samples/side-effects-logical-expressions/_expected/amd.js index 5cd0363fae8..fc94706a8e8 100644 --- a/test/form/samples/side-effects-logical-expressions/_expected/amd.js +++ b/test/form/samples/side-effects-logical-expressions/_expected/amd.js @@ -9,9 +9,7 @@ define((function () { 'use strict'; const foo = { get effect () { console.log( 'effect' ); - }, - get noEffect () {} - }; + }}; // effect (foo).effect; diff --git a/test/form/samples/side-effects-logical-expressions/_expected/cjs.js b/test/form/samples/side-effects-logical-expressions/_expected/cjs.js index 2efd87aac35..a607ca44b57 100644 --- a/test/form/samples/side-effects-logical-expressions/_expected/cjs.js +++ b/test/form/samples/side-effects-logical-expressions/_expected/cjs.js @@ -9,9 +9,7 @@ console.log( 'effect' ) && {}; const foo = { get effect () { console.log( 'effect' ); - }, - get noEffect () {} -}; + }}; // effect (foo).effect; diff --git a/test/form/samples/side-effects-logical-expressions/_expected/es.js b/test/form/samples/side-effects-logical-expressions/_expected/es.js index 0814df63c9b..cb958dd289e 100644 --- a/test/form/samples/side-effects-logical-expressions/_expected/es.js +++ b/test/form/samples/side-effects-logical-expressions/_expected/es.js @@ -7,9 +7,7 @@ console.log( 'effect' ) && {}; const foo = { get effect () { console.log( 'effect' ); - }, - get noEffect () {} -}; + }}; // effect (foo).effect; diff --git a/test/form/samples/side-effects-logical-expressions/_expected/iife.js b/test/form/samples/side-effects-logical-expressions/_expected/iife.js index fb4bea51ada..173c1f306a7 100644 --- a/test/form/samples/side-effects-logical-expressions/_expected/iife.js +++ b/test/form/samples/side-effects-logical-expressions/_expected/iife.js @@ -10,9 +10,7 @@ const foo = { get effect () { console.log( 'effect' ); - }, - get noEffect () {} - }; + }}; // effect (foo).effect; diff --git a/test/form/samples/side-effects-logical-expressions/_expected/system.js b/test/form/samples/side-effects-logical-expressions/_expected/system.js index 8853d5df60d..c4b22d8ac26 100644 --- a/test/form/samples/side-effects-logical-expressions/_expected/system.js +++ b/test/form/samples/side-effects-logical-expressions/_expected/system.js @@ -12,9 +12,7 @@ System.register([], (function () { const foo = { get effect () { console.log( 'effect' ); - }, - get noEffect () {} - }; + }}; // effect (foo).effect; diff --git a/test/form/samples/side-effects-logical-expressions/_expected/umd.js b/test/form/samples/side-effects-logical-expressions/_expected/umd.js index 6ff0de93718..b9ceed374ce 100644 --- a/test/form/samples/side-effects-logical-expressions/_expected/umd.js +++ b/test/form/samples/side-effects-logical-expressions/_expected/umd.js @@ -12,9 +12,7 @@ const foo = { get effect () { console.log( 'effect' ); - }, - get noEffect () {} - }; + }}; // effect (foo).effect; diff --git a/test/form/samples/side-effects-object-literal-mutation/_expected.js b/test/form/samples/side-effects-object-literal-mutation/_expected.js index f42a72e8a66..f2e8bbcc06f 100644 --- a/test/form/samples/side-effects-object-literal-mutation/_expected.js +++ b/test/form/samples/side-effects-object-literal-mutation/_expected.js @@ -2,7 +2,7 @@ const retained1 = { x: {} }; retained1.y = 1; retained1.x.y = 2; -const retained2 = { x: {} }; +const retained2 = { }; retained2.y.z = 1; const retained3 = { x: {} }; diff --git a/test/form/samples/side-effects-pattern-assignment/_expected.js b/test/form/samples/side-effects-pattern-assignment/_expected.js index 16c6cefd9c2..a86b215304b 100644 --- a/test/form/samples/side-effects-pattern-assignment/_expected.js +++ b/test/form/samples/side-effects-pattern-assignment/_expected.js @@ -1,3 +1,13 @@ +var a = {}; +({x: a} = globalThis.unknown); + +var b = {}; +({b} = globalThis.unknown); + +var {x: c} = globalThis.unknown; + +var {d} = globalThis.unknown; + var e = {}; ({x: e} = globalThis.unknown); e.foo = 1; @@ -12,6 +22,16 @@ g.foo = 1; var {h} = globalThis.unknown; h.foo = 1; +var i = {}; +[i] = globalThis.unknown; + +var [j] = globalThis.unknown; + +var k = {}; +[,...k] = globalThis.unknown; + +var [,...l] = globalThis.unknown; + var m = {}; [m] = globalThis.unknown; m.foo = 1; diff --git a/test/form/samples/system-export-declarations/_expected.js b/test/form/samples/system-export-declarations/_expected.js index 81f189c9737..80e548b6c64 100644 --- a/test/form/samples/system-export-declarations/_expected.js +++ b/test/form/samples/system-export-declarations/_expected.js @@ -23,7 +23,7 @@ System.register([], (function (exports) { console.log(e1, e2, e3); // destructuring declaration - let {f1, f2} = globalThis.obj; exports("f2", f2); + let {f1, f2} = globalThis.obj, {f3} = globalThis.obj; exports("f2", f2); }) }; diff --git a/test/form/samples/treeshake-deterministic-dynamic-import/_expected.js b/test/form/samples/treeshake-deterministic-dynamic-import/_expected.js index 8a69e51d073..c7115bf3b8b 100644 --- a/test/form/samples/treeshake-deterministic-dynamic-import/_expected.js +++ b/test/form/samples/treeshake-deterministic-dynamic-import/_expected.js @@ -18,15 +18,15 @@ function _mergeNamespaces(n, m) { async function entry() { // simple const { foo1: foo } = await Promise.resolve().then(function () { return sub1; }); - await Promise.resolve().then(function () { return sub1; }); + const { doesNotExists } = await Promise.resolve().then(function () { return sub1; }); (await Promise.resolve().then(function () { return sub2; })).bar2(); - await Promise.resolve().then(function () { return sub2; }); - await Promise.resolve().then(function () { return sub2; }); + const { foo2 } = await Promise.resolve().then(function () { return sub2; }); + const { foo3 } = await Promise.resolve().then(function () { return sub2; }); Promise.resolve().then(function () { return sub2; }).then(({ baz2 }) => baz2); Promise.resolve().then(function () { return sub2; }).then(function({ reexported }) { }); // external with unknown namespace - await Promise.resolve().then(function () { return sub4; }); + const { foo4, x } = await Promise.resolve().then(function () { return sub4; }); // side-effect only Promise.resolve().then(function () { return effect1; }); @@ -37,10 +37,10 @@ async function entry() { Promise.resolve().then(function () { return effect6; }).finally(() => {}); // bail out - await Promise.resolve().then(function () { return bail1$1; }); + const { named1 } = await Promise.resolve().then(function () { return bail1$1; }); Promise.resolve().then(function () { return bail1$1; }); // this make it bail out - await Promise.resolve().then(function () { return bail2$1; }) + const { ...named2 } = await Promise.resolve().then(function () { return bail2$1; }) (await Promise.resolve().then(function () { return bail3$1; }))[foo]; @@ -55,9 +55,13 @@ async function entry() { Promise.resolve().then(function () { return bail8$1; }), ]; - await Promise.resolve().then(function () { return bail9$1; }); + const { [foo]: bar } = await Promise.resolve().then(function () { return bail9$1; }); Promise.resolve().then(function () { return bail10$1; }).then(({ [foo]: bar }) => {}); + + { + const [name11] = await Promise.resolve().then(function () { return bail11$1; }); + } } function foo1() { @@ -236,4 +240,13 @@ var bail10$1 = /*#__PURE__*/Object.freeze({ named10: named10 }); +var bail11 = '@included-bail-11'; +const named11 = 'bail11'; + +var bail11$1 = /*#__PURE__*/Object.freeze({ + __proto__: null, + default: bail11, + named11: named11 +}); + export { entry }; diff --git a/test/form/samples/treeshake-deterministic-dynamic-import/main.js b/test/form/samples/treeshake-deterministic-dynamic-import/main.js index 48bd026a602..45bdcf41dec 100644 --- a/test/form/samples/treeshake-deterministic-dynamic-import/main.js +++ b/test/form/samples/treeshake-deterministic-dynamic-import/main.js @@ -43,4 +43,8 @@ export async function entry() { const { [foo]: bar } = await import('./bail-9.js') import('./bail-10.js').then(({ [foo]: bar }) => {}) + + { + const [name11] = await import('./bail-11.js'); + } } diff --git a/test/function/samples/deoptimize-nested-function-arg/_config.js b/test/function/samples/deoptimize-nested-function-arg/_config.js new file mode 100644 index 00000000000..c35dc775cb0 --- /dev/null +++ b/test/function/samples/deoptimize-nested-function-arg/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'deoptimizes call arguments to functions nested in function properties' +}); diff --git a/test/function/samples/deoptimize-nested-function-arg/main.js b/test/function/samples/deoptimize-nested-function-arg/main.js new file mode 100644 index 00000000000..ce66ae7454b --- /dev/null +++ b/test/function/samples/deoptimize-nested-function-arg/main.js @@ -0,0 +1,8 @@ +function test() {} + +test.mutate = a => (a.mutated = true); + +const obj = { mutated: false }; +test.mutate(obj); + +assert.strictEqual(obj.mutated ? 'OK' : 'FAIL', 'OK'); diff --git a/test/function/samples/deoptimize-via-arguments/main.js b/test/function/samples/deoptimize-via-arguments/main.js index 1b9072bb086..9bebcde6842 100644 --- a/test/function/samples/deoptimize-via-arguments/main.js +++ b/test/function/samples/deoptimize-via-arguments/main.js @@ -13,5 +13,5 @@ var obj2 = { mutate(obj1, obj2); -assert.ok(obj1.x ? true : false); -assert.ok(obj2.x ? true : false); +assert.ok(obj1.x ? true : false, 'obj1'); +assert.ok(obj2.x ? true : false, 'obj2'); diff --git a/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/_config.js b/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/_config.js new file mode 100644 index 00000000000..575f09159d4 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'makes sure to deconflict variables that are destructured for side effects only' +}); diff --git a/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/dep.js b/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/dep.js new file mode 100644 index 00000000000..9bcefbb3169 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/dep.js @@ -0,0 +1,2 @@ +const Foo = { ok: true }; +export { Foo as default }; diff --git a/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/main.js b/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/main.js new file mode 100644 index 00000000000..29c4a2fc5a3 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deconflict-destructured-for-side-effects/main.js @@ -0,0 +1,9 @@ +import bar from './dep.js'; +let mutated = false; +const { Foo } = { + get Foo() { + mutated = true; + } +}; +assert.ok(mutated); +assert.deepStrictEqual(bar, { ok: true }); diff --git a/test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/_config.js b/test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/_config.js new file mode 100644 index 00000000000..44ddb5912a5 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'deoptimizes arguments of calls to destructured functions' +}); diff --git a/test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/main.js b/test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/main.js new file mode 100644 index 00000000000..95a2287a859 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deoptimize-arguments-via-destructuring/main.js @@ -0,0 +1,13 @@ +var { a } = { + a: { + b(x) { + x.mutated = true; + } + }, + b() {} +}; + +var obj = { mutated: false }; +a.b(obj); + +assert.strictEqual(obj.mutated ? 'OK' : 'FAILED', 'OK'); diff --git a/test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/_config.js b/test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/_config.js new file mode 100644 index 00000000000..d7e2cced939 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'deoptimizes the object if a mutating getter is destructured' +}); diff --git a/test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/main.js b/test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/main.js new file mode 100644 index 00000000000..60b29d3d52c --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deoptimize-object-via-destructured-getter/main.js @@ -0,0 +1,9 @@ +const { a, b } = { + get a() { + // We cannot remove a as destructuring will trigger this getter + this.b = true; + }, + b: false +}; + +assert.strictEqual(b ? 'OK' : 'FAILED', 'OK'); diff --git a/test/function/samples/object-expression-treeshaking/do-not-destructure-unused/_config.js b/test/function/samples/object-expression-treeshaking/do-not-destructure-unused/_config.js new file mode 100644 index 00000000000..3941223261b --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/do-not-destructure-unused/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'ensures that unused properties that are potentially removed are not destructure' +}); diff --git a/test/function/samples/object-expression-treeshaking/do-not-destructure-unused/main.js b/test/function/samples/object-expression-treeshaking/do-not-destructure-unused/main.js new file mode 100644 index 00000000000..8ccfd46e627 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/do-not-destructure-unused/main.js @@ -0,0 +1,17 @@ +const { + x: { + y: { z } + }, + a +} = { x: { y: { z: true } }, a: true }; +assert.ok(a); + +function test({ + x: { + y: { z } + }, + a +}) { + return a; +} +assert.ok(test({ x: { y: { z: true } }, a: true })); diff --git a/test/function/samples/object-expression-treeshaking/exports/_config.js b/test/function/samples/object-expression-treeshaking/exports/_config.js new file mode 100644 index 00000000000..9c660cbb7cf --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/exports/_config.js @@ -0,0 +1,13 @@ +const assert = require('node:assert'); + +module.exports = defineTest({ + description: 'includes all paths of exported objects', + exports(exports) { + assert.deepStrictEqual(exports, { + foo: { + a: 1, + b: { c: 2 } + } + }); + } +}); diff --git a/test/function/samples/object-expression-treeshaking/exports/main.js b/test/function/samples/object-expression-treeshaking/exports/main.js new file mode 100644 index 00000000000..f905aa8f9c7 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/exports/main.js @@ -0,0 +1,4 @@ +export const foo = { + a: 1, + b: { c: 2 } +}; diff --git a/test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/_config.js b/test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/_config.js new file mode 100644 index 00000000000..283d1dc5789 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'retrieves literal values from destructured variables' +}); diff --git a/test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/main.js b/test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/main.js new file mode 100644 index 00000000000..fea5611f917 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/get-literal-value-via-destructuring/main.js @@ -0,0 +1,6 @@ +var { a } = { + a: { b: true }, + b: false +}; + +assert.strictEqual(a.b ? 'OK' : 'FAILED', 'OK'); diff --git a/test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/_config.js b/test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/_config.js new file mode 100644 index 00000000000..573a3cd4559 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'retrieves return expressions from destructured variables' +}); diff --git a/test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/main.js b/test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/main.js new file mode 100644 index 00000000000..0f800d0832c --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/get-return-expression-via-destructuring/main.js @@ -0,0 +1,6 @@ +var { a } = { + a: { b: () => true }, + b: () => false +}; + +assert.strictEqual(a.b() ? 'OK' : 'FAILED', 'OK'); diff --git a/test/function/samples/object-expression-treeshaking/include-call-arguments-path/_config.js b/test/function/samples/object-expression-treeshaking/include-call-arguments-path/_config.js new file mode 100644 index 00000000000..3021ca7249f --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-call-arguments-path/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'uses the correct path when including call arguments' +}); diff --git a/test/function/samples/object-expression-treeshaking/include-call-arguments-path/main.js b/test/function/samples/object-expression-treeshaking/include-call-arguments-path/main.js new file mode 100644 index 00000000000..57709cc1a58 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-call-arguments-path/main.js @@ -0,0 +1,9 @@ +let result = null; + +function test() {} +test.a = value => (result = value); + +const { a } = test; +a(1); + +assert.strictEqual(result, 1); diff --git a/test/function/samples/object-expression-treeshaking/include-destructuring-rest/_config.js b/test/function/samples/object-expression-treeshaking/include-destructuring-rest/_config.js new file mode 100644 index 00000000000..a3e2d8dd3a7 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-destructuring-rest/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'includes rest properties in destructuring declarations' +}); diff --git a/test/function/samples/object-expression-treeshaking/include-destructuring-rest/main.js b/test/function/samples/object-expression-treeshaking/include-destructuring-rest/main.js new file mode 100644 index 00000000000..1909f73bbfc --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-destructuring-rest/main.js @@ -0,0 +1,15 @@ +const { + a: { e: e1, ...rest1 } +} = { a: { b: { c: 1, d: 1 }, e: 1 }, f: 1 }; +assert.deepStrictEqual(rest1, { b: { c: 1, d: 1 } }); + +const { ...rest2 } = { a: { b: { c: 1, d: 1 }, e: 1 }, f: 1 }; +assert.deepStrictEqual(rest2, { a: { b: { c: 1, d: 1 }, e: 1 }, f: 1 }); + +const { + a: { e: e3, ...rest3 }, + f +} = { a: { b: { c: 1, d: 1 }, e: 1 }, f: 1 }; +assert.strictEqual(e3, 1); +assert.strictEqual(f, 1); +assert.deepStrictEqual(rest3, { b: { c: 1, d: 1 } }); diff --git a/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/_config.js b/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/_config.js new file mode 100644 index 00000000000..8b1109d88ce --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/_config.js @@ -0,0 +1,6 @@ +module.exports = defineTest({ + description: 'includes used dynamic import properties with await', + async exports({ assertImport }) { + await assertImport(); + } +}); diff --git a/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/dep.js b/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/dep.js new file mode 100644 index 00000000000..5fb7ac5654a --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/dep.js @@ -0,0 +1 @@ +export const foo = { bar: { baz: 42 } }; diff --git a/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/main.js b/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/main.js new file mode 100644 index 00000000000..089c744b120 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-dynamic-import-properties-await/main.js @@ -0,0 +1,4 @@ +export async function assertImport() { + const { foo } = await import('./dep.js'); + assert.strictEqual(foo.bar.baz, 42); +} diff --git a/test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/_config.js b/test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/_config.js new file mode 100644 index 00000000000..6fde0ab6695 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'includes redeclared destructured variable paths' +}); diff --git a/test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/main.js b/test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/main.js new file mode 100644 index 00000000000..7959bf5e3d5 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-redeclared-destructured-variable-paths/main.js @@ -0,0 +1,5 @@ +var { a } = { a: { b: 1 } }; +assert.strictEqual(a.b, 1); + +var { a } = { a: { b: 2 } }; +assert.strictEqual(a.b, 2); diff --git a/test/function/samples/object-expression-treeshaking/include-this-unknown-function/_config.js b/test/function/samples/object-expression-treeshaking/include-this-unknown-function/_config.js new file mode 100644 index 00000000000..5d6a6ecac63 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-this-unknown-function/_config.js @@ -0,0 +1,8 @@ +module.exports = defineTest({ + description: 'includes all context properties if the handler is unknown', + context: { + external() { + this.bar(); + } + } +}); diff --git a/test/function/samples/object-expression-treeshaking/include-this-unknown-function/main.js b/test/function/samples/object-expression-treeshaking/include-this-unknown-function/main.js new file mode 100644 index 00000000000..f25e812abbb --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-this-unknown-function/main.js @@ -0,0 +1,11 @@ +let mutated = false; + +const obj = { + foo: external, + bar() { + mutated = true; + } +}; + +obj.foo(); +assert.ok(mutated ? true : false); diff --git a/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/_config.js b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/_config.js new file mode 100644 index 00000000000..7669a3d47a6 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'destructures unused properties with getter side effects in assignments' +}); diff --git a/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/main.js b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/main.js new file mode 100644 index 00000000000..3049bcb524f --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-assignment/main.js @@ -0,0 +1,36 @@ +const effects1 = []; +let x1; +({ x1 } = { + get x1() { + effects1.push('x1'); + }, + get y1() { + effects1.push('y1'); + } +}); +assert.deepStrictEqual(effects1, ['x1'], 'effects1'); + +const effects2 = []; +let y2; +({ + x2: { y2 } +} = { + x2: { + get y2() { + effects2.push('y2'); + } + } +}); +assert.deepStrictEqual(effects2, ['y2'], 'effects2'); + +const effects3 = []; +let x3, rest3; +({ x3, ...rest3 } = { + get x3() { + effects3.push('x3'); + }, + get y3() { + effects3.push('y3'); + } +}); +assert.deepStrictEqual(effects3, ['x3', 'y3'], 'effects3'); diff --git a/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/_config.js b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/_config.js new file mode 100644 index 00000000000..7368c76c36c --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'destructures unused properties with getter side effects in calls' +}); diff --git a/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/main.js b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/main.js new file mode 100644 index 00000000000..8597d0263ac --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters-in-calls/main.js @@ -0,0 +1,34 @@ +const effects1 = []; +function test1({ x1 }) {} +test1({ + get x1() { + effects1.push('x1'); + }, + get y1() { + effects1.push('y1'); + } +}); +assert.deepStrictEqual(effects1, ['x1'], 'effects1'); + +const effects2 = []; +function test2({ x2: { y2 } }) {} +test2({ + x2: { + get y2() { + effects2.push('y2'); + } + } +}); +assert.deepStrictEqual(effects2, ['y2'], 'effects2'); + +const effects3 = []; +function test3( { x3, ...rest3 }){} +test3({ + get x3() { + effects3.push('x3'); + }, + get y3() { + effects3.push('y3'); + } +}); +assert.deepStrictEqual(effects3, ['x3', 'y3'], 'effects3'); diff --git a/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/_config.js b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/_config.js new file mode 100644 index 00000000000..1f855971b6e --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'destructures unused properties with getter side effects' +}); diff --git a/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/main.js b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/main.js new file mode 100644 index 00000000000..9750d2228be --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/include-unused-destructured-getters/main.js @@ -0,0 +1,33 @@ +const effects1 = []; +const { x1 } = { + get x1() { + effects1.push('x1'); + }, + get y1() { + effects1.push('y1'); + } +}; +assert.deepStrictEqual(effects1, ['x1'], 'effects1'); + +const effects2 = []; +const { + x2: { y2 } +} = { + x2: { + get y2() { + effects2.push('y2'); + } + } +}; +assert.deepStrictEqual(effects2, ['y2'], 'effects2'); + +const effects3 = []; +const { x3, ...rest3 } = { + get x3() { + effects3.push('x3'); + }, + get y3() { + effects3.push('y3'); + } +}; +assert.deepStrictEqual(effects3, ['x3', 'y3'], 'effects3'); diff --git a/test/function/samples/object-expression-treeshaking/object-side-effects/_config.js b/test/function/samples/object-expression-treeshaking/object-side-effects/_config.js new file mode 100644 index 00000000000..dfb161d6ea9 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/object-side-effects/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'considers side effects in unused property declarations' +}); diff --git a/test/function/samples/object-expression-treeshaking/object-side-effects/main.js b/test/function/samples/object-expression-treeshaking/object-side-effects/main.js new file mode 100644 index 00000000000..d32c4546ae0 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/object-side-effects/main.js @@ -0,0 +1,22 @@ +let modified1 = false; +let modified2 = false; + +function effect1() { + modified1 = true; + return 'keyEffect'; +} + +function effect2() { + modified2 = true; + return 4; +} + +const obj = { + used: 1, + unused: 2, + [effect1()]: 3, + valueEffect: effect2() +}; +assert.strictEqual(obj.used, 1); +assert.ok(modified1, 'first'); +assert.ok(modified2, 'second'); diff --git a/test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/_config.js b/test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/_config.js new file mode 100644 index 00000000000..07cdb40b85d --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'tracks property access side effects for destructured variables' +}); diff --git a/test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/main.js b/test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/main.js new file mode 100644 index 00000000000..eff4d312437 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-access-side-effect-via-destructuring/main.js @@ -0,0 +1,14 @@ +let mutated = false; + +var { a } = { + a: { + get b() { + mutated = true; + return {}; + } + }, + b: {} +}; + +a.b; +assert.ok(mutated); diff --git a/test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/_config.js b/test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/_config.js new file mode 100644 index 00000000000..5f3148007a8 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'tracks property assignment side effects for destructured variables' +}); diff --git a/test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/main.js b/test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/main.js new file mode 100644 index 00000000000..1fae330532d --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-assignment-side-effect-via-destructuring/main.js @@ -0,0 +1,13 @@ +let mutated = false; + +var { a } = { + a: { + set b(value) { + mutated = value; + } + }, + b: {} +}; + +a.b = true; +assert.ok(mutated); diff --git a/test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/_config.js b/test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/_config.js new file mode 100644 index 00000000000..993182b7771 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'tracks call side effects for destructured variables' +}); diff --git a/test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/main.js b/test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/main.js new file mode 100644 index 00000000000..09711eded56 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-call-side-effect-via-destructuring/main.js @@ -0,0 +1,13 @@ +let mutated = false; + +var { a } = { + a: { + b() { + mutated = true; + } + }, + b() {} +}; + +a.b(); +assert.ok(mutated); diff --git a/test/function/samples/object-expression-treeshaking/track-destructured-setter/_config.js b/test/function/samples/object-expression-treeshaking/track-destructured-setter/_config.js new file mode 100644 index 00000000000..6268facf730 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-destructured-setter/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'tracks side effects from setters in destructuring assignments' +}); diff --git a/test/function/samples/object-expression-treeshaking/track-destructured-setter/main.js b/test/function/samples/object-expression-treeshaking/track-destructured-setter/main.js new file mode 100644 index 00000000000..58d231674a4 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/track-destructured-setter/main.js @@ -0,0 +1,8 @@ +let effect = false; +const obj = { + set foo(value) { + effect = value; + } +}; +({ foo: obj.foo } = { foo: 'value' }); +assert.strictEqual(effect, 'value'); diff --git a/test/function/samples/object-tree-shaking-for-global-assignment/_config.js b/test/function/samples/object-tree-shaking-for-global-assignment/_config.js new file mode 100644 index 00000000000..342682dfe8b --- /dev/null +++ b/test/function/samples/object-tree-shaking-for-global-assignment/_config.js @@ -0,0 +1,6 @@ +module.exports = defineTest({ + description: 'preserve the object on the right side of the global assignment', + context: { + b: {} + } +}); diff --git a/test/function/samples/object-tree-shaking-for-global-assignment/main.js b/test/function/samples/object-tree-shaking-for-global-assignment/main.js new file mode 100644 index 00000000000..2b3e70c2b8c --- /dev/null +++ b/test/function/samples/object-tree-shaking-for-global-assignment/main.js @@ -0,0 +1,6 @@ +function foo() { + const a = (b.c = { e: 1 }); +} +foo(); + +assert.deepEqual(b.c.e, 1); diff --git a/test/function/samples/object-tree-shaking-for-parameter/_config.js b/test/function/samples/object-tree-shaking-for-parameter/_config.js new file mode 100644 index 00000000000..78d27f62591 --- /dev/null +++ b/test/function/samples/object-tree-shaking-for-parameter/_config.js @@ -0,0 +1,8 @@ +module.exports = defineTest({ + description: 'preserve the object argument', + context: { + externalFunc(input) { + return input; + } + } +}); diff --git a/test/function/samples/object-tree-shaking-for-parameter/main.js b/test/function/samples/object-tree-shaking-for-parameter/main.js new file mode 100644 index 00000000000..0d18beb5448 --- /dev/null +++ b/test/function/samples/object-tree-shaking-for-parameter/main.js @@ -0,0 +1,15 @@ +function foo() { + function bar(input2) { + return input2; + } + + function Baz(input) { + this.value = bar(input); + } + + externalFunc(Baz); + + return new Baz({ next: 2 }); +} + +assert.deepEqual(foo().value.next, 2); diff --git a/test/function/samples/object-tree-shaking-in-function-self-call/_config.js b/test/function/samples/object-tree-shaking-in-function-self-call/_config.js new file mode 100644 index 00000000000..0148514e678 --- /dev/null +++ b/test/function/samples/object-tree-shaking-in-function-self-call/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'avoid maximum call stack size exceeded' +}); diff --git a/test/function/samples/object-tree-shaking-in-function-self-call/main.js b/test/function/samples/object-tree-shaking-in-function-self-call/main.js new file mode 100644 index 00000000000..bb5d1b01343 --- /dev/null +++ b/test/function/samples/object-tree-shaking-in-function-self-call/main.js @@ -0,0 +1,7 @@ +function foo(v) { + if (v.a) { + foo(v.b); + foo(v.c); + } +} +foo({ b: 1 }); diff --git a/test/function/samples/object-tree-shaking-with-destructed-export/_config.js b/test/function/samples/object-tree-shaking-with-destructed-export/_config.js new file mode 100644 index 00000000000..7fc0d9a3537 --- /dev/null +++ b/test/function/samples/object-tree-shaking-with-destructed-export/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'export the full object which in the ObjectPattern' +}); diff --git a/test/function/samples/object-tree-shaking-with-destructed-export/main.js b/test/function/samples/object-tree-shaking-with-destructed-export/main.js new file mode 100644 index 00000000000..7d821e50caa --- /dev/null +++ b/test/function/samples/object-tree-shaking-with-destructed-export/main.js @@ -0,0 +1,3 @@ +import { bar } from './module'; + +assert(bar.baz, 1); diff --git a/test/function/samples/object-tree-shaking-with-destructed-export/module.js b/test/function/samples/object-tree-shaking-with-destructed-export/module.js new file mode 100644 index 00000000000..b60c753a2ec --- /dev/null +++ b/test/function/samples/object-tree-shaking-with-destructed-export/module.js @@ -0,0 +1,2 @@ +const foo = { bar: { baz: 1 } }; +export const { bar } = foo; diff --git a/test/function/samples/object-tree-shaking-with-duplicated-function-call/_config.js b/test/function/samples/object-tree-shaking-with-duplicated-function-call/_config.js new file mode 100644 index 00000000000..19f844a1eb7 --- /dev/null +++ b/test/function/samples/object-tree-shaking-with-duplicated-function-call/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'get the full object which as a parameter passed to duplicated function call' +}); diff --git a/test/function/samples/object-tree-shaking-with-duplicated-function-call/main.js b/test/function/samples/object-tree-shaking-with-duplicated-function-call/main.js new file mode 100644 index 00000000000..4a920f168ec --- /dev/null +++ b/test/function/samples/object-tree-shaking-with-duplicated-function-call/main.js @@ -0,0 +1,6 @@ +function foo(c) { + assert.ok(c.a); +} + +foo({ a: 1 }); +foo({ a: 1 }); diff --git a/test/function/samples/preserve-exported-object-in-namespace/_config.js b/test/function/samples/preserve-exported-object-in-namespace/_config.js new file mode 100644 index 00000000000..c87382ae0d4 --- /dev/null +++ b/test/function/samples/preserve-exported-object-in-namespace/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'preserve the exported object that imported by namespace' +}); diff --git a/test/function/samples/preserve-exported-object-in-namespace/main.js b/test/function/samples/preserve-exported-object-in-namespace/main.js new file mode 100644 index 00000000000..5963870279a --- /dev/null +++ b/test/function/samples/preserve-exported-object-in-namespace/main.js @@ -0,0 +1,2 @@ +import * as module from './module'; +assert.deepEqual(module.foo.bar, 1); diff --git a/test/function/samples/preserve-exported-object-in-namespace/module.js b/test/function/samples/preserve-exported-object-in-namespace/module.js new file mode 100644 index 00000000000..1399af4bb52 --- /dev/null +++ b/test/function/samples/preserve-exported-object-in-namespace/module.js @@ -0,0 +1 @@ +export const foo = { bar: 1 }; diff --git a/test/function/samples/preserve-var-declaration/_config.js b/test/function/samples/preserve-var-declaration/_config.js new file mode 100644 index 00000000000..5281c9eb6a5 --- /dev/null +++ b/test/function/samples/preserve-var-declaration/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'preserve the variableDeclaration that declared by var' +}); diff --git a/test/function/samples/preserve-var-declaration/main.js b/test/function/samples/preserve-var-declaration/main.js new file mode 100644 index 00000000000..92df84abc14 --- /dev/null +++ b/test/function/samples/preserve-var-declaration/main.js @@ -0,0 +1,5 @@ +{ + var a = { c: 1 }; + var b = { a }; + assert.deepEqual(b.a.c, 1); +} diff --git a/test/function/samples/recursive-calls-without-treeshake/_config.js b/test/function/samples/recursive-calls-without-treeshake/_config.js new file mode 100644 index 00000000000..9e859a0ff87 --- /dev/null +++ b/test/function/samples/recursive-calls-without-treeshake/_config.js @@ -0,0 +1,6 @@ +module.exports = defineTest({ + description: 'Avoid maximum call stack error with recursive calls when treeshake is disabled', + options: { + treeshake: false + } +}); diff --git a/test/function/samples/recursive-calls-without-treeshake/main.js b/test/function/samples/recursive-calls-without-treeshake/main.js new file mode 100644 index 00000000000..df7cfe3f7fc --- /dev/null +++ b/test/function/samples/recursive-calls-without-treeshake/main.js @@ -0,0 +1,10 @@ +function test(callback, index) { + if (index > 0) { + test(callback, index - 1); + } + callback(); +} + +let count = 0; +test(() => count++, 3); +assert.strictEqual(count, 4); diff --git a/test/function/samples/wrap-empty-object-with-double-brackets/_config.js b/test/function/samples/wrap-empty-object-with-double-brackets/_config.js new file mode 100644 index 00000000000..51d3a0c6c32 --- /dev/null +++ b/test/function/samples/wrap-empty-object-with-double-brackets/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'wrap double brackets to empty object' +}); diff --git a/test/function/samples/wrap-empty-object-with-double-brackets/main.js b/test/function/samples/wrap-empty-object-with-double-brackets/main.js new file mode 100644 index 00000000000..de9628c9346 --- /dev/null +++ b/test/function/samples/wrap-empty-object-with-double-brackets/main.js @@ -0,0 +1,2 @@ +Object.prototype.customize_fn = () => {}; +const c = {}.customize_fn(); From aa43dedf257096e9da343296bdb605030eabaa6f Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 20 Nov 2024 09:01:53 +0100 Subject: [PATCH 02/32] Only rely on stable property paths when deoptimizing member expressions Literal values may be deoptimized later. At that point, we would otherwise need to deoptimize again. For hasEffects, we can use dynamic literal values as those checks are repeatedly executed. Resolves #5735 --- src/ast/nodes/MemberExpression.ts | 56 +++++++++---------- .../_expected.js | 7 ++- .../{_expected/es.js => _expected.js} | 0 .../_expected/amd.js | 14 ----- .../_expected/cjs.js | 12 ---- .../_expected/iife.js | 15 ----- .../_expected/system.js | 19 ------- .../_expected/umd.js | 17 ------ .../main.js | 1 - .../handle-try-catch/_config.js | 11 ++++ .../handle-try-catch/main.js | 21 +++++++ 11 files changed, 63 insertions(+), 110 deletions(-) rename test/form/samples/side-effects-prototype-assignments/{_expected/es.js => _expected.js} (100%) delete mode 100644 test/form/samples/side-effects-prototype-assignments/_expected/amd.js delete mode 100644 test/form/samples/side-effects-prototype-assignments/_expected/cjs.js delete mode 100644 test/form/samples/side-effects-prototype-assignments/_expected/iife.js delete mode 100644 test/form/samples/side-effects-prototype-assignments/_expected/system.js delete mode 100644 test/form/samples/side-effects-prototype-assignments/_expected/umd.js create mode 100644 test/function/samples/object-expression-treeshaking/handle-try-catch/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/handle-try-catch/main.js diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index a65874bdc38..20ea90685cd 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -102,12 +102,13 @@ export default class MemberExpression { declare object: ExpressionNode | Super; declare property: ExpressionNode | PrivateIdentifier; - declare propertyKey: ObjectPathKey | null; + declare propertyKey: ObjectPathKey; declare type: NodeType.tMemberExpression; variable: Variable | null = null; declare protected assignmentInteraction: NodeInteractionAssigned; declare private accessInteraction: NodeInteractionAccessed; private expressionsToBeDeoptimized: DeoptimizableEntity[] = []; + private declare dynamicPropertyKey: ObjectPathKey | null; get computed(): boolean { return isFlagSet(this.flags, Flag.computed); @@ -178,7 +179,7 @@ export default class MemberExpression if (path.length < MAX_PATH_DEPTH) { this.object.deoptimizeArgumentsOnInteractionAtPath( interaction, - [this.getPropertyKey(), ...path], + this.propertyKey === UnknownKey ? UNKNOWN_PATH : [this.propertyKey, ...path], recursionTracker ); } else { @@ -195,7 +196,7 @@ export default class MemberExpression deoptimizeCache(): void { const { expressionsToBeDeoptimized, object } = this; this.expressionsToBeDeoptimized = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; - this.propertyKey = UnknownKey; + this.dynamicPropertyKey = this.propertyKey; object.deoptimizePath(UNKNOWN_PATH); for (const expression of expressionsToBeDeoptimized) { expression.deoptimizeCache(); @@ -207,7 +208,7 @@ export default class MemberExpression if (this.variable) { this.variable.deoptimizePath(path); } else if (!this.isUndefined) { - const propertyKey = this.getPropertyKey(); + const { propertyKey } = this; this.object.deoptimizePath([ propertyKey === UnknownKey ? UnknownNonAccessorKey : propertyKey, ...(path.length < MAX_PATH_DEPTH @@ -228,13 +229,10 @@ export default class MemberExpression if (this.isUndefined) { return undefined; } - if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) { + const propertyKey = this.getDynamicPropertyKey(); + if (propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) { this.expressionsToBeDeoptimized.push(origin); - return this.object.getLiteralValueAtPath( - [this.getPropertyKey(), ...path], - recursionTracker, - origin - ); + return this.object.getLiteralValueAtPath([propertyKey, ...path], recursionTracker, origin); } return UnknownValue; } @@ -270,10 +268,11 @@ export default class MemberExpression if (this.isUndefined) { return [UNDEFINED_EXPRESSION, false]; } - if (this.propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) { + const propertyKey = this.getDynamicPropertyKey(); + if (propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) { this.expressionsToBeDeoptimized.push(origin); return this.object.getReturnExpressionWhenCalledAtPath( - [this.getPropertyKey(), ...path], + [propertyKey, ...path], interaction, recursionTracker, origin @@ -333,7 +332,7 @@ export default class MemberExpression } if (path.length < MAX_PATH_DEPTH) { return this.object.hasEffectsOnInteractionAtPath( - [this.getPropertyKey(), ...path], + [this.getDynamicPropertyKey(), ...path], interaction, context ); @@ -365,7 +364,7 @@ export default class MemberExpression this.includeProperties( path, [ - this.getPropertyKey(), + this.propertyKey, ...(path.length < MAX_PATH_DEPTH ? path : [...path.slice(0, MAX_PATH_DEPTH), UnknownKey as ObjectPathKey]) @@ -382,14 +381,9 @@ export default class MemberExpression ): void { if (!this.assignmentDeoptimized) this.applyAssignmentDeoptimization(); if (deoptimizeAccess) { - this.includePath([this.getPropertyKey()], context, includeChildrenRecursively); + this.includePath([this.propertyKey], context, includeChildrenRecursively); } else { - this.includeProperties( - EMPTY_PATH, - [this.getPropertyKey()], - context, - includeChildrenRecursively - ); + this.includeProperties(EMPTY_PATH, [this.propertyKey], context, includeChildrenRecursively); } } @@ -424,7 +418,8 @@ export default class MemberExpression initialise(): void { super.initialise(); - this.propertyKey = getResolvablePropertyKey(this); + this.dynamicPropertyKey = getResolvablePropertyKey(this); + this.propertyKey = this.dynamicPropertyKey === null ? UnknownKey : this.dynamicPropertyKey; this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED }; } @@ -473,10 +468,9 @@ export default class MemberExpression propertyReadSideEffects && !(this.variable || this.isUndefined) ) { - const propertyKey = this.getPropertyKey(); this.object.deoptimizeArgumentsOnInteractionAtPath( this.accessInteraction, - [propertyKey], + [this.propertyKey], SHARED_RECURSION_TRACKER ); this.scope.context.requestTreeshakingPass(); @@ -499,7 +493,7 @@ export default class MemberExpression ) { this.object.deoptimizeArgumentsOnInteractionAtPath( this.assignmentInteraction, - [this.getPropertyKey()], + [this.propertyKey], SHARED_RECURSION_TRACKER ); this.scope.context.requestTreeshakingPass(); @@ -522,18 +516,18 @@ export default class MemberExpression } } - private getPropertyKey(): ObjectPathKey { - if (this.propertyKey === null) { - this.propertyKey = UnknownKey; + private getDynamicPropertyKey(): ObjectPathKey { + if (this.dynamicPropertyKey === null) { + this.dynamicPropertyKey = UnknownKey; const value = this.property.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this); - return (this.propertyKey = + return (this.dynamicPropertyKey = value === SymbolToStringTag ? value : typeof value === 'symbol' ? UnknownKey : String(value)); } - return this.propertyKey; + return this.dynamicPropertyKey; } private hasAccessEffect(context: HasEffectsContext) { @@ -544,7 +538,7 @@ export default class MemberExpression propertyReadSideEffects && (propertyReadSideEffects === 'always' || this.object.hasEffectsOnInteractionAtPath( - [this.getPropertyKey()], + [this.getDynamicPropertyKey()], this.accessInteraction, context )) diff --git a/test/form/samples/side-effects-getters-and-setters/_expected.js b/test/form/samples/side-effects-getters-and-setters/_expected.js index b7214fb1d1b..31917077c8e 100644 --- a/test/form/samples/side-effects-getters-and-setters/_expected.js +++ b/test/form/samples/side-effects-getters-and-setters/_expected.js @@ -1,7 +1,12 @@ const retained1 = { get effect() { console.log('effect'); - }}; + }, + get noEffect() { + const x = 1; + return x; + } +}; //retained retained1.effect; diff --git a/test/form/samples/side-effects-prototype-assignments/_expected/es.js b/test/form/samples/side-effects-prototype-assignments/_expected.js similarity index 100% rename from test/form/samples/side-effects-prototype-assignments/_expected/es.js rename to test/form/samples/side-effects-prototype-assignments/_expected.js diff --git a/test/form/samples/side-effects-prototype-assignments/_expected/amd.js b/test/form/samples/side-effects-prototype-assignments/_expected/amd.js deleted file mode 100644 index 143e942181f..00000000000 --- a/test/form/samples/side-effects-prototype-assignments/_expected/amd.js +++ /dev/null @@ -1,14 +0,0 @@ -define((function () { 'use strict'; - - function V8Engine () {} - - V8Engine.prototype.toString = function () { return 'V8'; }; - - function V6Engine () {} - - V6Engine.prototype = V8Engine.prototype; - V6Engine.prototype.toString = function () { return 'V6'; }; - - console.log( new V8Engine().toString() ); - -})); diff --git a/test/form/samples/side-effects-prototype-assignments/_expected/cjs.js b/test/form/samples/side-effects-prototype-assignments/_expected/cjs.js deleted file mode 100644 index 47c19ab9df2..00000000000 --- a/test/form/samples/side-effects-prototype-assignments/_expected/cjs.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -function V8Engine () {} - -V8Engine.prototype.toString = function () { return 'V8'; }; - -function V6Engine () {} - -V6Engine.prototype = V8Engine.prototype; -V6Engine.prototype.toString = function () { return 'V6'; }; - -console.log( new V8Engine().toString() ); diff --git a/test/form/samples/side-effects-prototype-assignments/_expected/iife.js b/test/form/samples/side-effects-prototype-assignments/_expected/iife.js deleted file mode 100644 index 41af21f3b9b..00000000000 --- a/test/form/samples/side-effects-prototype-assignments/_expected/iife.js +++ /dev/null @@ -1,15 +0,0 @@ -(function () { - 'use strict'; - - function V8Engine () {} - - V8Engine.prototype.toString = function () { return 'V8'; }; - - function V6Engine () {} - - V6Engine.prototype = V8Engine.prototype; - V6Engine.prototype.toString = function () { return 'V6'; }; - - console.log( new V8Engine().toString() ); - -})(); diff --git a/test/form/samples/side-effects-prototype-assignments/_expected/system.js b/test/form/samples/side-effects-prototype-assignments/_expected/system.js deleted file mode 100644 index aaa2864127f..00000000000 --- a/test/form/samples/side-effects-prototype-assignments/_expected/system.js +++ /dev/null @@ -1,19 +0,0 @@ -System.register([], (function () { - 'use strict'; - return { - execute: (function () { - - function V8Engine () {} - - V8Engine.prototype.toString = function () { return 'V8'; }; - - function V6Engine () {} - - V6Engine.prototype = V8Engine.prototype; - V6Engine.prototype.toString = function () { return 'V6'; }; - - console.log( new V8Engine().toString() ); - - }) - }; -})); diff --git a/test/form/samples/side-effects-prototype-assignments/_expected/umd.js b/test/form/samples/side-effects-prototype-assignments/_expected/umd.js deleted file mode 100644 index 26eb88fc96c..00000000000 --- a/test/form/samples/side-effects-prototype-assignments/_expected/umd.js +++ /dev/null @@ -1,17 +0,0 @@ -(function (factory) { - typeof define === 'function' && define.amd ? define(factory) : - factory(); -})((function () { 'use strict'; - - function V8Engine () {} - - V8Engine.prototype.toString = function () { return 'V8'; }; - - function V6Engine () {} - - V6Engine.prototype = V8Engine.prototype; - V6Engine.prototype.toString = function () { return 'V6'; }; - - console.log( new V8Engine().toString() ); - -})); diff --git a/test/form/samples/side-effects-prototype-assignments/main.js b/test/form/samples/side-effects-prototype-assignments/main.js index 39142a71ca9..f7dcc5162ec 100644 --- a/test/form/samples/side-effects-prototype-assignments/main.js +++ b/test/form/samples/side-effects-prototype-assignments/main.js @@ -10,6 +10,5 @@ V6Engine.prototype.toString = function () { return 'V6'; }; function IgnoredEngine () {} IgnoredEngine.prototype.toString = function () { return 'IGNORED'; }; -IgnoredEngine.prototype[ 'to' + 'String' ] = function () { return 'IGNORED'; }; console.log( new V8Engine().toString() ); diff --git a/test/function/samples/object-expression-treeshaking/handle-try-catch/_config.js b/test/function/samples/object-expression-treeshaking/handle-try-catch/_config.js new file mode 100644 index 00000000000..ab0519c6551 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/handle-try-catch/_config.js @@ -0,0 +1,11 @@ +const assert = require('node:assert'); + +module.exports = defineTest({ + description: 'include properties through try-catch calls', + exports({ getBuilder }) { + const builder = getBuilder(); + assert.deepStrictEqual(builder.buildCall(), 3n); + assert.deepStrictEqual(builder.buildEvent(), 2n); + assert.deepStrictEqual(builder.buildError(), 1n); + } +}); diff --git a/test/function/samples/object-expression-treeshaking/handle-try-catch/main.js b/test/function/samples/object-expression-treeshaking/handle-try-catch/main.js new file mode 100644 index 00000000000..6b01e44851d --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/handle-try-catch/main.js @@ -0,0 +1,21 @@ +export const getBuilder = () => { + const variantShapeId = { + errors: 1n, + events: 2n, + calls: 3n + }; + + const buildVariant = variantType => () => { + try { + return variantShapeId[variantType]; + } catch { + return null; + } + }; + + return { + buildCall: buildVariant('calls'), + buildEvent: buildVariant('events'), + buildError: buildVariant('errors') + }; +}; From 761bdad88f5f6201ded9217e1c1689534eef9166 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 22 Nov 2024 06:53:29 +0100 Subject: [PATCH 03/32] Do not mark unused rest parameters as undefined resolves #5739 --- src/ast/scopes/ReturnValueScope.ts | 3 ++- src/ast/values.ts | 8 +++++--- .../samples/track-rest-parameter-value/_config.js | 4 ++++ test/function/samples/track-rest-parameter-value/main.js | 9 +++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 test/function/samples/track-rest-parameter-value/_config.js create mode 100644 test/function/samples/track-rest-parameter-value/main.js diff --git a/src/ast/scopes/ReturnValueScope.ts b/src/ast/scopes/ReturnValueScope.ts index 0aedb66e81b..dfa4a466322 100644 --- a/src/ast/scopes/ReturnValueScope.ts +++ b/src/ast/scopes/ReturnValueScope.ts @@ -40,7 +40,8 @@ export default class ReturnValueScope extends ParameterScope { this.addArgumentToBeDeoptimized(argument); } } - for (; position < parameters.length; position++) { + const nonRestParameterLength = this.hasRest ? parameters.length - 1 : parameters.length; + for (; position < nonRestParameterLength; position++) { for (const variable of parameters[position]) { variable.addArgumentValue(UNDEFINED_EXPRESSION); } diff --git a/src/ast/values.ts b/src/ast/values.ts index 66147b82c39..9c85be79723 100644 --- a/src/ast/values.ts +++ b/src/ast/values.ts @@ -6,10 +6,12 @@ import { NODE_INTERACTION_UNKNOWN_CALL } from './NodeInteractions'; import type { LiteralValueOrBigInt } from './nodes/Literal'; +import type { LiteralValueOrUnknown } from './nodes/shared/Expression'; import { ExpressionEntity, UNKNOWN_EXPRESSION, - UNKNOWN_RETURN_EXPRESSION + UNKNOWN_RETURN_EXPRESSION, + UnknownValue } from './nodes/shared/Expression'; import { EMPTY_PATH, @@ -40,8 +42,8 @@ function assembleMemberDescriptions( export const UNDEFINED_EXPRESSION: ExpressionEntity = new (class UndefinedExpression extends ExpressionEntity { - getLiteralValueAtPath() { - return undefined; + getLiteralValueAtPath(path: ObjectPath): LiteralValueOrUnknown { + return path.length > 0 ? UnknownValue : undefined; } })(); diff --git a/test/function/samples/track-rest-parameter-value/_config.js b/test/function/samples/track-rest-parameter-value/_config.js new file mode 100644 index 00000000000..58ae41ab079 --- /dev/null +++ b/test/function/samples/track-rest-parameter-value/_config.js @@ -0,0 +1,4 @@ +module.exports = defineTest({ + description: + 'determines the correct value of rest parameters when a function is called multiple times' +}); diff --git a/test/function/samples/track-rest-parameter-value/main.js b/test/function/samples/track-rest-parameter-value/main.js new file mode 100644 index 00000000000..e8c5e9cf3a3 --- /dev/null +++ b/test/function/samples/track-rest-parameter-value/main.js @@ -0,0 +1,9 @@ +const getArgsInfo = (...args) => { + if (args.length === 0) { + return 'no args'; + } + return 'has args'; +}; + +assert.strictEqual(getArgsInfo(), 'no args'); +assert.strictEqual(getArgsInfo(1), 'has args'); From ccbce42c73c5bd425ada1ce7cf373fa52fedaaf3 Mon Sep 17 00:00:00 2001 From: XiaoPi <530257315@qq.com> Date: Tue, 19 Nov 2024 22:15:12 +0800 Subject: [PATCH 04/32] add an test for issue 5734 --- LICENSE.md | 22 +- .../object-tree-shaking-issue-5734/_config.js | 4 + .../object-tree-shaking-issue-5734/main.js | 2 + .../object-tree-shaking-issue-5734/module.js | 45586 ++++++++++++++++ 4 files changed, 45613 insertions(+), 1 deletion(-) create mode 100644 test/function/samples/object-tree-shaking-issue-5734/_config.js create mode 100644 test/function/samples/object-tree-shaking-issue-5734/main.js create mode 100644 test/function/samples/object-tree-shaking-issue-5734/module.js diff --git a/LICENSE.md b/LICENSE.md index ce44fa22e5b..868fbf14986 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -13,7 +13,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI # Licenses of bundled dependencies The published Rollup artifact additionally contains code with the following licenses: -MIT, ISC +MIT, ISC, 0BSD # Bundled dependencies: ## @jridgewell/sourcemap-codec @@ -632,6 +632,26 @@ Repository: micromatch/to-regex-range --------------------------------------- +## tslib +License: 0BSD +By: Microsoft Corp. +Repository: https://github.com/Microsoft/tslib.git + +> Copyright (c) Microsoft Corporation. +> +> Permission to use, copy, modify, and/or distribute this software for any +> purpose with or without fee is hereby granted. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +> AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +> PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + ## yargs-parser License: ISC By: Ben Coe diff --git a/test/function/samples/object-tree-shaking-issue-5734/_config.js b/test/function/samples/object-tree-shaking-issue-5734/_config.js new file mode 100644 index 00000000000..1afab9cecf1 --- /dev/null +++ b/test/function/samples/object-tree-shaking-issue-5734/_config.js @@ -0,0 +1,4 @@ +module.exports = defineTest({ + description: 'Maximum call stack size exceeded', + solo: true +}); diff --git a/test/function/samples/object-tree-shaking-issue-5734/main.js b/test/function/samples/object-tree-shaking-issue-5734/main.js new file mode 100644 index 00000000000..d2d5cdeb728 --- /dev/null +++ b/test/function/samples/object-tree-shaking-issue-5734/main.js @@ -0,0 +1,2 @@ +import { MySqlParser } from './module.js'; +console.log(new MySqlParser()); diff --git a/test/function/samples/object-tree-shaking-issue-5734/module.js b/test/function/samples/object-tree-shaking-issue-5734/module.js new file mode 100644 index 00000000000..7ce43fdb78e --- /dev/null +++ b/test/function/samples/object-tree-shaking-issue-5734/module.js @@ -0,0 +1,45586 @@ +class MySqlParser extends SQLParserBase { + get grammarFileName() { return "MySqlParser.g4"; } + get literalNames() { return MySqlParser.literalNames; } + get symbolicNames() { return MySqlParser.symbolicNames; } + get ruleNames() { return MySqlParser.ruleNames; } + get serializedATN() { return MySqlParser._serializedATN; } + createFailedPredicateException(predicate, message) { + return new antlr.FailedPredicateException(this, predicate, message); + } + constructor(input) { + super(input); + this.interpreter = new antlr.ParserATNSimulator(this, MySqlParser._ATN, MySqlParser.decisionsToDFA, new antlr.PredictionContextCache()); + } + program() { + let localContext = new ProgramContext(this.context, this.state); + this.enterRule(localContext, 0, MySqlParser.RULE_program); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 837; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 169870592) !== 0) || ((((_la - 34)) & ~0x1F) === 0 && ((1 << (_la - 34)) & 268573697) !== 0) || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 2151694339) !== 0) || ((((_la - 104)) & ~0x1F) === 0 && ((1 << (_la - 104)) & 536936449) !== 0) || ((((_la - 140)) & ~0x1F) === 0 && ((1 << (_la - 140)) & 442923) !== 0) || ((((_la - 173)) & ~0x1F) === 0 && ((1 << (_la - 173)) & 2184193) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 16781443) !== 0) || _la === 362 || _la === 371 || ((((_la - 404)) & ~0x1F) === 0 && ((1 << (_la - 404)) & 270573569) !== 0) || _la === 540 || _la === 562 || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 16643) !== 0) || ((((_la - 640)) & ~0x1F) === 0 && ((1 << (_la - 640)) & 268435521) !== 0) || _la === 673 || _la === 694 || _la === 713 || _la === 717 || _la === 749 || _la === 866 || _la === 869) { + { + { + this.state = 834; + this.singleStatement(); + } + } + this.state = 839; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 840; + this.match(MySqlParser.EOF); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + singleStatement() { + let localContext = new SingleStatementContext(this.context, this.state); + this.enterRule(localContext, 2, MySqlParser.RULE_singleStatement); + try { + this.state = 847; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + this.enterOuterAlt(localContext, 1); + { + this.state = 842; + this.sqlStatement(); + this.state = 844; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1, this.context)) { + case 1: + { + this.state = 843; + this.match(MySqlParser.SEMI); + } + break; + } + } + break; + case MySqlParser.SEMI: + this.enterOuterAlt(localContext, 2); + { + this.state = 846; + this.emptyStatement_(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + sqlStatement() { + let localContext = new SqlStatementContext(this.context, this.state); + this.enterRule(localContext, 4, MySqlParser.RULE_sqlStatement); + try { + this.state = 856; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 3, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 849; + this.ddlStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 850; + this.dmlStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 851; + this.transactionStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 852; + this.replicationStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 853; + this.preparedStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 854; + this.administrationStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 855; + this.utilityStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + emptyStatement_() { + let localContext = new EmptyStatement_Context(this.context, this.state); + this.enterRule(localContext, 6, MySqlParser.RULE_emptyStatement_); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 858; + this.match(MySqlParser.SEMI); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ddlStatement() { + let localContext = new DdlStatementContext(this.context, this.state); + this.enterRule(localContext, 8, MySqlParser.RULE_ddlStatement); + try { + this.state = 899; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 4, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 860; + this.createDatabase(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 861; + this.createEvent(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 862; + this.createIndex(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 863; + this.createLogfileGroup(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 864; + this.createProcedure(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 865; + this.createFunction(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 866; + this.createServer(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 867; + this.createTable(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 868; + this.createTablespaceInnodb(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 869; + this.createTablespaceNdb(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 870; + this.createTrigger(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 871; + this.createView(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 872; + this.createRole(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 873; + this.alterDatabase(); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 874; + this.alterEvent(); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 875; + this.alterFunction(); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 876; + this.alterInstance(); + } + break; + case 18: + this.enterOuterAlt(localContext, 18); + { + this.state = 877; + this.alterLogfileGroup(); + } + break; + case 19: + this.enterOuterAlt(localContext, 19); + { + this.state = 878; + this.alterProcedure(); + } + break; + case 20: + this.enterOuterAlt(localContext, 20); + { + this.state = 879; + this.alterServer(); + } + break; + case 21: + this.enterOuterAlt(localContext, 21); + { + this.state = 880; + this.alterTable(); + } + break; + case 22: + this.enterOuterAlt(localContext, 22); + { + this.state = 881; + this.alterTablespace(); + } + break; + case 23: + this.enterOuterAlt(localContext, 23); + { + this.state = 882; + this.alterView(); + } + break; + case 24: + this.enterOuterAlt(localContext, 24); + { + this.state = 883; + this.dropDatabase(); + } + break; + case 25: + this.enterOuterAlt(localContext, 25); + { + this.state = 884; + this.dropEvent(); + } + break; + case 26: + this.enterOuterAlt(localContext, 26); + { + this.state = 885; + this.dropIndex(); + } + break; + case 27: + this.enterOuterAlt(localContext, 27); + { + this.state = 886; + this.dropLogfileGroup(); + } + break; + case 28: + this.enterOuterAlt(localContext, 28); + { + this.state = 887; + this.dropProcedure(); + } + break; + case 29: + this.enterOuterAlt(localContext, 29); + { + this.state = 888; + this.dropFunction(); + } + break; + case 30: + this.enterOuterAlt(localContext, 30); + { + this.state = 889; + this.dropServer(); + } + break; + case 31: + this.enterOuterAlt(localContext, 31); + { + this.state = 890; + this.dropSpatial(); + } + break; + case 32: + this.enterOuterAlt(localContext, 32); + { + this.state = 891; + this.dropTable(); + } + break; + case 33: + this.enterOuterAlt(localContext, 33); + { + this.state = 892; + this.dropTablespace(); + } + break; + case 34: + this.enterOuterAlt(localContext, 34); + { + this.state = 893; + this.dropTrigger(); + } + break; + case 35: + this.enterOuterAlt(localContext, 35); + { + this.state = 894; + this.dropView(); + } + break; + case 36: + this.enterOuterAlt(localContext, 36); + { + this.state = 895; + this.dropRole(); + } + break; + case 37: + this.enterOuterAlt(localContext, 37); + { + this.state = 896; + this.setRole(); + } + break; + case 38: + this.enterOuterAlt(localContext, 38); + { + this.state = 897; + this.renameTable(); + } + break; + case 39: + this.enterOuterAlt(localContext, 39); + { + this.state = 898; + this.truncateTable(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dmlStatement() { + let localContext = new DmlStatementContext(this.context, this.state); + this.enterRule(localContext, 10, MySqlParser.RULE_dmlStatement); + try { + this.state = 918; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 5, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 901; + this.selectStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 902; + this.setOperations(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 903; + this.insertStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 904; + this.updateStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 905; + this.deleteStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 906; + this.replaceStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 907; + this.callStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 908; + this.interSectStatement(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 909; + this.loadDataStatement(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 910; + this.loadXmlStatement(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 911; + this.parenthesizedQuery(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 912; + this.doStatement(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 913; + this.handlerStatement(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 914; + this.importTableStatement(); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 915; + this.valuesStatement(); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 916; + this.withStatement(); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 917; + this.tableStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionStatement() { + let localContext = new TransactionStatementContext(this.context, this.state); + this.enterRule(localContext, 12, MySqlParser.RULE_transactionStatement); + try { + this.state = 929; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 6, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 920; + this.startTransaction(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 921; + this.beginWork(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 922; + this.commitWork(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 923; + this.rollbackWork(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 924; + this.savepointStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 925; + this.rollbackStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 926; + this.releaseStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 927; + this.lockTables(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 928; + this.unlockTables(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replicationStatement() { + let localContext = new ReplicationStatementContext(this.context, this.state); + this.enterRule(localContext, 14, MySqlParser.RULE_replicationStatement); + try { + this.state = 945; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 7, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 931; + this.changeMaster(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 932; + this.changeReplicationFilter(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 933; + this.changeReplicationSource(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 934; + this.purgeBinaryLogs(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 935; + this.startSlaveOrReplica(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 936; + this.stopSlaveOrReplica(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 937; + this.startGroupReplication(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 938; + this.stopGroupReplication(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 939; + this.xaStartTransaction(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 940; + this.xaEndTransaction(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 941; + this.xaPrepareStatement(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 942; + this.xaCommitWork(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 943; + this.xaRollbackWork(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 944; + this.xaRecoverWork(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + preparedStatement() { + let localContext = new PreparedStatementContext(this.context, this.state); + this.enterRule(localContext, 16, MySqlParser.RULE_preparedStatement); + try { + this.state = 950; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PREPARE: + this.enterOuterAlt(localContext, 1); + { + this.state = 947; + this.prepareStatement(); + } + break; + case MySqlParser.KW_EXECUTE: + this.enterOuterAlt(localContext, 2); + { + this.state = 948; + this.executeStatement(); + } + break; + case MySqlParser.KW_DROP: + case MySqlParser.KW_DEALLOCATE: + this.enterOuterAlt(localContext, 3); + { + this.state = 949; + this.deallocatePrepare(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + compoundStatement() { + let localContext = new CompoundStatementContext(this.context, this.state); + this.enterRule(localContext, 18, MySqlParser.RULE_compoundStatement); + try { + this.state = 962; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 952; + this.blockStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 953; + this.caseStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 954; + this.ifStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 955; + this.leaveStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 956; + this.loopStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 957; + this.repeatStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 958; + this.whileStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 959; + this.iterateStatement(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 960; + this.returnStatement(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 961; + this.cursorStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + administrationStatement() { + let localContext = new AdministrationStatementContext(this.context, this.state); + this.enterRule(localContext, 20, MySqlParser.RULE_administrationStatement); + try { + this.state = 997; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 10, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 964; + this.alterUser(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 965; + this.createUser(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 966; + this.dropUser(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 967; + this.grantStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 968; + this.grantProxy(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 969; + this.renameUser(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 970; + this.revokeStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 971; + this.alterResourceGroup(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 972; + this.createResourceGroup(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 973; + this.dropResourceGroup(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 974; + this.setResourceGroup(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 975; + this.analyzeTable(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 976; + this.checkTable(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 977; + this.checksumTable(); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 978; + this.optimizeTable(); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 979; + this.repairTable(); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 980; + this.installComponent(); + } + break; + case 18: + this.enterOuterAlt(localContext, 18); + { + this.state = 981; + this.uninstallComponent(); + } + break; + case 19: + this.enterOuterAlt(localContext, 19); + { + this.state = 982; + this.installPlugin(); + } + break; + case 20: + this.enterOuterAlt(localContext, 20); + { + this.state = 983; + this.uninstallPlugin(); + } + break; + case 21: + this.enterOuterAlt(localContext, 21); + { + this.state = 984; + this.cloneStatement(); + } + break; + case 22: + this.enterOuterAlt(localContext, 22); + { + this.state = 985; + this.setStatement(); + } + break; + case 23: + this.enterOuterAlt(localContext, 23); + { + this.state = 986; + this.showStatement(); + } + break; + case 24: + this.enterOuterAlt(localContext, 24); + { + this.state = 987; + this.binlogStatement(); + } + break; + case 25: + this.enterOuterAlt(localContext, 25); + { + this.state = 988; + this.cacheIndexStatement(); + } + break; + case 26: + this.enterOuterAlt(localContext, 26); + { + this.state = 989; + this.flushStatement(); + } + break; + case 27: + this.enterOuterAlt(localContext, 27); + { + this.state = 990; + this.killStatement(); + } + break; + case 28: + this.enterOuterAlt(localContext, 28); + { + this.state = 991; + this.loadIndexIntoCache(); + } + break; + case 29: + this.enterOuterAlt(localContext, 29); + { + this.state = 992; + this.resetStatement(); + } + break; + case 30: + this.enterOuterAlt(localContext, 30); + { + this.state = 993; + this.resetPersist(); + } + break; + case 31: + this.enterOuterAlt(localContext, 31); + { + this.state = 994; + this.resetAllChannel(); + } + break; + case 32: + this.enterOuterAlt(localContext, 32); + { + this.state = 995; + this.reStartStatement(); + } + break; + case 33: + this.enterOuterAlt(localContext, 33); + { + this.state = 996; + this.shutdownStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + utilityStatement() { + let localContext = new UtilityStatementContext(this.context, this.state); + this.enterRule(localContext, 22, MySqlParser.RULE_utilityStatement); + try { + this.state = 1007; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 11, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 999; + this.fullDescribeStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1000; + this.simpleDescribeStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1001; + this.analyzeDescribeStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1002; + this.helpStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 1003; + this.useStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 1004; + this.signalStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 1005; + this.resignalStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 1006; + this.diagnosticsStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDatabase() { + let localContext = new CreateDatabaseContext(this.context, this.state); + this.enterRule(localContext, 24, MySqlParser.RULE_createDatabase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1009; + this.match(MySqlParser.KW_CREATE); + this.state = 1010; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1012; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 12, this.context)) { + case 1: + { + this.state = 1011; + this.ifNotExists(); + } + break; + } + this.state = 1014; + this.databaseNameCreate(); + this.state = 1018; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 135 || _la === 224 || _la === 376 || _la === 823) { + { + { + this.state = 1015; + this.createDatabaseOption(); + } + } + this.state = 1020; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createEvent() { + let localContext = new CreateEventContext(this.context, this.state); + this.enterRule(localContext, 26, MySqlParser.RULE_createEvent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1021; + this.match(MySqlParser.KW_CREATE); + this.state = 1023; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1022; + this.ownerStatement(); + } + } + this.state = 1025; + this.match(MySqlParser.KW_EVENT); + this.state = 1027; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 15, this.context)) { + case 1: + { + this.state = 1026; + this.ifNotExists(); + } + break; + } + this.state = 1029; + localContext._event_name = this.fullId(); + this.state = 1030; + this.match(MySqlParser.KW_ON); + this.state = 1031; + this.match(MySqlParser.KW_SCHEDULE); + this.state = 1032; + this.scheduleExpression(); + this.state = 1039; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 119) { + { + this.state = 1033; + this.match(MySqlParser.KW_ON); + this.state = 1034; + this.match(MySqlParser.KW_COMPLETION); + this.state = 1036; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 1035; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 1038; + this.match(MySqlParser.KW_PRESERVE); + } + } + this.state = 1042; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 1041; + this.enableType(); + } + } + this.state = 1046; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 1044; + this.match(MySqlParser.KW_COMMENT); + this.state = 1045; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1048; + this.match(MySqlParser.KW_DO); + this.state = 1049; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createIndex() { + let localContext = new CreateIndexContext(this.context, this.state); + this.enterRule(localContext, 28, MySqlParser.RULE_createIndex); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 1051; + this.match(MySqlParser.KW_CREATE); + this.state = 1053; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 508 || _la === 514) { + { + this.state = 1052; + localContext._intimeAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 508 || _la === 514)) { + localContext._intimeAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1056; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 69 || _la === 161 || _la === 182) { + { + this.state = 1055; + localContext._indexCategory = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 69 || _la === 161 || _la === 182)) { + localContext._indexCategory = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1058; + this.match(MySqlParser.KW_INDEX); + this.state = 1059; + this.indexNameCreate(); + this.state = 1061; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1060; + this.indexType(); + } + } + this.state = 1063; + this.match(MySqlParser.KW_ON); + this.state = 1064; + this.tableName(); + this.state = 1065; + this.indexColumnNames(); + this.state = 1069; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 23, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1066; + this.indexOption(); + } + } + } + this.state = 1071; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 23, this.context); + } + this.state = 1084; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 27, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + this.state = 1082; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALGORITHM: + { + this.state = 1072; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 1074; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1073; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1076; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 357 || _la === 430)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_LOCK: + { + this.state = 1077; + this.match(MySqlParser.KW_LOCK); + this.state = 1079; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1078; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1081; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 389 || _la === 505 || _la === 595)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 1086; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 27, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createLogfileGroup() { + let localContext = new CreateLogfileGroupContext(this.context, this.state); + this.enterRule(localContext, 30, MySqlParser.RULE_createLogfileGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1087; + this.match(MySqlParser.KW_CREATE); + this.state = 1088; + this.match(MySqlParser.KW_LOGFILE); + this.state = 1089; + this.match(MySqlParser.KW_GROUP); + this.state = 1090; + localContext._logfileGroupName = this.uid(); + this.state = 1091; + this.match(MySqlParser.KW_ADD); + this.state = 1092; + this.match(MySqlParser.KW_UNDOFILE); + this.state = 1093; + localContext._undoFile = this.match(MySqlParser.STRING_LITERAL); + this.state = 1099; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 1094; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 1096; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1095; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1098; + localContext._initSize = this.fileSizeLiteral(); + } + } + this.state = 1106; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 672) { + { + this.state = 1101; + this.match(MySqlParser.KW_UNDO_BUFFER_SIZE); + this.state = 1103; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1102; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1105; + localContext._undoSize = this.fileSizeLiteral(); + } + } + this.state = 1113; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 553) { + { + this.state = 1108; + this.match(MySqlParser.KW_REDO_BUFFER_SIZE); + this.state = 1110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1109; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1112; + localContext._redoSize = this.fileSizeLiteral(); + } + } + this.state = 1120; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 504) { + { + this.state = 1115; + this.match(MySqlParser.KW_NODEGROUP); + this.state = 1117; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1116; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1119; + localContext._nodegroup = this.uid(); + } + } + this.state = 1123; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 1122; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 1130; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 1125; + this.match(MySqlParser.KW_COMMENT); + this.state = 1127; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1126; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1129; + localContext._comment = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1132; + this.match(MySqlParser.KW_ENGINE); + this.state = 1134; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1133; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1136; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createProcedure() { + let localContext = new CreateProcedureContext(this.context, this.state); + this.enterRule(localContext, 32, MySqlParser.RULE_createProcedure); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 1138; + this.match(MySqlParser.KW_CREATE); + this.state = 1140; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1139; + this.ownerStatement(); + } + } + this.state = 1142; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 1144; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 41, this.context)) { + case 1: + { + this.state = 1143; + this.ifNotExists(); + } + break; + } + this.state = 1146; + localContext._sp_name = this.fullId(); + this.state = 1147; + this.match(MySqlParser.LR_BRACKET); + this.state = 1149; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18880593) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100680481) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1148; + this.procedureParameter(); + } + } + this.state = 1155; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1151; + this.match(MySqlParser.COMMA); + this.state = 1152; + this.procedureParameter(); + } + } + this.state = 1157; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1158; + this.match(MySqlParser.RR_BRACKET); + this.state = 1162; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 44, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1159; + this.routineOption(); + } + } + } + this.state = 1164; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 44, this.context); + } + this.state = 1165; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createRole() { + let localContext = new CreateRoleContext(this.context, this.state); + this.enterRule(localContext, 34, MySqlParser.RULE_createRole); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1167; + this.match(MySqlParser.KW_CREATE); + this.state = 1168; + this.match(MySqlParser.KW_ROLE); + this.state = 1170; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 45, this.context)) { + case 1: + { + this.state = 1169; + this.ifNotExists(); + } + break; + } + this.state = 1172; + this.userOrRoleNames(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createServer() { + let localContext = new CreateServerContext(this.context, this.state); + this.enterRule(localContext, 36, MySqlParser.RULE_createServer); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1174; + this.match(MySqlParser.KW_CREATE); + this.state = 1175; + this.match(MySqlParser.KW_SERVER); + this.state = 1176; + localContext._servername = this.uid(); + this.state = 1177; + this.match(MySqlParser.KW_FOREIGN); + this.state = 1178; + this.match(MySqlParser.KW_DATA); + this.state = 1179; + this.match(MySqlParser.KW_WRAPPER); + this.state = 1180; + localContext._wrapperName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 494 || _la === 882)) { + localContext._wrapperName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1181; + this.match(MySqlParser.KW_OPTIONS); + this.state = 1182; + this.match(MySqlParser.LR_BRACKET); + this.state = 1183; + this.serverOption(); + this.state = 1188; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1184; + this.match(MySqlParser.COMMA); + this.state = 1185; + this.serverOption(); + } + } + this.state = 1190; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1191; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTable() { + let localContext = new CreateTableContext(this.context, this.state); + this.enterRule(localContext, 38, MySqlParser.RULE_createTable); + let _la; + try { + let alternative; + this.state = 1271; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 65, this.context)) { + case 1: + localContext = new QueryCreateTableContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1193; + this.match(MySqlParser.KW_CREATE); + this.state = 1195; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 1194; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 1197; + this.match(MySqlParser.KW_TABLE); + this.state = 1199; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 48, this.context)) { + case 1: + { + this.state = 1198; + this.ifNotExists(); + } + break; + } + this.state = 1201; + localContext._tb = this.tableNameCreate(); + this.state = 1203; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 49, this.context)) { + case 1: + { + this.state = 1202; + localContext._col = this.createDefinitions(); + } + break; + } + this.state = 1215; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 82 || _la === 181 || _la === 224 || ((((_la - 314)) & ~0x1F) === 0 && ((1 << (_la - 314)) & 67141639) !== 0) || ((((_la - 346)) & ~0x1F) === 0 && ((1 << (_la - 346)) & 3221766153) !== 0) || _la === 380 || _la === 431 || _la === 443 || _la === 480 || _la === 490 || ((((_la - 520)) & ~0x1F) === 0 && ((1 << (_la - 520)) & 541) !== 0) || _la === 588 || ((((_la - 640)) & ~0x1F) === 0 && ((1 << (_la - 640)) & 34341021) !== 0) || ((((_la - 823)) & ~0x1F) === 0 && ((1 << (_la - 823)) & 1029) !== 0) || _la === 882) { + { + this.state = 1205; + this.tableOption(); + this.state = 1212; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 82 || _la === 181 || _la === 224 || ((((_la - 314)) & ~0x1F) === 0 && ((1 << (_la - 314)) & 67141639) !== 0) || ((((_la - 346)) & ~0x1F) === 0 && ((1 << (_la - 346)) & 3221766153) !== 0) || _la === 380 || _la === 431 || _la === 443 || _la === 480 || _la === 490 || ((((_la - 520)) & ~0x1F) === 0 && ((1 << (_la - 520)) & 541) !== 0) || _la === 588 || ((((_la - 640)) & ~0x1F) === 0 && ((1 << (_la - 640)) & 34341021) !== 0) || ((((_la - 823)) & ~0x1F) === 0 && ((1 << (_la - 823)) & 1029) !== 0) || _la === 868 || _la === 882) { + { + { + this.state = 1207; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 1206; + this.match(MySqlParser.COMMA); + } + } + this.state = 1209; + this.tableOption(); + } + } + this.state = 1214; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 1218; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 1217; + this.partitionDefinitions(); + } + } + this.state = 1221; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79 || _la === 143) { + { + this.state = 1220; + _la = this.tokenStream.LA(1); + if (!(_la === 79 || _la === 143)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1224; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 1223; + this.match(MySqlParser.KW_AS); + } + } + this.state = 1226; + this.selectStatement(); + } + break; + case 2: + localContext = new CopyCreateTableContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1228; + this.match(MySqlParser.KW_CREATE); + this.state = 1230; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 1229; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 1232; + this.match(MySqlParser.KW_TABLE); + this.state = 1234; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 57, this.context)) { + case 1: + { + this.state = 1233; + this.ifNotExists(); + } + break; + } + this.state = 1236; + this.tableNameCreate(); + this.state = 1244; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_LIKE: + { + this.state = 1237; + this.match(MySqlParser.KW_LIKE); + this.state = 1238; + this.tableName(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 1239; + this.match(MySqlParser.LR_BRACKET); + this.state = 1240; + this.match(MySqlParser.KW_LIKE); + this.state = 1241; + this.tableName(); + this.state = 1242; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 3: + localContext = new ColumnCreateTableContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1246; + this.match(MySqlParser.KW_CREATE); + this.state = 1248; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 1247; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 1250; + this.match(MySqlParser.KW_TABLE); + this.state = 1252; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 60, this.context)) { + case 1: + { + this.state = 1251; + this.ifNotExists(); + } + break; + } + this.state = 1254; + this.tableNameCreate(); + this.state = 1255; + this.createDefinitions(); + this.state = 1266; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 63, this.context)) { + case 1: + { + this.state = 1256; + this.tableOption(); + this.state = 1263; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 62, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1258; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 1257; + this.match(MySqlParser.COMMA); + } + } + this.state = 1260; + this.tableOption(); + } + } + } + this.state = 1265; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 62, this.context); + } + } + break; + } + this.state = 1269; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 1268; + this.partitionDefinitions(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTablespaceInnodb() { + let localContext = new CreateTablespaceInnodbContext(this.context, this.state); + this.enterRule(localContext, 40, MySqlParser.RULE_createTablespaceInnodb); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1273; + this.match(MySqlParser.KW_CREATE); + this.state = 1275; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 1274; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 1277; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 1278; + this.tablespaceNameCreate(); + this.state = 1282; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 6) { + { + this.state = 1279; + this.match(MySqlParser.KW_ADD); + this.state = 1280; + this.match(MySqlParser.KW_DATAFILE); + this.state = 1281; + localContext._datafile = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1289; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 314) { + { + this.state = 1284; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 1286; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1285; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1288; + localContext._autoextendSize = this.fileSizeLiteral(); + } + } + this.state = 1294; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 399) { + { + this.state = 1291; + this.match(MySqlParser.KW_FILE_BLOCK_SIZE); + this.state = 1292; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 1293; + localContext._fileBlockSize = this.fileSizeLiteral(); + } + } + this.state = 1301; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 380) { + { + this.state = 1296; + this.match(MySqlParser.KW_ENGINE); + this.state = 1298; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1297; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1300; + this.engineName(); + } + } + this.state = 1308; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 825) { + { + this.state = 1303; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 1305; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1304; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1307; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTablespaceNdb() { + let localContext = new CreateTablespaceNdbContext(this.context, this.state); + this.enterRule(localContext, 42, MySqlParser.RULE_createTablespaceNdb); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1310; + this.match(MySqlParser.KW_CREATE); + this.state = 1312; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 1311; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 1314; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 1315; + this.tablespaceNameCreate(); + this.state = 1316; + this.match(MySqlParser.KW_ADD); + this.state = 1317; + this.match(MySqlParser.KW_DATAFILE); + this.state = 1318; + localContext._datafile = this.match(MySqlParser.STRING_LITERAL); + this.state = 1319; + this.match(MySqlParser.KW_USE); + this.state = 1320; + this.match(MySqlParser.KW_LOGFILE); + this.state = 1321; + this.match(MySqlParser.KW_GROUP); + this.state = 1322; + localContext._logfileGroupName = this.uid(); + this.state = 1328; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 393) { + { + this.state = 1323; + this.match(MySqlParser.KW_EXTENT_SIZE); + this.state = 1325; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1324; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1327; + localContext._extentSize = this.fileSizeLiteral(); + } + } + this.state = 1335; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 1330; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 1332; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1331; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1334; + localContext._initialSize = this.fileSizeLiteral(); + } + } + this.state = 1342; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 314) { + { + this.state = 1337; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 1339; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1338; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1341; + localContext._autoextendSize = this.fileSizeLiteral(); + } + } + this.state = 1349; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 481) { + { + this.state = 1344; + this.match(MySqlParser.KW_MAX_SIZE); + this.state = 1346; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1345; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1348; + localContext._maxSize = this.fileSizeLiteral(); + } + } + this.state = 1356; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 504) { + { + this.state = 1351; + this.match(MySqlParser.KW_NODEGROUP); + this.state = 1353; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1352; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1355; + localContext._nodegroup = this.uid(); + } + } + this.state = 1359; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 1358; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 1366; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 1361; + this.match(MySqlParser.KW_COMMENT); + this.state = 1363; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1362; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1365; + localContext._comment = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1368; + this.match(MySqlParser.KW_ENGINE); + this.state = 1370; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1369; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1372; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTrigger() { + let localContext = new CreateTriggerContext(this.context, this.state); + this.enterRule(localContext, 44, MySqlParser.RULE_createTrigger); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1374; + this.match(MySqlParser.KW_CREATE); + this.state = 1376; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1375; + this.ownerStatement(); + } + } + this.state = 1378; + this.match(MySqlParser.KW_TRIGGER); + this.state = 1380; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 91, this.context)) { + case 1: + { + this.state = 1379; + this.ifNotExists(); + } + break; + } + this.state = 1382; + localContext._trigger_name = this.fullId(); + this.state = 1383; + localContext._triggerTime = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 16 || _la === 306)) { + localContext._triggerTime = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1384; + localContext._triggerEvent = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 44 || _la === 86 || _la === 185)) { + localContext._triggerEvent = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1385; + this.match(MySqlParser.KW_ON); + this.state = 1386; + this.tableName(); + this.state = 1387; + this.match(MySqlParser.KW_FOR); + this.state = 1388; + this.match(MySqlParser.KW_EACH); + this.state = 1389; + this.match(MySqlParser.KW_ROW); + this.state = 1392; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 92, this.context)) { + case 1: + { + this.state = 1390; + localContext._triggerPlace = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 406 || _la === 538)) { + localContext._triggerPlace = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1391; + localContext._other_trigger_name = this.fullId(); + } + break; + } + this.state = 1394; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + withClause() { + let localContext = new WithClauseContext(this.context, this.state); + this.enterRule(localContext, 46, MySqlParser.RULE_withClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1396; + this.match(MySqlParser.KW_WITH); + this.state = 1398; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 93, this.context)) { + case 1: + { + this.state = 1397; + this.match(MySqlParser.KW_RECURSIVE); + } + break; + } + this.state = 1400; + this.commonTableExpressions(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + commonTableExpressions() { + let localContext = new CommonTableExpressionsContext(this.context, this.state); + this.enterRule(localContext, 48, MySqlParser.RULE_commonTableExpressions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1402; + localContext._cteName = this.uid(); + this.state = 1414; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 1403; + this.match(MySqlParser.LR_BRACKET); + this.state = 1404; + localContext._cteColumnName = this.uid(); + this.state = 1409; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1405; + this.match(MySqlParser.COMMA); + this.state = 1406; + localContext._cteColumnName = this.uid(); + } + } + this.state = 1411; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1412; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 1416; + this.match(MySqlParser.KW_AS); + this.state = 1417; + this.match(MySqlParser.LR_BRACKET); + this.state = 1418; + this.dmlStatement(); + this.state = 1419; + this.match(MySqlParser.RR_BRACKET); + this.state = 1422; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 96, this.context)) { + case 1: + { + this.state = 1420; + this.match(MySqlParser.COMMA); + this.state = 1421; + this.commonTableExpressions(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createView() { + let localContext = new CreateViewContext(this.context, this.state); + this.enterRule(localContext, 50, MySqlParser.RULE_createView); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1424; + this.match(MySqlParser.KW_CREATE); + this.state = 1426; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 124) { + { + this.state = 1425; + this.orReplace(); + } + } + this.state = 1431; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 1428; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 1429; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 1430; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 486 || _la === 661 || _la === 670)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1434; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1433; + this.ownerStatement(); + } + } + this.state = 1439; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 162) { + { + this.state = 1436; + this.match(MySqlParser.KW_SQL); + this.state = 1437; + this.match(MySqlParser.KW_SECURITY); + this.state = 1438; + localContext._secContext = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 364 || _la === 436)) { + localContext._secContext = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1441; + this.match(MySqlParser.KW_VIEW); + this.state = 1442; + this.viewNameCreate(); + this.state = 1454; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 1443; + this.match(MySqlParser.LR_BRACKET); + this.state = 1444; + this.columnNameCreate(); + this.state = 1449; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1445; + this.match(MySqlParser.COMMA); + this.state = 1446; + this.columnNameCreate(); + } + } + this.state = 1451; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1452; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 1456; + this.match(MySqlParser.KW_AS); + this.state = 1476; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 107, this.context)) { + case 1: + { + this.state = 1457; + this.match(MySqlParser.LR_BRACKET); + this.state = 1459; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 1458; + this.withClause(); + } + } + this.state = 1461; + this.selectStatement(); + this.state = 1462; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 1465; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 1464; + this.withClause(); + } + } + this.state = 1467; + this.selectStatement(); + this.state = 1474; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 106, this.context)) { + case 1: + { + this.state = 1468; + this.match(MySqlParser.KW_WITH); + this.state = 1470; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 325 || _la === 450) { + { + this.state = 1469; + localContext._checkOption = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 325 || _la === 450)) { + localContext._checkOption = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1472; + this.match(MySqlParser.KW_CHECK); + this.state = 1473; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDatabaseOption() { + let localContext = new CreateDatabaseOptionContext(this.context, this.state); + this.enterRule(localContext, 52, MySqlParser.RULE_createDatabaseOption); + let _la; + try { + this.state = 1511; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 116, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1479; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1478; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1481; + this.charSet(); + this.state = 1483; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1482; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1487; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 1485; + this.charsetName(); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 1486; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1490; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1489; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1492; + this.match(MySqlParser.KW_COLLATE); + this.state = 1494; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1493; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1496; + this.collationName(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1498; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1497; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1500; + this.match(MySqlParser.KW_ENCRYPTION); + this.state = 1502; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1501; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1504; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1505; + this.match(MySqlParser.KW_READ); + this.state = 1506; + this.match(MySqlParser.KW_ONLY); + this.state = 1508; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1507; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1510; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + charSet() { + let localContext = new CharSetContext(this.context, this.state); + this.enterRule(localContext, 54, MySqlParser.RULE_charSet); + try { + this.state = 1518; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CHARACTER: + this.enterOuterAlt(localContext, 1); + { + this.state = 1513; + this.match(MySqlParser.KW_CHARACTER); + this.state = 1514; + this.match(MySqlParser.KW_SET); + } + break; + case MySqlParser.KW_CHARSET: + this.enterOuterAlt(localContext, 2); + { + this.state = 1515; + this.match(MySqlParser.KW_CHARSET); + } + break; + case MySqlParser.KW_CHAR: + this.enterOuterAlt(localContext, 3); + { + this.state = 1516; + this.match(MySqlParser.KW_CHAR); + this.state = 1517; + this.match(MySqlParser.KW_SET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + currentUserExpression() { + let localContext = new CurrentUserExpressionContext(this.context, this.state); + this.enterRule(localContext, 56, MySqlParser.RULE_currentUserExpression); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1520; + _la = this.tokenStream.LA(1); + if (!(_la === 37 || _la === 678)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1523; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 118, this.context)) { + case 1: + { + this.state = 1521; + this.match(MySqlParser.LR_BRACKET); + this.state = 1522; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ownerStatement() { + let localContext = new OwnerStatementContext(this.context, this.state); + this.enterRule(localContext, 58, MySqlParser.RULE_ownerStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1525; + this.match(MySqlParser.KW_DEFINER); + this.state = 1526; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 1529; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 119, this.context)) { + case 1: + { + this.state = 1527; + this.userName(); + } + break; + case 2: + { + this.state = 1528; + this.currentUserExpression(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + scheduleExpression() { + let localContext = new ScheduleExpressionContext(this.context, this.state); + this.enterRule(localContext, 60, MySqlParser.RULE_scheduleExpression); + let _la; + try { + this.state = 1565; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AT: + localContext = new PreciseScheduleContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1531; + this.match(MySqlParser.KW_AT); + this.state = 1532; + this.timestampValue(); + this.state = 1536; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 853) { + { + { + this.state = 1533; + this.intervalExpr(); + } + } + this.state = 1538; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case MySqlParser.KW_EVERY: + localContext = new IntervalScheduleContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1539; + this.match(MySqlParser.KW_EVERY); + this.state = 1542; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 121, this.context)) { + case 1: + { + this.state = 1540; + this.decimalLiteral(); + } + break; + case 2: + { + this.state = 1541; + this.expression(0); + } + break; + } + this.state = 1544; + this.intervalType(); + this.state = 1553; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 641) { + { + this.state = 1545; + this.match(MySqlParser.KW_STARTS); + this.state = 1546; + localContext._startTimestamp = this.timestampValue(); + this.state = 1550; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 853) { + { + { + this.state = 1547; + localContext._intervalExpr = this.intervalExpr(); + localContext._startIntervals.push(localContext._intervalExpr); + } + } + this.state = 1552; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 1563; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 379) { + { + this.state = 1555; + this.match(MySqlParser.KW_ENDS); + this.state = 1556; + localContext._endTimestamp = this.timestampValue(); + this.state = 1560; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 853) { + { + { + this.state = 1557; + localContext._intervalExpr = this.intervalExpr(); + localContext._endIntervals.push(localContext._intervalExpr); + } + } + this.state = 1562; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + timestampValue() { + let localContext = new TimestampValueContext(this.context, this.state); + this.enterRule(localContext, 62, MySqlParser.RULE_timestampValue); + try { + this.state = 1571; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 127, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1567; + this.match(MySqlParser.KW_CURRENT_TIMESTAMP); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1568; + this.stringLiteral(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1569; + this.decimalLiteral(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1570; + this.expression(0); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intervalExpr() { + let localContext = new IntervalExprContext(this.context, this.state); + this.enterRule(localContext, 64, MySqlParser.RULE_intervalExpr); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1573; + this.match(MySqlParser.PLUS); + this.state = 1574; + this.match(MySqlParser.KW_INTERVAL); + this.state = 1577; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 128, this.context)) { + case 1: + { + this.state = 1575; + this.decimalLiteral(); + } + break; + case 2: + { + this.state = 1576; + this.expression(0); + } + break; + } + this.state = 1579; + this.intervalType(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intervalType() { + let localContext = new IntervalTypeContext(this.context, this.state); + this.enterRule(localContext, 66, MySqlParser.RULE_intervalType); + try { + this.state = 1594; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + this.enterOuterAlt(localContext, 1); + { + this.state = 1581; + this.intervalTypeBase(); + } + break; + case MySqlParser.KW_YEAR: + this.enterOuterAlt(localContext, 2); + { + this.state = 1582; + this.match(MySqlParser.KW_YEAR); + } + break; + case MySqlParser.KW_YEAR_MONTH: + this.enterOuterAlt(localContext, 3); + { + this.state = 1583; + this.match(MySqlParser.KW_YEAR_MONTH); + } + break; + case MySqlParser.KW_DAY_HOUR: + this.enterOuterAlt(localContext, 4); + { + this.state = 1584; + this.match(MySqlParser.KW_DAY_HOUR); + } + break; + case MySqlParser.KW_DAY_MINUTE: + this.enterOuterAlt(localContext, 5); + { + this.state = 1585; + this.match(MySqlParser.KW_DAY_MINUTE); + } + break; + case MySqlParser.KW_DAY_SECOND: + this.enterOuterAlt(localContext, 6); + { + this.state = 1586; + this.match(MySqlParser.KW_DAY_SECOND); + } + break; + case MySqlParser.KW_HOUR_MINUTE: + this.enterOuterAlt(localContext, 7); + { + this.state = 1587; + this.match(MySqlParser.KW_HOUR_MINUTE); + } + break; + case MySqlParser.KW_HOUR_SECOND: + this.enterOuterAlt(localContext, 8); + { + this.state = 1588; + this.match(MySqlParser.KW_HOUR_SECOND); + } + break; + case MySqlParser.KW_MINUTE_SECOND: + this.enterOuterAlt(localContext, 9); + { + this.state = 1589; + this.match(MySqlParser.KW_MINUTE_SECOND); + } + break; + case MySqlParser.KW_SECOND_MICROSECOND: + this.enterOuterAlt(localContext, 10); + { + this.state = 1590; + this.match(MySqlParser.KW_SECOND_MICROSECOND); + } + break; + case MySqlParser.KW_MINUTE_MICROSECOND: + this.enterOuterAlt(localContext, 11); + { + this.state = 1591; + this.match(MySqlParser.KW_MINUTE_MICROSECOND); + } + break; + case MySqlParser.KW_HOUR_MICROSECOND: + this.enterOuterAlt(localContext, 12); + { + this.state = 1592; + this.match(MySqlParser.KW_HOUR_MICROSECOND); + } + break; + case MySqlParser.KW_DAY_MICROSECOND: + this.enterOuterAlt(localContext, 13); + { + this.state = 1593; + this.match(MySqlParser.KW_DAY_MICROSECOND); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + enableType() { + let localContext = new EnableTypeContext(this.context, this.state); + this.enterRule(localContext, 68, MySqlParser.RULE_enableType); + try { + this.state = 1601; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 130, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1596; + this.match(MySqlParser.KW_ENABLE); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1597; + this.match(MySqlParser.KW_DISABLE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1598; + this.match(MySqlParser.KW_DISABLE); + this.state = 1599; + this.match(MySqlParser.KW_ON); + this.state = 1600; + this.match(MySqlParser.KW_SLAVE); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexType() { + let localContext = new IndexTypeContext(this.context, this.state); + this.enterRule(localContext, 70, MySqlParser.RULE_indexType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1603; + this.match(MySqlParser.KW_USING); + this.state = 1604; + _la = this.tokenStream.LA(1); + if (!(_la === 323 || _la === 418)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexOption() { + let localContext = new IndexOptionContext(this.context, this.state); + this.enterRule(localContext, 72, MySqlParser.RULE_indexOption); + let _la; + try { + this.state = 1628; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_KEY_BLOCK_SIZE: + this.enterOuterAlt(localContext, 1); + { + this.state = 1606; + this.match(MySqlParser.KW_KEY_BLOCK_SIZE); + this.state = 1608; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1607; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1610; + this.fileSizeLiteral(); + } + break; + case MySqlParser.KW_USING: + this.enterOuterAlt(localContext, 2); + { + this.state = 1611; + this.indexType(); + } + break; + case MySqlParser.KW_WITH: + this.enterOuterAlt(localContext, 3); + { + this.state = 1612; + this.match(MySqlParser.KW_WITH); + this.state = 1613; + this.match(MySqlParser.KW_PARSER); + this.state = 1614; + localContext._parserName = this.uid(); + } + break; + case MySqlParser.KW_COMMENT: + this.enterOuterAlt(localContext, 4); + { + this.state = 1615; + this.match(MySqlParser.KW_COMMENT); + this.state = 1616; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_VISIBLE: + this.enterOuterAlt(localContext, 5); + { + this.state = 1617; + _la = this.tokenStream.LA(1); + if (!(_la === 435 || _la === 686)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ENGINE_ATTRIBUTE: + this.enterOuterAlt(localContext, 6); + { + this.state = 1618; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 1620; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1619; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1622; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + this.enterOuterAlt(localContext, 7); + { + this.state = 1623; + this.match(MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE); + this.state = 1625; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1624; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1627; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + procedureParameter() { + let localContext = new ProcedureParameterContext(this.context, this.state); + this.enterRule(localContext, 74, MySqlParser.RULE_procedureParameter); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1631; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 80 || _la === 85 || _la === 126) { + { + this.state = 1630; + localContext._direction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 80 || _la === 85 || _la === 126)) { + localContext._direction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1633; + localContext._paramName = this.uid(); + this.state = 1634; + this.dataType(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + routineOption() { + let localContext = new RoutineOptionContext(this.context, this.state); + this.enterRule(localContext, 76, MySqlParser.RULE_routineOption); + let _la; + try { + this.state = 1659; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_COMMENT: + localContext = new RoutineCommentContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1636; + this.match(MySqlParser.KW_COMMENT); + this.state = 1637; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_LANGUAGE: + localContext = new RoutineLanguageContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1638; + this.match(MySqlParser.KW_LANGUAGE); + this.state = 1639; + this.match(MySqlParser.KW_SQL); + } + break; + case MySqlParser.KW_DETERMINISTIC: + case MySqlParser.KW_NOT: + localContext = new RoutineBehaviorContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1641; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 1640; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 1643; + this.match(MySqlParser.KW_DETERMINISTIC); + } + break; + case MySqlParser.KW_MODIFIES: + case MySqlParser.KW_READS: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_NO: + localContext = new RoutineDataContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 1654; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CONTAINS: + { + this.state = 1644; + this.match(MySqlParser.KW_CONTAINS); + this.state = 1645; + this.match(MySqlParser.KW_SQL); + } + break; + case MySqlParser.KW_NO: + { + this.state = 1646; + this.match(MySqlParser.KW_NO); + this.state = 1647; + this.match(MySqlParser.KW_SQL); + } + break; + case MySqlParser.KW_READS: + { + this.state = 1648; + this.match(MySqlParser.KW_READS); + this.state = 1649; + this.match(MySqlParser.KW_SQL); + this.state = 1650; + this.match(MySqlParser.KW_DATA); + } + break; + case MySqlParser.KW_MODIFIES: + { + this.state = 1651; + this.match(MySqlParser.KW_MODIFIES); + this.state = 1652; + this.match(MySqlParser.KW_SQL); + this.state = 1653; + this.match(MySqlParser.KW_DATA); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_SQL: + localContext = new RoutineSecurityContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 1656; + this.match(MySqlParser.KW_SQL); + this.state = 1657; + this.match(MySqlParser.KW_SECURITY); + this.state = 1658; + localContext._context = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 364 || _la === 436)) { + localContext._context = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + serverOption() { + let localContext = new ServerOptionContext(this.context, this.state); + this.enterRule(localContext, 78, MySqlParser.RULE_serverOption); + try { + this.state = 1675; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_HOST: + this.enterOuterAlt(localContext, 1); + { + this.state = 1661; + this.match(MySqlParser.KW_HOST); + this.state = 1662; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_DATABASE: + this.enterOuterAlt(localContext, 2); + { + this.state = 1663; + this.match(MySqlParser.KW_DATABASE); + this.state = 1664; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_USER: + this.enterOuterAlt(localContext, 3); + { + this.state = 1665; + this.match(MySqlParser.KW_USER); + this.state = 1666; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PASSWORD: + this.enterOuterAlt(localContext, 4); + { + this.state = 1667; + this.match(MySqlParser.KW_PASSWORD); + this.state = 1668; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_SOCKET: + this.enterOuterAlt(localContext, 5); + { + this.state = 1669; + this.match(MySqlParser.KW_SOCKET); + this.state = 1670; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_OWNER: + this.enterOuterAlt(localContext, 6); + { + this.state = 1671; + this.match(MySqlParser.KW_OWNER); + this.state = 1672; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PORT: + this.enterOuterAlt(localContext, 7); + { + this.state = 1673; + this.match(MySqlParser.KW_PORT); + this.state = 1674; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDefinitions() { + let localContext = new CreateDefinitionsContext(this.context, this.state); + this.enterRule(localContext, 80, MySqlParser.RULE_createDefinitions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1677; + this.match(MySqlParser.LR_BRACKET); + this.state = 1678; + this.createDefinition(); + this.state = 1683; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1679; + this.match(MySqlParser.COMMA); + this.state = 1680; + this.createDefinition(); + } + } + this.state = 1685; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1686; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDefinition() { + let localContext = new CreateDefinitionContext(this.context, this.state); + this.enterRule(localContext, 82, MySqlParser.RULE_createDefinition); + let _la; + try { + this.state = 1771; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 157, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1688; + this.columnNameCreate(); + this.state = 1689; + this.columnDefinition(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1691; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1693; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1692; + this.indexName(); + } + } + this.state = 1696; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1695; + this.indexType(); + } + } + this.state = 1698; + this.indexColumnNames(); + this.state = 1702; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1699; + this.indexOption(); + } + } + this.state = 1704; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1705; + _la = this.tokenStream.LA(1); + if (!(_la === 69 || _la === 161)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1707; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 1706; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1710; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1709; + this.indexName(); + } + } + this.state = 1712; + this.indexColumnNames(); + this.state = 1716; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1713; + this.indexOption(); + } + } + this.state = 1718; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1720; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1719; + this.constraintSymbol(); + } + } + this.state = 1722; + this.match(MySqlParser.KW_PRIMARY); + this.state = 1723; + this.match(MySqlParser.KW_KEY); + this.state = 1725; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1724; + this.indexType(); + } + } + this.state = 1727; + this.indexColumnNames(); + this.state = 1731; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1728; + this.indexOption(); + } + } + this.state = 1733; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 1735; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1734; + this.constraintSymbol(); + } + } + this.state = 1737; + this.match(MySqlParser.KW_UNIQUE); + this.state = 1739; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 1738; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1742; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1741; + this.indexName(); + } + } + this.state = 1745; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1744; + this.indexType(); + } + } + this.state = 1747; + this.indexColumnNames(); + this.state = 1751; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1748; + this.indexOption(); + } + } + this.state = 1753; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 1755; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1754; + this.constraintSymbol(); + } + } + this.state = 1757; + this.match(MySqlParser.KW_FOREIGN); + this.state = 1758; + this.match(MySqlParser.KW_KEY); + this.state = 1760; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1759; + this.indexName(); + } + } + this.state = 1762; + this.indexColumnNames(); + this.state = 1763; + this.referenceDefinition(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 1765; + this.match(MySqlParser.KW_CHECK); + this.state = 1766; + this.match(MySqlParser.LR_BRACKET); + this.state = 1767; + this.expression(0); + this.state = 1768; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 1770; + this.checkConstraintDefinition(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checkConstraintDefinition() { + let localContext = new CheckConstraintDefinitionContext(this.context, this.state); + this.enterRule(localContext, 84, MySqlParser.RULE_checkConstraintDefinition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1774; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1773; + this.constraintSymbol(); + } + } + this.state = 1776; + this.match(MySqlParser.KW_CHECK); + this.state = 1777; + this.match(MySqlParser.LR_BRACKET); + this.state = 1778; + this.expression(0); + this.state = 1779; + this.match(MySqlParser.RR_BRACKET); + this.state = 1784; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 160, this.context)) { + case 1: + { + this.state = 1781; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 1780; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 1783; + this.match(MySqlParser.KW_ENFORCED); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + constraintSymbol() { + let localContext = new ConstraintSymbolContext(this.context, this.state); + this.enterRule(localContext, 86, MySqlParser.RULE_constraintSymbol); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1786; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 1788; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 161, this.context)) { + case 1: + { + this.state = 1787; + localContext._symbol_ = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnDefinition() { + let localContext = new ColumnDefinitionContext(this.context, this.state); + this.enterRule(localContext, 88, MySqlParser.RULE_columnDefinition); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 1790; + this.dataType(); + this.state = 1794; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 162, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1791; + this.columnConstraint(); + } + } + } + this.state = 1796; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 162, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnConstraint() { + let localContext = new ColumnConstraintContext(this.context, this.state); + this.enterRule(localContext, 90, MySqlParser.RULE_columnConstraint); + let _la; + try { + this.state = 1840; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NOT: + case MySqlParser.KW_NULL_LITERAL: + case MySqlParser.NULL_SPEC_LITERAL: + localContext = new NullColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1797; + this.nullNotnull(); + } + break; + case MySqlParser.KW_DEFAULT: + localContext = new DefaultColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1798; + this.match(MySqlParser.KW_DEFAULT); + this.state = 1799; + this.defaultValue(); + } + break; + case MySqlParser.KW_VISIBLE: + localContext = new VisibilityColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1800; + this.match(MySqlParser.KW_VISIBLE); + } + break; + case MySqlParser.KW_INVISIBLE: + localContext = new InvisibilityColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 1801; + this.match(MySqlParser.KW_INVISIBLE); + } + break; + case MySqlParser.KW_ON: + case MySqlParser.KW_AUTO_INCREMENT: + localContext = new AutoIncrementColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 1806; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AUTO_INCREMENT: + { + this.state = 1802; + this.match(MySqlParser.KW_AUTO_INCREMENT); + } + break; + case MySqlParser.KW_ON: + { + this.state = 1803; + this.match(MySqlParser.KW_ON); + this.state = 1804; + this.match(MySqlParser.KW_UPDATE); + this.state = 1805; + this.currentTimestamp(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_KEY: + case MySqlParser.KW_PRIMARY: + localContext = new PrimaryKeyColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 1809; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 131) { + { + this.state = 1808; + this.match(MySqlParser.KW_PRIMARY); + } + } + this.state = 1811; + this.match(MySqlParser.KW_KEY); + } + break; + case MySqlParser.KW_UNIQUE: + localContext = new UniqueKeyColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 1812; + this.match(MySqlParser.KW_UNIQUE); + this.state = 1814; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 165, this.context)) { + case 1: + { + this.state = 1813; + this.match(MySqlParser.KW_KEY); + } + break; + } + } + break; + case MySqlParser.KW_COMMENT: + localContext = new CommentColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 1816; + this.match(MySqlParser.KW_COMMENT); + this.state = 1817; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_COLUMN_FORMAT: + localContext = new FormatColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 1818; + this.match(MySqlParser.KW_COLUMN_FORMAT); + this.state = 1819; + localContext._colformat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 374 || _la === 403)) { + localContext._colformat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_STORAGE: + localContext = new StorageColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 1820; + this.match(MySqlParser.KW_STORAGE); + this.state = 1821; + localContext._storageval = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 370 || _la === 802)) { + localContext._storageval = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_REFERENCES: + localContext = new ReferenceColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 1822; + this.referenceDefinition(); + } + break; + case MySqlParser.KW_COLLATE: + localContext = new CollateColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 1823; + this.match(MySqlParser.KW_COLLATE); + this.state = 1824; + this.collationName(); + } + break; + case MySqlParser.KW_AS: + case MySqlParser.KW_GENERATED: + localContext = new GeneratedColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 1827; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 71) { + { + this.state = 1825; + this.match(MySqlParser.KW_GENERATED); + this.state = 1826; + this.match(MySqlParser.KW_ALWAYS); + } + } + this.state = 1829; + this.match(MySqlParser.KW_AS); + this.state = 1830; + this.match(MySqlParser.LR_BRACKET); + this.state = 1831; + this.expression(0); + this.state = 1832; + this.match(MySqlParser.RR_BRACKET); + this.state = 1834; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 648 || _la === 685) { + { + this.state = 1833; + _la = this.tokenStream.LA(1); + if (!(_la === 648 || _la === 685)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + break; + case MySqlParser.KW_SERIAL: + localContext = new SerialDefaultColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 1836; + this.match(MySqlParser.KW_SERIAL); + this.state = 1837; + this.match(MySqlParser.KW_DEFAULT); + this.state = 1838; + this.match(MySqlParser.KW_VALUE); + } + break; + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CONSTRAINT: + localContext = new CheckExprContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 1839; + this.checkConstraintDefinition(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + referenceDefinition() { + let localContext = new ReferenceDefinitionContext(this.context, this.state); + this.enterRule(localContext, 92, MySqlParser.RULE_referenceDefinition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1842; + this.match(MySqlParser.KW_REFERENCES); + this.state = 1843; + this.tableName(); + this.state = 1845; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 169, this.context)) { + case 1: + { + this.state = 1844; + this.indexColumnNames(); + } + break; + } + this.state = 1849; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 110) { + { + this.state = 1847; + this.match(MySqlParser.KW_MATCH); + this.state = 1848; + localContext._matchType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 408 || _la === 526 || _la === 597)) { + localContext._matchType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1852; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 171, this.context)) { + case 1: + { + this.state = 1851; + this.referenceAction(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + referenceAction() { + let localContext = new ReferenceActionContext(this.context, this.state); + this.enterRule(localContext, 94, MySqlParser.RULE_referenceAction); + try { + this.state = 1870; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 174, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1854; + this.match(MySqlParser.KW_ON); + this.state = 1855; + this.match(MySqlParser.KW_DELETE); + this.state = 1856; + localContext._onDelete = this.referenceControlType(); + this.state = 1860; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 172, this.context)) { + case 1: + { + this.state = 1857; + this.match(MySqlParser.KW_ON); + this.state = 1858; + this.match(MySqlParser.KW_UPDATE); + this.state = 1859; + localContext._onUpdate = this.referenceControlType(); + } + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1862; + this.match(MySqlParser.KW_ON); + this.state = 1863; + this.match(MySqlParser.KW_UPDATE); + this.state = 1864; + localContext._onUpdate = this.referenceControlType(); + this.state = 1868; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 173, this.context)) { + case 1: + { + this.state = 1865; + this.match(MySqlParser.KW_ON); + this.state = 1866; + this.match(MySqlParser.KW_DELETE); + this.state = 1867; + localContext._onDelete = this.referenceControlType(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + referenceControlType() { + let localContext = new ReferenceControlTypeContext(this.context, this.state); + this.enterRule(localContext, 96, MySqlParser.RULE_referenceControlType); + try { + this.state = 1880; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 175, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1872; + this.match(MySqlParser.KW_RESTRICT); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1873; + this.match(MySqlParser.KW_CASCADE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1874; + this.match(MySqlParser.KW_SET); + this.state = 1875; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1876; + this.match(MySqlParser.KW_NO); + this.state = 1877; + this.match(MySqlParser.KW_ACTION); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 1878; + this.match(MySqlParser.KW_SET); + this.state = 1879; + this.match(MySqlParser.KW_DEFAULT); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableOption() { + let localContext = new TableOptionContext(this.context, this.state); + this.enterRule(localContext, 98, MySqlParser.RULE_tableOption); + let _la; + try { + this.state = 2067; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 213, this.context)) { + case 1: + localContext = new TableOptionEngineContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1882; + this.match(MySqlParser.KW_ENGINE); + this.state = 1884; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1883; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1887; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 177, this.context)) { + case 1: + { + this.state = 1886; + this.engineName(); + } + break; + } + } + break; + case 2: + localContext = new TableOptionEngineAttributeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1889; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 1891; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1890; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1893; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 3: + localContext = new TableOptionAutoextendSizeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1894; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 1896; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1895; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1898; + this.decimalLiteral(); + } + break; + case 4: + localContext = new TableOptionAutoIncrementContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 1899; + this.match(MySqlParser.KW_AUTO_INCREMENT); + this.state = 1901; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1900; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1903; + this.decimalLiteral(); + } + break; + case 5: + localContext = new TableOptionAverageContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 1904; + this.match(MySqlParser.KW_AVG_ROW_LENGTH); + this.state = 1906; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1905; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1908; + this.decimalLiteral(); + } + break; + case 6: + localContext = new TableOptionCharsetContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 1910; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1909; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1912; + this.charSet(); + this.state = 1914; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1913; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1918; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 1916; + this.charsetName(); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 1917; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 7: + localContext = new TableOptionChecksumContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 1920; + _la = this.tokenStream.LA(1); + if (!(_la === 329 || _la === 522)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1922; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1921; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1924; + localContext._boolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 8: + localContext = new TableOptionCollateContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 1926; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1925; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1928; + this.match(MySqlParser.KW_COLLATE); + this.state = 1930; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1929; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1932; + this.collationName(); + } + break; + case 9: + localContext = new TableOptionCommentContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 1933; + this.match(MySqlParser.KW_COMMENT); + this.state = 1935; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1934; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1937; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 10: + localContext = new TableOptionCompressionContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 1938; + this.match(MySqlParser.KW_COMPRESSION); + this.state = 1940; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1939; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1942; + _la = this.tokenStream.LA(1); + if (!(_la === 882 || _la === 889)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 11: + localContext = new TableOptionConnectionContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 1943; + this.match(MySqlParser.KW_CONNECTION); + this.state = 1945; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1944; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1947; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 12: + localContext = new TableOptionDataDirectoryContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 1948; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 360)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1949; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 1951; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1950; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1953; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 13: + localContext = new TableOptionDelayContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 1954; + this.match(MySqlParser.KW_DELAY_KEY_WRITE); + this.state = 1956; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1955; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1958; + localContext._boolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 14: + localContext = new TableOptionEncryptionContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 1959; + this.match(MySqlParser.KW_ENCRYPTION); + this.state = 1961; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1960; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1963; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 15: + localContext = new TableOptionPageCompressedContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 1964; + _la = this.tokenStream.LA(1); + if (!(_la === 523 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1966; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1965; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1968; + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 16: + localContext = new TableOptionPageCompressionLevelContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 1969; + _la = this.tokenStream.LA(1); + if (!(_la === 524 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1971; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1970; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1973; + this.decimalLiteral(); + } + break; + case 17: + localContext = new TableOptionEncryptionKeyIdContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 1974; + this.match(MySqlParser.KW_ENCRYPTION_KEY_ID); + this.state = 1976; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1975; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1978; + this.decimalLiteral(); + } + break; + case 18: + localContext = new TableOptionIndexDirectoryContext(localContext); + this.enterOuterAlt(localContext, 18); + { + this.state = 1979; + this.match(MySqlParser.KW_INDEX); + this.state = 1980; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 1982; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1981; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1984; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 19: + localContext = new TableOptionInsertMethodContext(localContext); + this.enterOuterAlt(localContext, 19); + { + this.state = 1985; + this.match(MySqlParser.KW_INSERT_METHOD); + this.state = 1987; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1986; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1989; + localContext._insertMethod = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 402 || _la === 445 || _la === 502)) { + localContext._insertMethod = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 20: + localContext = new TableOptionKeyBlockSizeContext(localContext); + this.enterOuterAlt(localContext, 20); + { + this.state = 1990; + this.match(MySqlParser.KW_KEY_BLOCK_SIZE); + this.state = 1992; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1991; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1994; + this.fileSizeLiteral(); + } + break; + case 21: + localContext = new TableOptionMaxRowsContext(localContext); + this.enterOuterAlt(localContext, 21); + { + this.state = 1995; + this.match(MySqlParser.KW_MAX_ROWS); + this.state = 1997; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1996; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1999; + this.decimalLiteral(); + } + break; + case 22: + localContext = new TableOptionMinRowsContext(localContext); + this.enterOuterAlt(localContext, 22); + { + this.state = 2000; + this.match(MySqlParser.KW_MIN_ROWS); + this.state = 2002; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2001; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2004; + this.decimalLiteral(); + } + break; + case 23: + localContext = new TableOptionPackKeysContext(localContext); + this.enterOuterAlt(localContext, 23); + { + this.state = 2005; + this.match(MySqlParser.KW_PACK_KEYS); + this.state = 2007; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2006; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2009; + localContext._extBoolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + localContext._extBoolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 24: + localContext = new TableOptionPasswordContext(localContext); + this.enterOuterAlt(localContext, 24); + { + this.state = 2010; + this.match(MySqlParser.KW_PASSWORD); + this.state = 2012; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2011; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2014; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 25: + localContext = new TableOptionRowFormatContext(localContext); + this.enterOuterAlt(localContext, 25); + { + this.state = 2015; + this.match(MySqlParser.KW_ROW_FORMAT); + this.state = 2017; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2016; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2019; + localContext._rowFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 342 || _la === 345 || _la === 374 || _la === 403 || _la === 554 || _la === 889)) { + localContext._rowFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 26: + localContext = new TableOptionStartTransactionContext(localContext); + this.enterOuterAlt(localContext, 26); + { + this.state = 2020; + this.match(MySqlParser.KW_START); + this.state = 2021; + this.match(MySqlParser.KW_TRANSACTION); + } + break; + case 27: + localContext = new TableOptionSecondaryEngineAttributeContext(localContext); + this.enterOuterAlt(localContext, 27); + { + this.state = 2022; + this.match(MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE); + this.state = 2024; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2023; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2026; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 28: + localContext = new TableOptionRecalculationContext(localContext); + this.enterOuterAlt(localContext, 28); + { + this.state = 2027; + this.match(MySqlParser.KW_STATS_AUTO_RECALC); + this.state = 2029; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2028; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2031; + localContext._extBoolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + localContext._extBoolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 29: + localContext = new TableOptionPersistentContext(localContext); + this.enterOuterAlt(localContext, 29); + { + this.state = 2032; + this.match(MySqlParser.KW_STATS_PERSISTENT); + this.state = 2034; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2033; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2036; + localContext._extBoolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + localContext._extBoolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 30: + localContext = new TableOptionSamplePageContext(localContext); + this.enterOuterAlt(localContext, 30); + { + this.state = 2037; + this.match(MySqlParser.KW_STATS_SAMPLE_PAGES); + this.state = 2039; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2038; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2043; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 2041; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 2042; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 31: + localContext = new TableOptionTablespaceContext(localContext); + this.enterOuterAlt(localContext, 31); + { + this.state = 2045; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 2046; + this.tablespaceName(); + this.state = 2048; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 210, this.context)) { + case 1: + { + this.state = 2047; + this.tablespaceStorage(); + } + break; + } + } + break; + case 32: + localContext = new TableOptionTableTypeContext(localContext); + this.enterOuterAlt(localContext, 32); + { + this.state = 2050; + this.match(MySqlParser.KW_TABLE_TYPE); + this.state = 2051; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2052; + this.tableType(); + } + break; + case 33: + localContext = new TableOptionTablespaceContext(localContext); + this.enterOuterAlt(localContext, 33); + { + this.state = 2053; + this.tablespaceStorage(); + } + break; + case 34: + localContext = new TableOptionTransactionalContext(localContext); + this.enterOuterAlt(localContext, 34); + { + this.state = 2054; + this.match(MySqlParser.KW_TRANSACTIONAL); + this.state = 2056; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2055; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2058; + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 35: + localContext = new TableOptionUnionContext(localContext); + this.enterOuterAlt(localContext, 35); + { + this.state = 2059; + this.match(MySqlParser.KW_UNION); + this.state = 2061; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2060; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2063; + this.match(MySqlParser.LR_BRACKET); + this.state = 2064; + this.tableNames(); + this.state = 2065; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableType() { + let localContext = new TableTypeContext(this.context, this.state); + this.enterRule(localContext, 100, MySqlParser.RULE_tableType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2069; + _la = this.tokenStream.LA(1); + if (!(_la === 494 || _la === 506)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablespaceStorage() { + let localContext = new TablespaceStorageContext(this.context, this.state); + this.enterRule(localContext, 102, MySqlParser.RULE_tablespaceStorage); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2071; + this.match(MySqlParser.KW_STORAGE); + this.state = 2072; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 370 || _la === 802)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinitions() { + let localContext = new PartitionDefinitionsContext(this.context, this.state); + this.enterRule(localContext, 104, MySqlParser.RULE_partitionDefinitions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2074; + this.match(MySqlParser.KW_PARTITION); + this.state = 2075; + this.match(MySqlParser.KW_BY); + this.state = 2076; + this.partitionFunctionDefinition(); + this.state = 2079; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 528) { + { + this.state = 2077; + this.match(MySqlParser.KW_PARTITIONS); + this.state = 2078; + localContext._count = this.decimalLiteral(); + } + } + this.state = 2088; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 652) { + { + this.state = 2081; + this.match(MySqlParser.KW_SUBPARTITION); + this.state = 2082; + this.match(MySqlParser.KW_BY); + this.state = 2083; + this.subpartitionFunctionDefinition(); + this.state = 2086; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 653) { + { + this.state = 2084; + this.match(MySqlParser.KW_SUBPARTITIONS); + this.state = 2085; + localContext._subCount = this.decimalLiteral(); + } + } + } + } + this.state = 2101; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 218, this.context)) { + case 1: + { + this.state = 2090; + this.match(MySqlParser.LR_BRACKET); + this.state = 2091; + this.partitionDefinition(); + this.state = 2096; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2092; + this.match(MySqlParser.COMMA); + this.state = 2093; + this.partitionDefinition(); + } + } + this.state = 2098; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2099; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionFunctionDefinition() { + let localContext = new PartitionFunctionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 106, MySqlParser.RULE_partitionFunctionDefinition); + let _la; + try { + this.state = 2149; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 225, this.context)) { + case 1: + localContext = new PartitionFunctionHashContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2104; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2103; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2106; + this.match(MySqlParser.KW_HASH); + this.state = 2107; + this.match(MySqlParser.LR_BRACKET); + this.state = 2108; + this.expression(0); + this.state = 2109; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + localContext = new PartitionFunctionKeyContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2112; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2111; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2114; + this.match(MySqlParser.KW_KEY); + this.state = 2118; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 2115; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2116; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2117; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 872 || _la === 873)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2120; + this.match(MySqlParser.LR_BRACKET); + this.state = 2122; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 222, this.context)) { + case 1: + { + this.state = 2121; + this.columnNames(); + } + break; + } + this.state = 2124; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 3: + localContext = new PartitionFunctionRangeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2125; + this.match(MySqlParser.KW_RANGE); + this.state = 2135; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LR_BRACKET: + { + this.state = 2126; + this.match(MySqlParser.LR_BRACKET); + this.state = 2127; + this.expression(0); + this.state = 2128; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_COLUMNS: + { + this.state = 2130; + this.match(MySqlParser.KW_COLUMNS); + this.state = 2131; + this.match(MySqlParser.LR_BRACKET); + this.state = 2132; + this.columnNames(); + this.state = 2133; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 4: + localContext = new PartitionFunctionListContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2137; + this.match(MySqlParser.KW_LIST); + this.state = 2147; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LR_BRACKET: + { + this.state = 2138; + this.match(MySqlParser.LR_BRACKET); + this.state = 2139; + this.expression(0); + this.state = 2140; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_COLUMNS: + { + this.state = 2142; + this.match(MySqlParser.KW_COLUMNS); + this.state = 2143; + this.match(MySqlParser.LR_BRACKET); + this.state = 2144; + this.columnNames(); + this.state = 2145; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + subpartitionFunctionDefinition() { + let localContext = new SubpartitionFunctionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 108, MySqlParser.RULE_subpartitionFunctionDefinition); + let _la; + try { + this.state = 2172; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 229, this.context)) { + case 1: + localContext = new SubPartitionFunctionHashContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2152; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2151; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2154; + this.match(MySqlParser.KW_HASH); + this.state = 2155; + this.match(MySqlParser.LR_BRACKET); + this.state = 2156; + this.expression(0); + this.state = 2157; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + localContext = new SubPartitionFunctionKeyContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2160; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2159; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2162; + this.match(MySqlParser.KW_KEY); + this.state = 2166; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 2163; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2164; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2165; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 872 || _la === 873)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2168; + this.match(MySqlParser.LR_BRACKET); + this.state = 2169; + this.columnNames(); + this.state = 2170; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinition() { + let localContext = new PartitionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 110, MySqlParser.RULE_partitionDefinition); + let _la; + try { + this.state = 2320; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 248, this.context)) { + case 1: + localContext = new PartitionComparisonContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2174; + this.match(MySqlParser.KW_PARTITION); + this.state = 2175; + this.partitionName(); + this.state = 2176; + this.match(MySqlParser.KW_VALUES); + this.state = 2177; + this.match(MySqlParser.KW_LESS); + this.state = 2178; + this.match(MySqlParser.KW_THAN); + this.state = 2179; + this.match(MySqlParser.LR_BRACKET); + this.state = 2180; + this.partitionDefinerAtom(); + this.state = 2185; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2181; + this.match(MySqlParser.COMMA); + this.state = 2182; + this.partitionDefinerAtom(); + } + } + this.state = 2187; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2188; + this.match(MySqlParser.RR_BRACKET); + this.state = 2192; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2189; + this.partitionOption(); + } + } + this.state = 2194; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2206; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2195; + this.match(MySqlParser.LR_BRACKET); + this.state = 2196; + this.subpartitionDefinition(); + this.state = 2201; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2197; + this.match(MySqlParser.COMMA); + this.state = 2198; + this.subpartitionDefinition(); + } + } + this.state = 2203; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2204; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 2: + localContext = new PartitionComparisonContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2208; + this.match(MySqlParser.KW_PARTITION); + this.state = 2209; + this.partitionName(); + this.state = 2210; + this.match(MySqlParser.KW_VALUES); + this.state = 2211; + this.match(MySqlParser.KW_LESS); + this.state = 2212; + this.match(MySqlParser.KW_THAN); + this.state = 2213; + this.partitionDefinerAtom(); + this.state = 2217; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2214; + this.partitionOption(); + } + } + this.state = 2219; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2231; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2220; + this.match(MySqlParser.LR_BRACKET); + this.state = 2221; + this.subpartitionDefinition(); + this.state = 2226; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2222; + this.match(MySqlParser.COMMA); + this.state = 2223; + this.subpartitionDefinition(); + } + } + this.state = 2228; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2229; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 3: + localContext = new PartitionListAtomContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2233; + this.match(MySqlParser.KW_PARTITION); + this.state = 2234; + this.partitionName(); + this.state = 2235; + this.match(MySqlParser.KW_VALUES); + this.state = 2236; + this.match(MySqlParser.KW_IN); + this.state = 2237; + this.match(MySqlParser.LR_BRACKET); + this.state = 2238; + this.partitionDefinerAtom(); + this.state = 2243; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2239; + this.match(MySqlParser.COMMA); + this.state = 2240; + this.partitionDefinerAtom(); + } + } + this.state = 2245; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2246; + this.match(MySqlParser.RR_BRACKET); + this.state = 2250; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2247; + this.partitionOption(); + } + } + this.state = 2252; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2264; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2253; + this.match(MySqlParser.LR_BRACKET); + this.state = 2254; + this.subpartitionDefinition(); + this.state = 2259; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2255; + this.match(MySqlParser.COMMA); + this.state = 2256; + this.subpartitionDefinition(); + } + } + this.state = 2261; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2262; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 4: + localContext = new PartitionListVectorContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2266; + this.match(MySqlParser.KW_PARTITION); + this.state = 2267; + this.partitionName(); + this.state = 2268; + this.match(MySqlParser.KW_VALUES); + this.state = 2269; + this.match(MySqlParser.KW_IN); + this.state = 2270; + this.match(MySqlParser.LR_BRACKET); + this.state = 2271; + this.partitionDefinerVector(); + this.state = 2276; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2272; + this.match(MySqlParser.COMMA); + this.state = 2273; + this.partitionDefinerVector(); + } + } + this.state = 2278; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2279; + this.match(MySqlParser.RR_BRACKET); + this.state = 2283; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2280; + this.partitionOption(); + } + } + this.state = 2285; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2286; + this.match(MySqlParser.LR_BRACKET); + this.state = 2287; + this.subpartitionDefinition(); + this.state = 2292; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2288; + this.match(MySqlParser.COMMA); + this.state = 2289; + this.subpartitionDefinition(); + } + } + this.state = 2294; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2295; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 5: + localContext = new PartitionSimpleContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2299; + this.match(MySqlParser.KW_PARTITION); + this.state = 2300; + this.partitionName(); + this.state = 2304; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2301; + this.partitionOption(); + } + } + this.state = 2306; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2318; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2307; + this.match(MySqlParser.LR_BRACKET); + this.state = 2308; + this.subpartitionDefinition(); + this.state = 2313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2309; + this.match(MySqlParser.COMMA); + this.state = 2310; + this.subpartitionDefinition(); + } + } + this.state = 2315; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2316; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinerAtom() { + let localContext = new PartitionDefinerAtomContext(this.context, this.state); + this.enterRule(localContext, 112, MySqlParser.RULE_partitionDefinerAtom); + try { + this.state = 2325; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 249, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 2322; + this.constant(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 2323; + this.expression(0); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 2324; + this.match(MySqlParser.KW_MAXVALUE); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinerVector() { + let localContext = new PartitionDefinerVectorContext(this.context, this.state); + this.enterRule(localContext, 114, MySqlParser.RULE_partitionDefinerVector); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2327; + this.match(MySqlParser.LR_BRACKET); + this.state = 2328; + this.partitionDefinerAtom(); + this.state = 2331; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 2329; + this.match(MySqlParser.COMMA); + this.state = 2330; + this.partitionDefinerAtom(); + } + } + this.state = 2333; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 868); + this.state = 2335; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + subpartitionDefinition() { + let localContext = new SubpartitionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 116, MySqlParser.RULE_subpartitionDefinition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2337; + this.match(MySqlParser.KW_SUBPARTITION); + this.state = 2338; + localContext._logicalName = this.uid(); + this.state = 2342; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2339; + this.partitionOption(); + } + } + this.state = 2344; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionOption() { + let localContext = new PartitionOptionContext(this.context, this.state); + this.enterRule(localContext, 118, MySqlParser.RULE_partitionOption); + let _la; + try { + this.state = 2393; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_STORAGE: + localContext = new PartitionOptionEngineContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2346; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 2345; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 2349; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 647) { + { + this.state = 2348; + this.match(MySqlParser.KW_STORAGE); + } + } + this.state = 2351; + this.match(MySqlParser.KW_ENGINE); + this.state = 2353; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2352; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2355; + this.engineName(); + } + break; + case MySqlParser.KW_COMMENT: + localContext = new PartitionOptionCommentContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2356; + this.match(MySqlParser.KW_COMMENT); + this.state = 2358; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2357; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2360; + localContext._comment = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_DATA: + localContext = new PartitionOptionDataDirectoryContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2361; + this.match(MySqlParser.KW_DATA); + this.state = 2362; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 2364; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2363; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2366; + localContext._dataDirectory = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_INDEX: + localContext = new PartitionOptionIndexDirectoryContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2367; + this.match(MySqlParser.KW_INDEX); + this.state = 2368; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 2370; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2369; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2372; + localContext._indexDirectory = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_MAX_ROWS: + localContext = new PartitionOptionMaxRowsContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2373; + this.match(MySqlParser.KW_MAX_ROWS); + this.state = 2375; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2374; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2377; + localContext._maxRows = this.decimalLiteral(); + } + break; + case MySqlParser.KW_MIN_ROWS: + localContext = new PartitionOptionMinRowsContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 2378; + this.match(MySqlParser.KW_MIN_ROWS); + this.state = 2380; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2379; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2382; + localContext._minRows = this.decimalLiteral(); + } + break; + case MySqlParser.KW_TABLESPACE: + localContext = new PartitionOptionTablespaceContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 2383; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 2385; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2384; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2387; + this.tablespaceName(); + } + break; + case MySqlParser.KW_NODEGROUP: + localContext = new PartitionOptionNodeGroupContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 2388; + this.match(MySqlParser.KW_NODEGROUP); + this.state = 2390; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2389; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2392; + localContext._nodegroup = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterDatabase() { + let localContext = new AlterDatabaseContext(this.context, this.state); + this.enterRule(localContext, 120, MySqlParser.RULE_alterDatabase); + let _la; + try { + this.state = 2413; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 265, this.context)) { + case 1: + localContext = new AlterSimpleDatabaseContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2395; + this.match(MySqlParser.KW_ALTER); + this.state = 2396; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2398; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 263, this.context)) { + case 1: + { + this.state = 2397; + this.databaseName(); + } + break; + } + this.state = 2401; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 2400; + this.createDatabaseOption(); + } + } + this.state = 2403; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 135 || _la === 224 || _la === 376 || _la === 823); + } + break; + case 2: + localContext = new AlterUpgradeNameContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2405; + this.match(MySqlParser.KW_ALTER); + this.state = 2406; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2407; + this.databaseName(); + this.state = 2408; + this.match(MySqlParser.KW_UPGRADE); + this.state = 2409; + this.match(MySqlParser.KW_DATA); + this.state = 2410; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 2411; + this.match(MySqlParser.KW_NAME); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterEvent() { + let localContext = new AlterEventContext(this.context, this.state); + this.enterRule(localContext, 122, MySqlParser.RULE_alterEvent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2415; + this.match(MySqlParser.KW_ALTER); + this.state = 2417; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 2416; + this.ownerStatement(); + } + } + this.state = 2419; + this.match(MySqlParser.KW_EVENT); + this.state = 2420; + localContext._event_name = this.fullId(); + this.state = 2424; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 267, this.context)) { + case 1: + { + this.state = 2421; + this.match(MySqlParser.KW_ON); + this.state = 2422; + this.match(MySqlParser.KW_SCHEDULE); + this.state = 2423; + this.scheduleExpression(); + } + break; + } + this.state = 2432; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 119) { + { + this.state = 2426; + this.match(MySqlParser.KW_ON); + this.state = 2427; + this.match(MySqlParser.KW_COMPLETION); + this.state = 2429; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 2428; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 2431; + this.match(MySqlParser.KW_PRESERVE); + } + } + this.state = 2437; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 270, this.context)) { + case 1: + { + this.state = 2434; + this.match(MySqlParser.KW_RENAME); + this.state = 2435; + this.match(MySqlParser.KW_TO); + this.state = 2436; + localContext._new_event_name = this.fullId(); + } + break; + } + this.state = 2440; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 2439; + this.enableType(); + } + } + this.state = 2444; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 2442; + this.match(MySqlParser.KW_COMMENT); + this.state = 2443; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 2448; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 273, this.context)) { + case 1: + { + this.state = 2446; + this.match(MySqlParser.KW_DO); + this.state = 2447; + this.routineBody(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterFunction() { + let localContext = new AlterFunctionContext(this.context, this.state); + this.enterRule(localContext, 124, MySqlParser.RULE_alterFunction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2450; + this.match(MySqlParser.KW_ALTER); + this.state = 2451; + this.match(MySqlParser.KW_FUNCTION); + this.state = 2452; + this.functionName(); + this.state = 2456; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 47 || ((((_la - 112)) & ~0x1F) === 0 && ((1 << (_la - 112)) & 16777221) !== 0) || _la === 162 || _la === 340 || _la === 354 || _la === 444 || _la === 502) { + { + { + this.state = 2453; + this.routineOption(); + } + } + this.state = 2458; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterInstance() { + let localContext = new AlterInstanceContext(this.context, this.state); + this.enterRule(localContext, 126, MySqlParser.RULE_alterInstance); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2459; + this.match(MySqlParser.KW_ALTER); + this.state = 2460; + this.match(MySqlParser.KW_INSTANCE); + this.state = 2461; + this.match(MySqlParser.KW_ROTATE); + this.state = 2462; + this.match(MySqlParser.KW_INNODB); + this.state = 2463; + this.match(MySqlParser.KW_MASTER); + this.state = 2464; + this.match(MySqlParser.KW_KEY); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterLogfileGroup() { + let localContext = new AlterLogfileGroupContext(this.context, this.state); + this.enterRule(localContext, 128, MySqlParser.RULE_alterLogfileGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2466; + this.match(MySqlParser.KW_ALTER); + this.state = 2467; + this.match(MySqlParser.KW_LOGFILE); + this.state = 2468; + this.match(MySqlParser.KW_GROUP); + this.state = 2469; + localContext._logfileGroupName = this.uid(); + this.state = 2470; + this.match(MySqlParser.KW_ADD); + this.state = 2471; + this.match(MySqlParser.KW_UNDOFILE); + this.state = 2472; + this.match(MySqlParser.STRING_LITERAL); + this.state = 2478; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 2473; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 2475; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2474; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2477; + this.fileSizeLiteral(); + } + } + this.state = 2481; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 2480; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 2483; + this.match(MySqlParser.KW_ENGINE); + this.state = 2485; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2484; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2487; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterProcedure() { + let localContext = new AlterProcedureContext(this.context, this.state); + this.enterRule(localContext, 130, MySqlParser.RULE_alterProcedure); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2489; + this.match(MySqlParser.KW_ALTER); + this.state = 2490; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 2491; + localContext._proc_name = this.fullId(); + this.state = 2495; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 47 || ((((_la - 112)) & ~0x1F) === 0 && ((1 << (_la - 112)) & 16777221) !== 0) || _la === 162 || _la === 340 || _la === 354 || _la === 444 || _la === 502) { + { + { + this.state = 2492; + this.routineOption(); + } + } + this.state = 2497; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterServer() { + let localContext = new AlterServerContext(this.context, this.state); + this.enterRule(localContext, 132, MySqlParser.RULE_alterServer); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2498; + this.match(MySqlParser.KW_ALTER); + this.state = 2499; + this.match(MySqlParser.KW_SERVER); + this.state = 2500; + localContext._serverName = this.uid(); + this.state = 2501; + this.match(MySqlParser.KW_OPTIONS); + this.state = 2502; + this.match(MySqlParser.LR_BRACKET); + this.state = 2503; + this.serverOption(); + this.state = 2508; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2504; + this.match(MySqlParser.COMMA); + this.state = 2505; + this.serverOption(); + } + } + this.state = 2510; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2511; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterTable() { + let localContext = new AlterTableContext(this.context, this.state); + this.enterRule(localContext, 134, MySqlParser.RULE_alterTable); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 2513; + this.match(MySqlParser.KW_ALTER); + this.state = 2514; + this.match(MySqlParser.KW_TABLE); + this.state = 2515; + this.tableName(); + this.state = 2524; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 282, this.context)) { + case 1: + { + this.state = 2516; + this.alterOption(); + this.state = 2521; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2517; + this.match(MySqlParser.COMMA); + this.state = 2518; + this.alterOption(); + } + } + this.state = 2523; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + this.state = 2533; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 284, this.context)) { + case 1: + { + this.state = 2526; + this.alterPartitionSpecification(); + this.state = 2530; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 283, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2527; + this.alterPartitionSpecification(); + } + } + } + this.state = 2532; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 283, this.context); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterTablespace() { + let localContext = new AlterTablespaceContext(this.context, this.state); + this.enterRule(localContext, 136, MySqlParser.RULE_alterTablespace); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2535; + this.match(MySqlParser.KW_ALTER); + this.state = 2537; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 2536; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 2539; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 2540; + this.tablespaceName(); + this.state = 2541; + _la = this.tokenStream.LA(1); + if (!(_la === 6 || _la === 51)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2542; + this.match(MySqlParser.KW_DATAFILE); + this.state = 2543; + this.match(MySqlParser.STRING_LITERAL); + this.state = 2549; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 2544; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 2546; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2545; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2548; + this.fileSizeLiteral(); + } + } + this.state = 2552; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 2551; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 2557; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 289, this.context)) { + case 1: + { + this.state = 2554; + this.match(MySqlParser.KW_RENAME); + this.state = 2555; + this.match(MySqlParser.KW_TO); + this.state = 2556; + this.tablespaceNameCreate(); + } + break; + } + this.state = 2564; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 314) { + { + this.state = 2559; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 2561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2560; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2563; + this.fileSizeLiteral(); + } + } + this.state = 2568; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 292, this.context)) { + case 1: + { + this.state = 2566; + this.match(MySqlParser.KW_SET); + this.state = 2567; + _la = this.tokenStream.LA(1); + if (!(_la === 5 || _la === 81)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 2575; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 376) { + { + this.state = 2570; + this.match(MySqlParser.KW_ENCRYPTION); + this.state = 2572; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2571; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2574; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 2582; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 380) { + { + this.state = 2577; + this.match(MySqlParser.KW_ENGINE); + this.state = 2579; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2578; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2581; + this.engineName(); + } + } + this.state = 2589; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 825) { + { + this.state = 2584; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 2586; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2585; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2588; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterView() { + let localContext = new AlterViewContext(this.context, this.state); + this.enterRule(localContext, 138, MySqlParser.RULE_alterView); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2591; + this.match(MySqlParser.KW_ALTER); + this.state = 2595; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 2592; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2593; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2594; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 486 || _la === 661 || _la === 670)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2598; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 2597; + this.ownerStatement(); + } + } + this.state = 2603; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 162) { + { + this.state = 2600; + this.match(MySqlParser.KW_SQL); + this.state = 2601; + this.match(MySqlParser.KW_SECURITY); + this.state = 2602; + localContext._secContext = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 364 || _la === 436)) { + localContext._secContext = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2605; + this.match(MySqlParser.KW_VIEW); + this.state = 2606; + this.viewName(); + this.state = 2611; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2607; + this.match(MySqlParser.LR_BRACKET); + this.state = 2608; + this.columnNames(); + this.state = 2609; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 2613; + this.match(MySqlParser.KW_AS); + this.state = 2614; + this.selectStatement(); + this.state = 2621; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 304, this.context)) { + case 1: + { + this.state = 2615; + this.match(MySqlParser.KW_WITH); + this.state = 2617; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 325 || _la === 450) { + { + this.state = 2616; + localContext._checkOpt = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 325 || _la === 450)) { + localContext._checkOpt = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2619; + this.match(MySqlParser.KW_CHECK); + this.state = 2620; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterOption() { + let localContext = new AlterOptionContext(this.context, this.state); + this.enterRule(localContext, 140, MySqlParser.RULE_alterOption); + let _la; + try { + let alternative; + this.state = 2887; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 348, this.context)) { + case 1: + localContext = new AlterByTableOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2623; + this.tableOption(); + this.state = 2630; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 306, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2625; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 2624; + this.match(MySqlParser.COMMA); + } + } + this.state = 2627; + this.tableOption(); + } + } + } + this.state = 2632; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 306, this.context); + } + } + break; + case 2: + localContext = new AlterByAddColumnContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2633; + this.match(MySqlParser.KW_ADD); + this.state = 2635; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 307, this.context)) { + case 1: + { + this.state = 2634; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2637; + this.columnName(); + this.state = 2638; + this.columnDefinition(); + this.state = 2642; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FIRST: + { + this.state = 2639; + this.match(MySqlParser.KW_FIRST); + } + break; + case MySqlParser.KW_AFTER: + { + this.state = 2640; + this.match(MySqlParser.KW_AFTER); + this.state = 2641; + this.columnName(); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ADD: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DO: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 3: + localContext = new AlterByAddColumnsContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2644; + this.match(MySqlParser.KW_ADD); + this.state = 2646; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 29) { + { + this.state = 2645; + this.match(MySqlParser.KW_COLUMN); + } + } + this.state = 2648; + this.match(MySqlParser.LR_BRACKET); + this.state = 2649; + this.columnName(); + this.state = 2650; + this.columnDefinition(); + this.state = 2657; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2651; + this.match(MySqlParser.COMMA); + this.state = 2652; + this.columnName(); + this.state = 2653; + this.columnDefinition(); + } + } + this.state = 2659; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2660; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 4: + localContext = new AlterByAddIndexContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2662; + this.match(MySqlParser.KW_ADD); + this.state = 2663; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2665; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2664; + this.indexName(); + } + } + this.state = 2668; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 2667; + this.indexType(); + } + } + this.state = 2670; + this.indexColumnNames(); + this.state = 2674; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 313, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2671; + this.indexOption(); + } + } + } + this.state = 2676; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 313, this.context); + } + } + break; + case 5: + localContext = new AlterByAddSpecialIndexContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2677; + this.match(MySqlParser.KW_ADD); + this.state = 2678; + _la = this.tokenStream.LA(1); + if (!(_la === 69 || _la === 161)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2680; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 2679; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2683; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2682; + this.indexName(); + } + } + this.state = 2685; + this.indexColumnNames(); + this.state = 2689; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 316, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2686; + this.indexOption(); + } + } + } + this.state = 2691; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 316, this.context); + } + } + break; + case 6: + localContext = new AlterByAddPrimaryKeyContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 2692; + this.match(MySqlParser.KW_ADD); + this.state = 2697; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 2693; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 2695; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 317, this.context)) { + case 1: + { + this.state = 2694; + localContext._symbol_ = this.uid(); + } + break; + } + } + } + this.state = 2699; + this.match(MySqlParser.KW_PRIMARY); + this.state = 2700; + this.match(MySqlParser.KW_KEY); + this.state = 2702; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 2701; + this.indexType(); + } + } + this.state = 2704; + this.indexColumnNames(); + this.state = 2708; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 320, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2705; + this.indexOption(); + } + } + } + this.state = 2710; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 320, this.context); + } + } + break; + case 7: + localContext = new AlterByAddUniqueKeyContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 2711; + this.match(MySqlParser.KW_ADD); + this.state = 2716; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 2712; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 2714; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2713; + localContext._symbol_ = this.uid(); + } + } + } + } + this.state = 2718; + this.match(MySqlParser.KW_UNIQUE); + this.state = 2720; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 2719; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2723; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2722; + this.indexName(); + } + } + this.state = 2726; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 2725; + this.indexType(); + } + } + this.state = 2728; + this.indexColumnNames(); + this.state = 2732; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 326, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2729; + this.indexOption(); + } + } + } + this.state = 2734; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 326, this.context); + } + } + break; + case 8: + localContext = new AlterByAddForeignKeyContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 2735; + this.match(MySqlParser.KW_ADD); + this.state = 2740; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 2736; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 2738; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2737; + localContext._symbol_ = this.uid(); + } + } + } + } + this.state = 2742; + this.match(MySqlParser.KW_FOREIGN); + this.state = 2743; + this.match(MySqlParser.KW_KEY); + this.state = 2745; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2744; + this.indexName(); + } + } + this.state = 2747; + this.indexColumnNames(); + this.state = 2748; + this.referenceDefinition(); + } + break; + case 9: + localContext = new AlterByAddCheckTableConstraintContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 2750; + this.match(MySqlParser.KW_ADD); + this.state = 2752; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 330, this.context)) { + case 1: + { + this.state = 2751; + this.checkConstraintDefinition(); + } + break; + } + } + break; + case 10: + localContext = new AlterByDropConstraintCheckContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 2754; + this.match(MySqlParser.KW_DROP); + this.state = 2755; + _la = this.tokenStream.LA(1); + if (!(_la === 27 || _la === 31)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2756; + localContext._symbol_ = this.uid(); + } + break; + case 11: + localContext = new AlterByAlterCheckTableConstraintContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 2757; + this.match(MySqlParser.KW_ALTER); + this.state = 2758; + _la = this.tokenStream.LA(1); + if (!(_la === 27 || _la === 31)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2759; + localContext._symbol_ = this.uid(); + this.state = 2761; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 2760; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 2764; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 57) { + { + this.state = 2763; + this.match(MySqlParser.KW_ENFORCED); + } + } + } + break; + case 12: + localContext = new AlterBySetAlgorithmContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 2766; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2768; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2767; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2770; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 357 || _la === 430 || _la === 434)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 13: + localContext = new AlterByAlterColumnDefaultContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 2771; + this.match(MySqlParser.KW_ALTER); + this.state = 2773; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 334, this.context)) { + case 1: + { + this.state = 2772; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2775; + this.columnName(); + this.state = 2783; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 335, this.context)) { + case 1: + { + this.state = 2776; + this.match(MySqlParser.KW_SET); + this.state = 2777; + this.match(MySqlParser.KW_DEFAULT); + this.state = 2778; + this.defaultValue(); + } + break; + case 2: + { + this.state = 2779; + this.match(MySqlParser.KW_SET); + this.state = 2780; + _la = this.tokenStream.LA(1); + if (!(_la === 435 || _la === 686)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 3: + { + this.state = 2781; + this.match(MySqlParser.KW_DROP); + this.state = 2782; + this.match(MySqlParser.KW_DEFAULT); + } + break; + } + } + break; + case 14: + localContext = new AlterByAlterIndexVisibilityContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 2785; + this.match(MySqlParser.KW_ALTER); + this.state = 2786; + this.match(MySqlParser.KW_INDEX); + this.state = 2787; + this.indexName(); + this.state = 2788; + _la = this.tokenStream.LA(1); + if (!(_la === 435 || _la === 686)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 15: + localContext = new AlterByChangeColumnContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 2790; + this.match(MySqlParser.KW_CHANGE); + this.state = 2792; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 336, this.context)) { + case 1: + { + this.state = 2791; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2794; + localContext._oldColumn = this.columnName(); + this.state = 2795; + localContext._newColumn = this.columnNameCreate(); + this.state = 2796; + this.columnDefinition(); + this.state = 2800; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FIRST: + { + this.state = 2797; + this.match(MySqlParser.KW_FIRST); + } + break; + case MySqlParser.KW_AFTER: + { + this.state = 2798; + this.match(MySqlParser.KW_AFTER); + this.state = 2799; + this.columnName(); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ADD: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DO: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 16: + localContext = new AlterByDefaultCharsetContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 2803; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 2802; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 2805; + this.match(MySqlParser.KW_CHARACTER); + this.state = 2806; + this.match(MySqlParser.KW_SET); + this.state = 2807; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2808; + this.charsetName(); + this.state = 2814; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 28) { + { + this.state = 2809; + this.match(MySqlParser.KW_COLLATE); + this.state = 2811; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2810; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2813; + this.collationName(); + } + } + } + break; + case 17: + localContext = new AlterByConvertCharsetContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 2816; + this.match(MySqlParser.KW_CONVERT); + this.state = 2817; + this.match(MySqlParser.KW_TO); + this.state = 2821; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CHARSET: + { + this.state = 2818; + this.match(MySqlParser.KW_CHARSET); + } + break; + case MySqlParser.KW_CHARACTER: + { + this.state = 2819; + this.match(MySqlParser.KW_CHARACTER); + this.state = 2820; + this.match(MySqlParser.KW_SET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 2823; + this.charsetName(); + this.state = 2826; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 28) { + { + this.state = 2824; + this.match(MySqlParser.KW_COLLATE); + this.state = 2825; + this.collationName(); + } + } + } + break; + case 18: + localContext = new AlterKeysContext(localContext); + this.enterOuterAlt(localContext, 18); + { + this.state = 2828; + _la = this.tokenStream.LA(1); + if (!(_la === 368 || _la === 375)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2829; + this.match(MySqlParser.KW_KEYS); + } + break; + case 19: + localContext = new AlterTablespaceOptionContext(localContext); + this.enterOuterAlt(localContext, 19); + { + this.state = 2830; + _la = this.tokenStream.LA(1); + if (!(_la === 369 || _la === 425)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2831; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case 20: + localContext = new AlterByDropColumnContext(localContext); + this.enterOuterAlt(localContext, 20); + { + this.state = 2832; + this.match(MySqlParser.KW_DROP); + this.state = 2834; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 343, this.context)) { + case 1: + { + this.state = 2833; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2836; + this.columnName(); + } + break; + case 21: + localContext = new AlterByDropIndexContext(localContext); + this.enterOuterAlt(localContext, 21); + { + this.state = 2837; + this.match(MySqlParser.KW_DROP); + this.state = 2838; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2839; + this.indexName(); + } + break; + case 22: + localContext = new AlterByDropPrimaryKeyContext(localContext); + this.enterOuterAlt(localContext, 22); + { + this.state = 2840; + this.match(MySqlParser.KW_DROP); + this.state = 2841; + this.match(MySqlParser.KW_PRIMARY); + this.state = 2842; + this.match(MySqlParser.KW_KEY); + } + break; + case 23: + localContext = new AlterByDropForeignKeyContext(localContext); + this.enterOuterAlt(localContext, 23); + { + this.state = 2843; + this.match(MySqlParser.KW_DROP); + this.state = 2844; + this.match(MySqlParser.KW_FOREIGN); + this.state = 2845; + this.match(MySqlParser.KW_KEY); + this.state = 2846; + localContext._fk_symbol = this.uid(); + } + break; + case 24: + localContext = new AlterByForceContext(localContext); + this.enterOuterAlt(localContext, 24); + { + this.state = 2847; + this.match(MySqlParser.KW_FORCE); + } + break; + case 25: + localContext = new AlterByLockContext(localContext); + this.enterOuterAlt(localContext, 25); + { + this.state = 2848; + this.match(MySqlParser.KW_LOCK); + this.state = 2850; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2849; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2852; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 389 || _la === 505 || _la === 595)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 26: + localContext = new AlterByModifyColumnContext(localContext); + this.enterOuterAlt(localContext, 26); + { + this.state = 2853; + this.match(MySqlParser.KW_MODIFY); + this.state = 2855; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 345, this.context)) { + case 1: + { + this.state = 2854; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2857; + this.columnName(); + this.state = 2858; + this.columnDefinition(); + this.state = 2862; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FIRST: + { + this.state = 2859; + this.match(MySqlParser.KW_FIRST); + } + break; + case MySqlParser.KW_AFTER: + { + this.state = 2860; + this.match(MySqlParser.KW_AFTER); + this.state = 2861; + this.columnName(); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ADD: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DO: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 27: + localContext = new AlterByOrderContext(localContext); + this.enterOuterAlt(localContext, 27); + { + this.state = 2864; + this.match(MySqlParser.KW_ORDER); + this.state = 2865; + this.match(MySqlParser.KW_BY); + this.state = 2866; + this.columnNames(); + } + break; + case 28: + localContext = new AlterByRenameColumnContext(localContext); + this.enterOuterAlt(localContext, 28); + { + this.state = 2867; + this.match(MySqlParser.KW_RENAME); + this.state = 2868; + this.match(MySqlParser.KW_COLUMN); + this.state = 2869; + localContext._olcdColumn = this.columnName(); + this.state = 2870; + this.match(MySqlParser.KW_TO); + this.state = 2871; + localContext._newColumn = this.columnNameCreate(); + } + break; + case 29: + localContext = new AlterByRenameIndexContext(localContext); + this.enterOuterAlt(localContext, 29); + { + this.state = 2873; + this.match(MySqlParser.KW_RENAME); + this.state = 2874; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2875; + this.indexName(); + this.state = 2876; + this.match(MySqlParser.KW_TO); + this.state = 2877; + this.indexNameCreate(); + } + break; + case 30: + localContext = new AlterByRenameContext(localContext); + this.enterOuterAlt(localContext, 30); + { + this.state = 2879; + this.match(MySqlParser.KW_RENAME); + this.state = 2881; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13 || _la === 176) { + { + this.state = 2880; + localContext._renameFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 13 || _la === 176)) { + localContext._renameFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2883; + this.tableNameCreate(); + } + break; + case 31: + localContext = new AlterByValidateContext(localContext); + this.enterOuterAlt(localContext, 31); + { + this.state = 2884; + _la = this.tokenStream.LA(1); + if (!(_la === 194 || _la === 690)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2885; + this.match(MySqlParser.KW_VALIDATION); + } + break; + case 32: + localContext = new AlterPartitionContext(localContext); + this.enterOuterAlt(localContext, 32); + { + this.state = 2886; + this.alterPartitionSpecification(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterPartitionSpecification() { + let localContext = new AlterPartitionSpecificationContext(this.context, this.state); + this.enterRule(localContext, 142, MySqlParser.RULE_alterPartitionSpecification); + let _la; + try { + this.state = 2987; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ADD: + localContext = new AlterByAddPartitionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2889; + this.match(MySqlParser.KW_ADD); + this.state = 2890; + this.match(MySqlParser.KW_PARTITION); + this.state = 2891; + this.match(MySqlParser.LR_BRACKET); + this.state = 2892; + this.partitionDefinition(); + this.state = 2897; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2893; + this.match(MySqlParser.COMMA); + this.state = 2894; + this.partitionDefinition(); + } + } + this.state = 2899; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2900; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_DROP: + localContext = new AlterByDropPartitionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2902; + this.match(MySqlParser.KW_DROP); + this.state = 2903; + this.match(MySqlParser.KW_PARTITION); + this.state = 2904; + this.partitionNames(); + } + break; + case MySqlParser.KW_DISCARD: + localContext = new AlterByDiscardPartitionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2905; + this.match(MySqlParser.KW_DISCARD); + this.state = 2906; + this.match(MySqlParser.KW_PARTITION); + this.state = 2909; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2907; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2908; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 2911; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case MySqlParser.KW_IMPORT: + localContext = new AlterByImportPartitionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2912; + this.match(MySqlParser.KW_IMPORT); + this.state = 2913; + this.match(MySqlParser.KW_PARTITION); + this.state = 2916; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2914; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2915; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 2918; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case MySqlParser.KW_TRUNCATE: + localContext = new AlterByTruncatePartitionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2919; + this.match(MySqlParser.KW_TRUNCATE); + this.state = 2920; + this.match(MySqlParser.KW_PARTITION); + this.state = 2923; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2921; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2922; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_COALESCE: + localContext = new AlterByCoalescePartitionContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 2925; + this.match(MySqlParser.KW_COALESCE); + this.state = 2926; + this.match(MySqlParser.KW_PARTITION); + this.state = 2927; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_REORGANIZE: + localContext = new AlterByReorganizePartitionContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 2928; + this.match(MySqlParser.KW_REORGANIZE); + this.state = 2929; + this.match(MySqlParser.KW_PARTITION); + this.state = 2930; + this.partitionNames(); + this.state = 2931; + this.match(MySqlParser.KW_INTO); + this.state = 2932; + this.match(MySqlParser.LR_BRACKET); + this.state = 2933; + this.partitionDefinition(); + this.state = 2938; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2934; + this.match(MySqlParser.COMMA); + this.state = 2935; + this.partitionDefinition(); + } + } + this.state = 2940; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2941; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_EXCHANGE: + localContext = new AlterByExchangePartitionContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 2943; + this.match(MySqlParser.KW_EXCHANGE); + this.state = 2944; + this.match(MySqlParser.KW_PARTITION); + this.state = 2945; + this.partitionName(); + this.state = 2946; + this.match(MySqlParser.KW_WITH); + this.state = 2947; + this.match(MySqlParser.KW_TABLE); + this.state = 2948; + this.tableName(); + this.state = 2951; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 354, this.context)) { + case 1: + { + this.state = 2949; + localContext._validationFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 194 || _la === 690)) { + localContext._validationFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2950; + this.match(MySqlParser.KW_VALIDATION); + } + break; + } + } + break; + case MySqlParser.KW_ANALYZE: + localContext = new AlterByAnalyzePartitionContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 2953; + this.match(MySqlParser.KW_ANALYZE); + this.state = 2954; + this.match(MySqlParser.KW_PARTITION); + this.state = 2957; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2955; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2956; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_CHECK: + localContext = new AlterByCheckPartitionContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 2959; + this.match(MySqlParser.KW_CHECK); + this.state = 2960; + this.match(MySqlParser.KW_PARTITION); + this.state = 2963; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2961; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2962; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_OPTIMIZE: + localContext = new AlterByOptimizePartitionContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 2965; + this.match(MySqlParser.KW_OPTIMIZE); + this.state = 2966; + this.match(MySqlParser.KW_PARTITION); + this.state = 2969; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2967; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2968; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_REBUILD: + localContext = new AlterByRebuildPartitionContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 2971; + this.match(MySqlParser.KW_REBUILD); + this.state = 2972; + this.match(MySqlParser.KW_PARTITION); + this.state = 2975; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2973; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2974; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_REPAIR: + localContext = new AlterByRepairPartitionContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 2977; + this.match(MySqlParser.KW_REPAIR); + this.state = 2978; + this.match(MySqlParser.KW_PARTITION); + this.state = 2981; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2979; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2980; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_REMOVE: + localContext = new AlterByRemovePartitioningContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 2983; + this.match(MySqlParser.KW_REMOVE); + this.state = 2984; + this.match(MySqlParser.KW_PARTITIONING); + } + break; + case MySqlParser.KW_UPGRADE: + localContext = new AlterByUpgradePartitioningContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 2985; + this.match(MySqlParser.KW_UPGRADE); + this.state = 2986; + this.match(MySqlParser.KW_PARTITIONING); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropDatabase() { + let localContext = new DropDatabaseContext(this.context, this.state); + this.enterRule(localContext, 144, MySqlParser.RULE_dropDatabase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2989; + this.match(MySqlParser.KW_DROP); + this.state = 2990; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2992; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 361, this.context)) { + case 1: + { + this.state = 2991; + this.ifExists(); + } + break; + } + this.state = 2994; + this.databaseName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropEvent() { + let localContext = new DropEventContext(this.context, this.state); + this.enterRule(localContext, 146, MySqlParser.RULE_dropEvent); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2996; + this.match(MySqlParser.KW_DROP); + this.state = 2997; + this.match(MySqlParser.KW_EVENT); + this.state = 2999; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 362, this.context)) { + case 1: + { + this.state = 2998; + this.ifExists(); + } + break; + } + this.state = 3001; + localContext._event_name = this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropIndex() { + let localContext = new DropIndexContext(this.context, this.state); + this.enterRule(localContext, 148, MySqlParser.RULE_dropIndex); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3003; + this.match(MySqlParser.KW_DROP); + this.state = 3004; + this.match(MySqlParser.KW_INDEX); + this.state = 3006; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 363, this.context)) { + case 1: + { + this.state = 3005; + localContext._intimeAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 508 || _la === 514)) { + localContext._intimeAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 3008; + this.indexName(); + this.state = 3009; + this.match(MySqlParser.KW_ON); + this.state = 3010; + this.tableName(); + this.state = 3023; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 367, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + this.state = 3021; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALGORITHM: + { + this.state = 3011; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 3013; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3012; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3015; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 357 || _la === 430)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_LOCK: + { + this.state = 3016; + this.match(MySqlParser.KW_LOCK); + this.state = 3018; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3017; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3020; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 389 || _la === 505 || _la === 595)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 3025; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 367, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropLogfileGroup() { + let localContext = new DropLogfileGroupContext(this.context, this.state); + this.enterRule(localContext, 150, MySqlParser.RULE_dropLogfileGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3026; + this.match(MySqlParser.KW_DROP); + this.state = 3027; + this.match(MySqlParser.KW_LOGFILE); + this.state = 3028; + this.match(MySqlParser.KW_GROUP); + this.state = 3029; + localContext._logfileGroupName = this.uid(); + this.state = 3030; + this.match(MySqlParser.KW_ENGINE); + this.state = 3032; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3031; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3034; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropProcedure() { + let localContext = new DropProcedureContext(this.context, this.state); + this.enterRule(localContext, 152, MySqlParser.RULE_dropProcedure); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3036; + this.match(MySqlParser.KW_DROP); + this.state = 3037; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 3039; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 369, this.context)) { + case 1: + { + this.state = 3038; + this.ifExists(); + } + break; + } + this.state = 3041; + localContext._sp_name = this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropFunction() { + let localContext = new DropFunctionContext(this.context, this.state); + this.enterRule(localContext, 154, MySqlParser.RULE_dropFunction); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3043; + this.match(MySqlParser.KW_DROP); + this.state = 3044; + this.match(MySqlParser.KW_FUNCTION); + this.state = 3046; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 370, this.context)) { + case 1: + { + this.state = 3045; + this.ifExists(); + } + break; + } + this.state = 3048; + this.functionName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropServer() { + let localContext = new DropServerContext(this.context, this.state); + this.enterRule(localContext, 156, MySqlParser.RULE_dropServer); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3050; + this.match(MySqlParser.KW_DROP); + this.state = 3051; + this.match(MySqlParser.KW_SERVER); + this.state = 3053; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 371, this.context)) { + case 1: + { + this.state = 3052; + this.ifExists(); + } + break; + } + this.state = 3055; + localContext._serverName = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropSpatial() { + let localContext = new DropSpatialContext(this.context, this.state); + this.enterRule(localContext, 158, MySqlParser.RULE_dropSpatial); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3057; + this.match(MySqlParser.KW_DROP); + this.state = 3058; + this.match(MySqlParser.KW_SPATIAL); + this.state = 3059; + this.match(MySqlParser.KW_REFERENCE); + this.state = 3060; + this.match(MySqlParser.KW_SYSTEM); + this.state = 3062; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 3061; + this.ifExists(); + } + } + this.state = 3064; + this.match(MySqlParser.DECIMAL_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropTable() { + let localContext = new DropTableContext(this.context, this.state); + this.enterRule(localContext, 160, MySqlParser.RULE_dropTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3066; + this.match(MySqlParser.KW_DROP); + this.state = 3068; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 3067; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 3070; + this.match(MySqlParser.KW_TABLE); + this.state = 3072; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 374, this.context)) { + case 1: + { + this.state = 3071; + this.ifExists(); + } + break; + } + this.state = 3074; + this.tableNames(); + this.state = 3076; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 22 || _la === 146) { + { + this.state = 3075; + localContext._dropType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 22 || _la === 146)) { + localContext._dropType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropTablespace() { + let localContext = new DropTablespaceContext(this.context, this.state); + this.enterRule(localContext, 162, MySqlParser.RULE_dropTablespace); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3078; + this.match(MySqlParser.KW_DROP); + this.state = 3080; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 3079; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 3082; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 3083; + this.tablespaceName(); + this.state = 3089; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 380) { + { + this.state = 3084; + this.match(MySqlParser.KW_ENGINE); + this.state = 3086; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3085; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3088; + this.engineName(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropTrigger() { + let localContext = new DropTriggerContext(this.context, this.state); + this.enterRule(localContext, 164, MySqlParser.RULE_dropTrigger); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3091; + this.match(MySqlParser.KW_DROP); + this.state = 3092; + this.match(MySqlParser.KW_TRIGGER); + this.state = 3094; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 379, this.context)) { + case 1: + { + this.state = 3093; + this.ifExists(); + } + break; + } + this.state = 3096; + localContext._trigger_name = this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropView() { + let localContext = new DropViewContext(this.context, this.state); + this.enterRule(localContext, 166, MySqlParser.RULE_dropView); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3098; + this.match(MySqlParser.KW_DROP); + this.state = 3099; + this.match(MySqlParser.KW_VIEW); + this.state = 3101; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 380, this.context)) { + case 1: + { + this.state = 3100; + this.ifExists(); + } + break; + } + this.state = 3103; + this.viewName(); + this.state = 3108; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3104; + this.match(MySqlParser.COMMA); + this.state = 3105; + this.viewName(); + } + } + this.state = 3110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3112; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 22 || _la === 146) { + { + this.state = 3111; + localContext._dropType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 22 || _la === 146)) { + localContext._dropType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropRole() { + let localContext = new DropRoleContext(this.context, this.state); + this.enterRule(localContext, 168, MySqlParser.RULE_dropRole); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3114; + this.match(MySqlParser.KW_DROP); + this.state = 3115; + this.match(MySqlParser.KW_ROLE); + this.state = 3117; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 383, this.context)) { + case 1: + { + this.state = 3116; + this.ifExists(); + } + break; + } + this.state = 3119; + this.userOrRoleNames(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setRole() { + let localContext = new SetRoleContext(this.context, this.state); + this.enterRule(localContext, 170, MySqlParser.RULE_setRole); + let _la; + try { + this.state = 3141; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 386, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3121; + this.match(MySqlParser.KW_SET); + this.state = 3122; + this.match(MySqlParser.KW_DEFAULT); + this.state = 3123; + this.match(MySqlParser.KW_ROLE); + this.state = 3127; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 384, this.context)) { + case 1: + { + this.state = 3124; + this.match(MySqlParser.KW_NONE); + } + break; + case 2: + { + this.state = 3125; + this.match(MySqlParser.KW_ALL); + } + break; + case 3: + { + this.state = 3126; + this.userOrRoleNames(); + } + break; + } + this.state = 3129; + this.match(MySqlParser.KW_TO); + { + this.state = 3130; + this.userOrRoleName(); + } + this.state = 3135; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3131; + this.match(MySqlParser.COMMA); + { + this.state = 3132; + this.userOrRoleName(); + } + } + } + this.state = 3137; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3138; + this.match(MySqlParser.KW_SET); + this.state = 3139; + this.match(MySqlParser.KW_ROLE); + this.state = 3140; + this.roleOption(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameTable() { + let localContext = new RenameTableContext(this.context, this.state); + this.enterRule(localContext, 172, MySqlParser.RULE_renameTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3143; + this.match(MySqlParser.KW_RENAME); + this.state = 3144; + this.match(MySqlParser.KW_TABLE); + this.state = 3145; + this.renameTableClause(); + this.state = 3150; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3146; + this.match(MySqlParser.COMMA); + this.state = 3147; + this.renameTableClause(); + } + } + this.state = 3152; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameTableClause() { + let localContext = new RenameTableClauseContext(this.context, this.state); + this.enterRule(localContext, 174, MySqlParser.RULE_renameTableClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3153; + this.tableName(); + this.state = 3154; + this.match(MySqlParser.KW_TO); + this.state = 3155; + this.tableNameCreate(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + truncateTable() { + let localContext = new TruncateTableContext(this.context, this.state); + this.enterRule(localContext, 176, MySqlParser.RULE_truncateTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3157; + this.match(MySqlParser.KW_TRUNCATE); + this.state = 3159; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 173) { + { + this.state = 3158; + this.match(MySqlParser.KW_TABLE); + } + } + this.state = 3161; + this.tableName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + callStatement() { + let localContext = new CallStatementContext(this.context, this.state); + this.enterRule(localContext, 178, MySqlParser.RULE_callStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3163; + this.match(MySqlParser.KW_CALL); + this.state = 3164; + localContext._sp_name = this.fullId(); + this.state = 3171; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 390, this.context)) { + case 1: + { + this.state = 3165; + this.match(MySqlParser.LR_BRACKET); + this.state = 3168; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 389, this.context)) { + case 1: + { + this.state = 3166; + this.constants(); + } + break; + case 2: + { + this.state = 3167; + this.expressions(); + } + break; + } + this.state = 3170; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + deleteStatement() { + let localContext = new DeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 180, MySqlParser.RULE_deleteStatement); + try { + this.state = 3175; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 391, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3173; + this.singleDeleteStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3174; + this.multipleDeleteStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + doStatement() { + let localContext = new DoStatementContext(this.context, this.state); + this.enterRule(localContext, 182, MySqlParser.RULE_doStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3177; + this.match(MySqlParser.KW_DO); + this.state = 3178; + this.expressions(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerStatement() { + let localContext = new HandlerStatementContext(this.context, this.state); + this.enterRule(localContext, 184, MySqlParser.RULE_handlerStatement); + try { + this.state = 3184; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 392, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3180; + this.handlerOpenStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3181; + this.handlerReadIndexStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 3182; + this.handlerReadStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 3183; + this.handlerCloseStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + insertStatement() { + let localContext = new InsertStatementContext(this.context, this.state); + this.enterRule(localContext, 186, MySqlParser.RULE_insertStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3186; + this.match(MySqlParser.KW_INSERT); + this.state = 3188; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 43 || _la === 76 || _la === 107) { + { + this.state = 3187; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 43 || _la === 76 || _la === 107)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3191; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3190; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3194; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3193; + this.match(MySqlParser.KW_INTO); + } + } + this.state = 3196; + this.tableName(); + this.state = 3203; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3197; + this.match(MySqlParser.KW_PARTITION); + this.state = 3198; + this.match(MySqlParser.LR_BRACKET); + this.state = 3200; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 3199; + this.partitionNames(); + } + } + this.state = 3202; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3216; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 401, this.context)) { + case 1: + { + this.state = 3206; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 398, this.context)) { + case 1: + { + this.state = 3205; + this.fullColumnNames(); + } + break; + } + this.state = 3210; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 399, this.context)) { + case 1: + { + this.state = 3208; + this.valuesOrValueList(); + } + break; + case 2: + { + this.state = 3209; + this.selectOrTableOrValues(); + } + break; + } + this.state = 3213; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 400, this.context)) { + case 1: + { + this.state = 3212; + this.asRowAlias(); + } + break; + } + } + break; + case 2: + { + this.state = 3215; + this.setAssignmentList(); + } + break; + } + this.state = 3219; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3218; + this.asRowAlias(); + } + } + this.state = 3233; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 119) { + { + this.state = 3221; + this.match(MySqlParser.KW_ON); + this.state = 3222; + this.match(MySqlParser.KW_DUPLICATE); + this.state = 3223; + this.match(MySqlParser.KW_KEY); + this.state = 3224; + this.match(MySqlParser.KW_UPDATE); + this.state = 3225; + localContext._duplicatedFirst = this.updatedElement(); + this.state = 3230; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3226; + this.match(MySqlParser.COMMA); + this.state = 3227; + localContext._updatedElement = this.updatedElement(); + localContext._duplicatedElements.push(localContext._updatedElement); + } + } + this.state = 3232; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + asRowAlias() { + let localContext = new AsRowAliasContext(this.context, this.state); + this.enterRule(localContext, 188, MySqlParser.RULE_asRowAlias); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3235; + this.match(MySqlParser.KW_AS); + this.state = 3236; + localContext._rowAlias = this.uid(); + this.state = 3238; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 405, this.context)) { + case 1: + { + this.state = 3237; + this.fullColumnNames(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectOrTableOrValues() { + let localContext = new SelectOrTableOrValuesContext(this.context, this.state); + this.enterRule(localContext, 190, MySqlParser.RULE_selectOrTableOrValues); + try { + this.state = 3244; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.LR_BRACKET: + this.enterOuterAlt(localContext, 1); + { + this.state = 3240; + this.selectStatement(); + } + break; + case MySqlParser.KW_TABLE: + this.enterOuterAlt(localContext, 2); + { + this.state = 3241; + this.match(MySqlParser.KW_TABLE); + this.state = 3242; + this.tableName(); + } + break; + case MySqlParser.KW_VALUES: + this.enterOuterAlt(localContext, 3); + { + this.state = 3243; + this.rowValuesList(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + interSectStatement() { + let localContext = new InterSectStatementContext(this.context, this.state); + this.enterRule(localContext, 192, MySqlParser.RULE_interSectStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3246; + this.interSectQuery(); + this.state = 3252; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 3247; + this.match(MySqlParser.KW_INTERSECT); + this.state = 3249; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3248; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3251; + this.interSectQuery(); + } + } + this.state = 3254; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 828); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + interSectQuery() { + let localContext = new InterSectQueryContext(this.context, this.state); + this.enterRule(localContext, 194, MySqlParser.RULE_interSectQuery); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3257; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 3256; + this.match(MySqlParser.LR_BRACKET); + } + } + this.state = 3259; + this.querySpecification(); + this.state = 3261; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 410, this.context)) { + case 1: + { + this.state = 3260; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadDataStatement() { + let localContext = new LoadDataStatementContext(this.context, this.state); + this.enterRule(localContext, 196, MySqlParser.RULE_loadDataStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3263; + this.match(MySqlParser.KW_LOAD); + this.state = 3264; + this.match(MySqlParser.KW_DATA); + this.state = 3266; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107 || _la === 347) { + { + this.state = 3265; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 107 || _la === 347)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3269; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 450) { + { + this.state = 3268; + this.match(MySqlParser.KW_LOCAL); + } + } + this.state = 3271; + this.match(MySqlParser.KW_INFILE); + this.state = 3272; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + this.state = 3274; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79 || _la === 143) { + { + this.state = 3273; + localContext._violation = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 79 || _la === 143)) { + localContext._violation = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3276; + this.match(MySqlParser.KW_INTO); + this.state = 3277; + this.match(MySqlParser.KW_TABLE); + this.state = 3278; + this.tableName(); + this.state = 3284; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3279; + this.match(MySqlParser.KW_PARTITION); + this.state = 3280; + this.match(MySqlParser.LR_BRACKET); + this.state = 3281; + this.partitionNames(); + this.state = 3282; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3289; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26) { + { + this.state = 3286; + this.match(MySqlParser.KW_CHARACTER); + this.state = 3287; + this.match(MySqlParser.KW_SET); + this.state = 3288; + localContext._charset = this.charsetName(); + } + } + this.state = 3297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 337 || _la === 398) { + { + this.state = 3291; + localContext._fieldsFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 337 || _la === 398)) { + localContext._fieldsFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3293; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 3292; + this.selectFieldsInto(); + } + } + this.state = 3295; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 56 || _la === 58 || _la === 123 || _la === 174); + } + } + this.state = 3305; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 102) { + { + this.state = 3299; + this.match(MySqlParser.KW_LINES); + this.state = 3301; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 3300; + this.selectLinesInto(); + } + } + this.state = 3303; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 171 || _la === 174); + } + } + this.state = 3311; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3307; + this.match(MySqlParser.KW_IGNORE); + this.state = 3308; + this.decimalLiteral(); + this.state = 3309; + localContext._linesFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 102 || _la === 587)) { + localContext._linesFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3324; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 422, this.context)) { + case 1: + { + this.state = 3313; + this.match(MySqlParser.LR_BRACKET); + this.state = 3314; + this.assignmentField(); + this.state = 3319; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3315; + this.match(MySqlParser.COMMA); + this.state = 3316; + this.assignmentField(); + } + } + this.state = 3321; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3322; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3335; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 424, this.context)) { + case 1: + { + this.state = 3326; + this.match(MySqlParser.KW_SET); + this.state = 3327; + this.updatedElement(); + this.state = 3332; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3328; + this.match(MySqlParser.COMMA); + this.state = 3329; + this.updatedElement(); + } + } + this.state = 3334; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadXmlStatement() { + let localContext = new LoadXmlStatementContext(this.context, this.state); + this.enterRule(localContext, 198, MySqlParser.RULE_loadXmlStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3337; + this.match(MySqlParser.KW_LOAD); + this.state = 3338; + this.match(MySqlParser.KW_XML); + this.state = 3340; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107 || _la === 347) { + { + this.state = 3339; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 107 || _la === 347)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3343; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 450) { + { + this.state = 3342; + this.match(MySqlParser.KW_LOCAL); + } + } + this.state = 3345; + this.match(MySqlParser.KW_INFILE); + this.state = 3346; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + this.state = 3348; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79 || _la === 143) { + { + this.state = 3347; + localContext._violation = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 79 || _la === 143)) { + localContext._violation = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3350; + this.match(MySqlParser.KW_INTO); + this.state = 3351; + this.match(MySqlParser.KW_TABLE); + this.state = 3352; + this.tableName(); + this.state = 3356; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26) { + { + this.state = 3353; + this.match(MySqlParser.KW_CHARACTER); + this.state = 3354; + this.match(MySqlParser.KW_SET); + this.state = 3355; + localContext._charset = this.charsetName(); + } + } + this.state = 3368; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 587) { + { + this.state = 3358; + this.match(MySqlParser.KW_ROWS); + this.state = 3359; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 3360; + this.match(MySqlParser.KW_BY); + this.state = 3362; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 859) { + { + this.state = 3361; + this.match(MySqlParser.LESS_SYMBOL); + } + } + this.state = 3364; + localContext._tag = this.match(MySqlParser.STRING_LITERAL); + this.state = 3366; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 858) { + { + this.state = 3365; + this.match(MySqlParser.GREATER_SYMBOL); + } + } + } + } + this.state = 3374; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3370; + this.match(MySqlParser.KW_IGNORE); + this.state = 3371; + this.decimalLiteral(); + this.state = 3372; + localContext._linesFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 102 || _la === 587)) { + localContext._linesFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3387; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 434, this.context)) { + case 1: + { + this.state = 3376; + this.match(MySqlParser.LR_BRACKET); + this.state = 3377; + this.assignmentField(); + this.state = 3382; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3378; + this.match(MySqlParser.COMMA); + this.state = 3379; + this.assignmentField(); + } + } + this.state = 3384; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3385; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3398; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 436, this.context)) { + case 1: + { + this.state = 3389; + this.match(MySqlParser.KW_SET); + this.state = 3390; + this.updatedElement(); + this.state = 3395; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3391; + this.match(MySqlParser.COMMA); + this.state = 3392; + this.updatedElement(); + } + } + this.state = 3397; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + parenthesizedQuery() { + let localContext = new ParenthesizedQueryContext(this.context, this.state); + this.enterRule(localContext, 200, MySqlParser.RULE_parenthesizedQuery); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3400; + this.match(MySqlParser.LR_BRACKET); + this.state = 3401; + this.parenthesizedQueryExpression(); + this.state = 3403; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3402; + this.orderByClause(); + } + } + this.state = 3406; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3405; + this.limitClause(); + } + } + this.state = 3408; + this.match(MySqlParser.RR_BRACKET); + this.state = 3410; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3409; + this.orderByClause(); + } + } + this.state = 3413; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3412; + this.limitClause(); + } + } + this.state = 3416; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3415; + this.intoClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replaceStatement() { + let localContext = new ReplaceStatementContext(this.context, this.state); + this.enterRule(localContext, 202, MySqlParser.RULE_replaceStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3418; + this.match(MySqlParser.KW_REPLACE); + this.state = 3420; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 43 || _la === 107) { + { + this.state = 3419; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 43 || _la === 107)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3423; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3422; + this.match(MySqlParser.KW_INTO); + } + } + this.state = 3425; + this.tableName(); + this.state = 3431; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3426; + this.match(MySqlParser.KW_PARTITION); + this.state = 3427; + this.match(MySqlParser.LR_BRACKET); + this.state = 3428; + this.partitionNames(); + this.state = 3429; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3441; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_VALUE: + case MySqlParser.LR_BRACKET: + { + this.state = 3437; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 445, this.context)) { + case 1: + { + this.state = 3433; + this.match(MySqlParser.LR_BRACKET); + this.state = 3434; + this.columnNames(); + this.state = 3435; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3439; + this.replaceStatementValuesOrSelectOrTable(); + } + break; + case MySqlParser.KW_SET: + { + this.state = 3440; + this.setAssignmentList(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectStatement() { + let localContext = new SelectStatementContext(this.context, this.state); + this.enterRule(localContext, 204, MySqlParser.RULE_selectStatement); + let _la; + try { + let alternative; + this.state = 3502; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + localContext = new UnionAndLateralSelectContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3443; + this.querySpecification(); + this.state = 3447; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 447, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3444; + this.unionStatement(); + } + } + } + this.state = 3449; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 447, this.context); + } + this.state = 3458; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 450, this.context)) { + case 1: + { + this.state = 3450; + this.match(MySqlParser.KW_UNION); + this.state = 3452; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3451; + localContext._unionType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._unionType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3456; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + { + this.state = 3454; + this.querySpecification(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 3455; + this.queryExpression(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + } + this.state = 3464; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 451, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3460; + this.match(MySqlParser.COMMA); + this.state = 3461; + this.lateralStatement(); + } + } + } + this.state = 3466; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 451, this.context); + } + this.state = 3468; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 452, this.context)) { + case 1: + { + this.state = 3467; + this.orderByClause(); + } + break; + } + this.state = 3471; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 453, this.context)) { + case 1: + { + this.state = 3470; + this.limitClause(); + } + break; + } + this.state = 3474; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 454, this.context)) { + case 1: + { + this.state = 3473; + this.lockClause(); + } + break; + } + this.state = 3477; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 455, this.context)) { + case 1: + { + this.state = 3476; + this.intoClause(); + } + break; + } + } + break; + case MySqlParser.LR_BRACKET: + localContext = new SelectExpressionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3479; + this.queryExpression(); + this.state = 3483; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 456, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3480; + this.unionStatement(); + } + } + } + this.state = 3485; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 456, this.context); + } + this.state = 3491; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 458, this.context)) { + case 1: + { + this.state = 3486; + this.match(MySqlParser.KW_UNION); + this.state = 3488; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3487; + localContext._unionType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._unionType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3490; + this.queryExpression(); + } + break; + } + this.state = 3494; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 459, this.context)) { + case 1: + { + this.state = 3493; + this.orderByClause(); + } + break; + } + this.state = 3497; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 460, this.context)) { + case 1: + { + this.state = 3496; + this.limitClause(); + } + break; + } + this.state = 3500; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 461, this.context)) { + case 1: + { + this.state = 3499; + this.lockClause(); + } + break; + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setOperations() { + let localContext = new SetOperationsContext(this.context, this.state); + this.enterRule(localContext, 206, MySqlParser.RULE_setOperations); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3505; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 3504; + this.withClause(); + } + } + this.state = 3507; + this.queryExpressionBody(0); + this.state = 3509; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3508; + this.orderByClause(); + } + } + this.state = 3512; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3511; + this.limitClause(); + } + } + this.state = 3515; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3514; + this.intoClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + queryExpressionBody(_p) { + if (_p === undefined) { + _p = 0; + } + let parentContext = this.context; + let parentState = this.state; + let localContext = new QueryExpressionBodyContext(this.context, parentState); + let previousContext = localContext; + let _startState = 208; + this.enterRecursionRule(localContext, 208, MySqlParser.RULE_queryExpressionBody, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + { + this.state = 3518; + this.queryItem(0); + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 3534; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 470, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 3532; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 469, this.context)) { + case 1: + { + localContext = new QueryExpressionBodyContext(parentContext, parentState); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_queryExpressionBody); + this.state = 3520; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 3521; + this.match(MySqlParser.KW_UNION); + this.state = 3523; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3522; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3525; + this.queryItem(0); + } + break; + case 2: + { + localContext = new QueryExpressionBodyContext(parentContext, parentState); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_queryExpressionBody); + this.state = 3526; + if (!(this.precpred(this.context, 1))) { + throw this.createFailedPredicateException("this.precpred(this.context, 1)"); + } + this.state = 3527; + this.match(MySqlParser.KW_EXCEPT); + this.state = 3529; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3528; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3531; + this.queryItem(0); + } + break; + } + } + } + this.state = 3536; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 470, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + queryItem(_p) { + if (_p === undefined) { + _p = 0; + } + let parentContext = this.context; + let parentState = this.state; + let localContext = new QueryItemContext(this.context, parentState); + let previousContext = localContext; + let _startState = 210; + this.enterRecursionRule(localContext, 210, MySqlParser.RULE_queryItem, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + { + this.state = 3538; + this.queryPrimary(); + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 3548; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 472, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + { + localContext = new QueryItemContext(parentContext, parentState); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_queryItem); + this.state = 3540; + if (!(this.precpred(this.context, 1))) { + throw this.createFailedPredicateException("this.precpred(this.context, 1)"); + } + this.state = 3541; + this.match(MySqlParser.KW_INTERSECT); + this.state = 3543; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3542; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3545; + this.queryPrimary(); + } + } + } + this.state = 3550; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 472, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + queryPrimary() { + let localContext = new QueryPrimaryContext(this.context, this.state); + this.enterRule(localContext, 212, MySqlParser.RULE_queryPrimary); + let _la; + try { + this.state = 3565; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 476, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3551; + this.queryBlock(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3552; + this.match(MySqlParser.LR_BRACKET); + this.state = 3553; + this.queryExpressionBody(0); + this.state = 3555; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3554; + this.orderByClause(); + } + } + this.state = 3558; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3557; + this.limitClause(); + } + } + this.state = 3561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3560; + this.intoClause(); + } + } + this.state = 3563; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + updateStatement() { + let localContext = new UpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 214, MySqlParser.RULE_updateStatement); + try { + this.state = 3569; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 477, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3567; + this.singleUpdateStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3568; + this.multipleUpdateStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + valuesStatement() { + let localContext = new ValuesStatementContext(this.context, this.state); + this.enterRule(localContext, 216, MySqlParser.RULE_valuesStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3571; + this.rowValuesList(); + this.state = 3575; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 478, this.context)) { + case 1: + { + this.state = 3572; + this.match(MySqlParser.KW_ORDER); + this.state = 3573; + this.match(MySqlParser.KW_BY); + this.state = 3574; + this.indexColumnName(); + } + break; + } + this.state = 3579; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 479, this.context)) { + case 1: + { + this.state = 3577; + this.match(MySqlParser.KW_LIMIT); + this.state = 3578; + this.limitClauseAtom(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + parenthesizedQueryExpression() { + let localContext = new ParenthesizedQueryExpressionContext(this.context, this.state); + this.enterRule(localContext, 218, MySqlParser.RULE_parenthesizedQueryExpression); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3581; + this.queryBlock(); + this.state = 3586; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 59 || _la === 181 || _la === 828) { + { + { + this.state = 3582; + _la = this.tokenStream.LA(1); + if (!(_la === 59 || _la === 181 || _la === 828)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3583; + this.queryBlock(); + } + } + this.state = 3588; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3590; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 481, this.context)) { + case 1: + { + this.state = 3589; + this.orderByClause(); + } + break; + } + this.state = 3593; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 482, this.context)) { + case 1: + { + this.state = 3592; + this.limitClause(); + } + break; + } + this.state = 3596; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3595; + this.intoClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + queryBlock() { + let localContext = new QueryBlockContext(this.context, this.state); + this.enterRule(localContext, 220, MySqlParser.RULE_queryBlock); + try { + this.state = 3601; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.LR_BRACKET: + this.enterOuterAlt(localContext, 1); + { + this.state = 3598; + this.selectStatement(); + } + break; + case MySqlParser.KW_TABLE: + this.enterOuterAlt(localContext, 2); + { + this.state = 3599; + this.tableStatement(); + } + break; + case MySqlParser.KW_VALUES: + this.enterOuterAlt(localContext, 3); + { + this.state = 3600; + this.valuesStatement(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replaceStatementValuesOrSelectOrTable() { + let localContext = new ReplaceStatementValuesOrSelectOrTableContext(this.context, this.state); + this.enterRule(localContext, 222, MySqlParser.RULE_replaceStatementValuesOrSelectOrTable); + try { + this.state = 3608; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 485, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3603; + this.selectStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3604; + this.match(MySqlParser.KW_TABLE); + this.state = 3605; + this.tableName(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 3606; + this.valuesOrValueList(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 3607; + this.rowValuesList(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + rowValuesList() { + let localContext = new RowValuesListContext(this.context, this.state); + this.enterRule(localContext, 224, MySqlParser.RULE_rowValuesList); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3610; + this.match(MySqlParser.KW_VALUES); + this.state = 3611; + this.match(MySqlParser.KW_ROW); + this.state = 3612; + this.expressionsWithDefaults(); + this.state = 3618; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 486, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3613; + this.match(MySqlParser.COMMA); + this.state = 3614; + this.match(MySqlParser.KW_ROW); + this.state = 3615; + this.expressionsWithDefaults(); + } + } + } + this.state = 3620; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 486, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setAssignmentList() { + let localContext = new SetAssignmentListContext(this.context, this.state); + this.enterRule(localContext, 226, MySqlParser.RULE_setAssignmentList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3621; + this.match(MySqlParser.KW_SET); + this.state = 3622; + localContext._setFirst = this.updatedElement(); + this.state = 3627; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3623; + this.match(MySqlParser.COMMA); + this.state = 3624; + localContext._updatedElement = this.updatedElement(); + localContext._setElements.push(localContext._updatedElement); + } + } + this.state = 3629; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + updatedElement() { + let localContext = new UpdatedElementContext(this.context, this.state); + this.enterRule(localContext, 228, MySqlParser.RULE_updatedElement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3630; + this.columnName(); + this.state = 3631; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 3632; + this.expressionOrDefault(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + assignmentField() { + let localContext = new AssignmentFieldContext(this.context, this.state); + this.enterRule(localContext, 230, MySqlParser.RULE_assignmentField); + try { + this.state = 3636; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 1); + { + this.state = 3634; + localContext._var_name = this.uid(); + } + break; + case MySqlParser.LOCAL_ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 3635; + this.match(MySqlParser.LOCAL_ID); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockClause() { + let localContext = new LockClauseContext(this.context, this.state); + this.enterRule(localContext, 232, MySqlParser.RULE_lockClause); + let _la; + try { + let alternative; + this.state = 3659; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FOR: + this.enterOuterAlt(localContext, 1); + { + this.state = 3638; + this.match(MySqlParser.KW_FOR); + this.state = 3639; + _la = this.tokenStream.LA(1); + if (!(_la === 185 || _la === 594)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3649; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 490, this.context)) { + case 1: + { + this.state = 3640; + this.match(MySqlParser.KW_OF); + this.state = 3641; + this.tableName(); + this.state = 3646; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 489, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3642; + this.match(MySqlParser.COMMA); + this.state = 3643; + this.tableName(); + } + } + } + this.state = 3648; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 489, this.context); + } + } + break; + } + this.state = 3653; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 491, this.context)) { + case 1: + { + this.state = 3651; + _la = this.tokenStream.LA(1); + if (!(_la === 159 || _la === 503)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3652; + this.match(MySqlParser.KW_LOCKED); + } + break; + } + } + break; + case MySqlParser.KW_LOCK: + this.enterOuterAlt(localContext, 2); + { + this.state = 3655; + this.match(MySqlParser.KW_LOCK); + this.state = 3656; + this.match(MySqlParser.KW_IN); + this.state = 3657; + this.match(MySqlParser.KW_SHARE); + this.state = 3658; + this.match(MySqlParser.KW_MODE); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + singleDeleteStatement() { + let localContext = new SingleDeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 234, MySqlParser.RULE_singleDeleteStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3661; + this.match(MySqlParser.KW_DELETE); + this.state = 3663; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3662; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3666; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 549) { + { + this.state = 3665; + this.match(MySqlParser.KW_QUICK); + } + } + this.state = 3669; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3668; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3671; + this.match(MySqlParser.KW_FROM); + this.state = 3672; + this.tableName(); + this.state = 3677; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 497, this.context)) { + case 1: + { + this.state = 3674; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3673; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3676; + localContext._table_alias = this.uid(); + } + break; + } + this.state = 3684; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3679; + this.match(MySqlParser.KW_PARTITION); + this.state = 3680; + this.match(MySqlParser.LR_BRACKET); + this.state = 3681; + this.partitionNames(); + this.state = 3682; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3688; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3686; + this.match(MySqlParser.KW_WHERE); + this.state = 3687; + this.expression(0); + } + } + this.state = 3691; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3690; + this.orderByClause(); + } + } + this.state = 3695; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3693; + this.match(MySqlParser.KW_LIMIT); + this.state = 3694; + this.limitClauseAtom(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + multipleDeleteStatement() { + let localContext = new MultipleDeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 236, MySqlParser.RULE_multipleDeleteStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3697; + this.match(MySqlParser.KW_DELETE); + this.state = 3699; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3698; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3702; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 503, this.context)) { + case 1: + { + this.state = 3701; + this.match(MySqlParser.KW_QUICK); + } + break; + } + this.state = 3705; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3704; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3746; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 3707; + this.tableName(); + this.state = 3710; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3708; + this.match(MySqlParser.DOT); + this.state = 3709; + this.match(MySqlParser.STAR); + } + } + this.state = 3720; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3712; + this.match(MySqlParser.COMMA); + this.state = 3713; + this.tableName(); + this.state = 3716; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3714; + this.match(MySqlParser.DOT); + this.state = 3715; + this.match(MySqlParser.STAR); + } + } + } + } + this.state = 3722; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3723; + this.match(MySqlParser.KW_FROM); + this.state = 3724; + this.tableSources(); + } + break; + case MySqlParser.KW_FROM: + { + this.state = 3726; + this.match(MySqlParser.KW_FROM); + this.state = 3727; + this.tableName(); + this.state = 3730; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3728; + this.match(MySqlParser.DOT); + this.state = 3729; + this.match(MySqlParser.STAR); + } + } + this.state = 3740; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3732; + this.match(MySqlParser.COMMA); + this.state = 3733; + this.tableName(); + this.state = 3736; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3734; + this.match(MySqlParser.DOT); + this.state = 3735; + this.match(MySqlParser.STAR); + } + } + } + } + this.state = 3742; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3743; + this.match(MySqlParser.KW_USING); + this.state = 3744; + this.tableSources(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 3750; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3748; + this.match(MySqlParser.KW_WHERE); + this.state = 3749; + this.expression(0); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerOpenStatement() { + let localContext = new HandlerOpenStatementContext(this.context, this.state); + this.enterRule(localContext, 238, MySqlParser.RULE_handlerOpenStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3752; + this.match(MySqlParser.KW_HANDLER); + this.state = 3753; + this.tableName(); + this.state = 3754; + this.match(MySqlParser.KW_OPEN); + this.state = 3759; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 514, this.context)) { + case 1: + { + this.state = 3756; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3755; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3758; + localContext._table_alias = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerReadIndexStatement() { + let localContext = new HandlerReadIndexStatementContext(this.context, this.state); + this.enterRule(localContext, 240, MySqlParser.RULE_handlerReadIndexStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3761; + this.match(MySqlParser.KW_HANDLER); + this.state = 3762; + this.tableName(); + this.state = 3763; + this.match(MySqlParser.KW_READ); + this.state = 3764; + this.indexName(); + this.state = 3771; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.EQUAL_SYMBOL: + case MySqlParser.GREATER_SYMBOL: + case MySqlParser.LESS_SYMBOL: + { + this.state = 3765; + this.comparisonBase(); + this.state = 3766; + this.match(MySqlParser.LR_BRACKET); + this.state = 3767; + this.constants(); + this.state = 3768; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_FIRST: + case MySqlParser.KW_LAST: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_PREV: + { + this.state = 3770; + localContext._moveOrder = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 402 || _la === 445 || _la === 501 || _la === 542)) { + localContext._moveOrder = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 3775; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3773; + this.match(MySqlParser.KW_WHERE); + this.state = 3774; + this.expression(0); + } + } + this.state = 3779; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3777; + this.match(MySqlParser.KW_LIMIT); + this.state = 3778; + this.limitClauseAtom(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerReadStatement() { + let localContext = new HandlerReadStatementContext(this.context, this.state); + this.enterRule(localContext, 242, MySqlParser.RULE_handlerReadStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3781; + this.match(MySqlParser.KW_HANDLER); + this.state = 3782; + this.tableName(); + this.state = 3783; + this.match(MySqlParser.KW_READ); + this.state = 3784; + localContext._moveOrder = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 402 || _la === 501)) { + localContext._moveOrder = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3787; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3785; + this.match(MySqlParser.KW_WHERE); + this.state = 3786; + this.expression(0); + } + } + this.state = 3791; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3789; + this.match(MySqlParser.KW_LIMIT); + this.state = 3790; + this.limitClauseAtom(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerCloseStatement() { + let localContext = new HandlerCloseStatementContext(this.context, this.state); + this.enterRule(localContext, 244, MySqlParser.RULE_handlerCloseStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3793; + this.match(MySqlParser.KW_HANDLER); + this.state = 3794; + this.tableName(); + this.state = 3795; + this.match(MySqlParser.KW_CLOSE); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + importTableStatement() { + let localContext = new ImportTableStatementContext(this.context, this.state); + this.enterRule(localContext, 246, MySqlParser.RULE_importTableStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3797; + this.match(MySqlParser.KW_IMPORT); + this.state = 3798; + this.match(MySqlParser.KW_TABLE); + this.state = 3799; + this.match(MySqlParser.KW_FROM); + this.state = 3800; + this.stringLiteral(); + this.state = 3805; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3801; + this.match(MySqlParser.COMMA); + this.state = 3802; + this.stringLiteral(); + } + } + this.state = 3807; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + singleUpdateStatement() { + let localContext = new SingleUpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 248, MySqlParser.RULE_singleUpdateStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3808; + this.match(MySqlParser.KW_UPDATE); + this.state = 3810; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3809; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3813; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3812; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3815; + this.tableName(); + this.state = 3820; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074311168) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 3817; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3816; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3819; + localContext._table_alias = this.uid(); + } + } + this.state = 3822; + this.match(MySqlParser.KW_SET); + this.state = 3823; + this.updatedElement(); + this.state = 3828; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3824; + this.match(MySqlParser.COMMA); + this.state = 3825; + this.updatedElement(); + } + } + this.state = 3830; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3833; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3831; + this.match(MySqlParser.KW_WHERE); + this.state = 3832; + this.expression(0); + } + } + this.state = 3836; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3835; + this.orderByClause(); + } + } + this.state = 3839; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3838; + this.limitClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + multipleUpdateStatement() { + let localContext = new MultipleUpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 250, MySqlParser.RULE_multipleUpdateStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3841; + this.match(MySqlParser.KW_UPDATE); + this.state = 3843; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3842; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3846; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3845; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3848; + this.tableSources(); + this.state = 3849; + this.match(MySqlParser.KW_SET); + this.state = 3850; + this.updatedElement(); + this.state = 3855; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3851; + this.match(MySqlParser.COMMA); + this.state = 3852; + this.updatedElement(); + } + } + this.state = 3857; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3860; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3858; + this.match(MySqlParser.KW_WHERE); + this.state = 3859; + this.expression(0); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + orderByClause() { + let localContext = new OrderByClauseContext(this.context, this.state); + this.enterRule(localContext, 252, MySqlParser.RULE_orderByClause); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3862; + this.match(MySqlParser.KW_ORDER); + this.state = 3863; + this.match(MySqlParser.KW_BY); + this.state = 3864; + this.orderByExpression(); + this.state = 3869; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 533, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3865; + this.match(MySqlParser.COMMA); + this.state = 3866; + this.orderByExpression(); + } + } + } + this.state = 3871; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 533, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + orderByExpression() { + let localContext = new OrderByExpressionContext(this.context, this.state); + this.enterRule(localContext, 254, MySqlParser.RULE_orderByExpression); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3872; + this.expression(0); + this.state = 3874; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 534, this.context)) { + case 1: + { + this.state = 3873; + localContext._order = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45)) { + localContext._order = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableSources() { + let localContext = new TableSourcesContext(this.context, this.state); + this.enterRule(localContext, 256, MySqlParser.RULE_tableSources); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3876; + this.tableSource(); + this.state = 3881; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 535, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3877; + this.match(MySqlParser.COMMA); + this.state = 3878; + this.tableSource(); + } + } + } + this.state = 3883; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 535, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableSource() { + let localContext = new TableSourceContext(this.context, this.state); + this.enterRule(localContext, 258, MySqlParser.RULE_tableSource); + let _la; + try { + let alternative; + this.state = 3902; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 538, this.context)) { + case 1: + localContext = new TableSourceBaseContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3884; + this.tableSourceItem(); + this.state = 3888; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 536, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3885; + this.joinPart(); + } + } + } + this.state = 3890; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 536, this.context); + } + } + break; + case 2: + localContext = new TableSourceNestedContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3891; + this.match(MySqlParser.LR_BRACKET); + this.state = 3892; + this.tableSourceItem(); + this.state = 3896; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 35 || ((((_la - 84)) & ~0x1F) === 0 && ((1 << (_la - 84)) & 536887425) !== 0) || _la === 150 || _la === 172) { + { + { + this.state = 3893; + this.joinPart(); + } + } + this.state = 3898; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3899; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 3: + localContext = new TableJsonContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 3901; + this.jsonTable(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableSourceItem() { + let localContext = new TableSourceItemContext(this.context, this.state); + this.enterRule(localContext, 260, MySqlParser.RULE_tableSourceItem); + let _la; + try { + let alternative; + this.state = 3949; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 548, this.context)) { + case 1: + localContext = new AtomTableItemContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3904; + this.tableName(); + this.state = 3910; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 539, this.context)) { + case 1: + { + this.state = 3905; + this.match(MySqlParser.KW_PARTITION); + this.state = 3906; + this.match(MySqlParser.LR_BRACKET); + this.state = 3907; + this.partitionNames(); + this.state = 3908; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3916; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 541, this.context)) { + case 1: + { + this.state = 3913; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3912; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3915; + localContext._alias = this.uid(); + } + break; + } + this.state = 3926; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 543, this.context)) { + case 1: + { + this.state = 3918; + this.indexHint(); + this.state = 3923; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 542, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3919; + this.match(MySqlParser.COMMA); + this.state = 3920; + this.indexHint(); + } + } + } + this.state = 3925; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 542, this.context); + } + } + break; + } + } + break; + case 2: + localContext = new SubqueryTableItemContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3929; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 95) { + { + this.state = 3928; + this.match(MySqlParser.KW_LATERAL); + } + } + this.state = 3936; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 545, this.context)) { + case 1: + { + this.state = 3931; + this.selectStatement(); + } + break; + case 2: + { + this.state = 3932; + this.match(MySqlParser.LR_BRACKET); + this.state = 3933; + localContext._parenthesisSubquery = this.selectStatement(); + this.state = 3934; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3939; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3938; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3941; + localContext._alias = this.uid(); + this.state = 3943; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 547, this.context)) { + case 1: + { + this.state = 3942; + this.fullColumnNames(); + } + break; + } + } + break; + case 3: + localContext = new TableSourcesItemContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 3945; + this.match(MySqlParser.LR_BRACKET); + this.state = 3946; + this.tableSources(); + this.state = 3947; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fullColumnNames() { + let localContext = new FullColumnNamesContext(this.context, this.state); + this.enterRule(localContext, 262, MySqlParser.RULE_fullColumnNames); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3951; + this.match(MySqlParser.LR_BRACKET); + this.state = 3952; + this.columnNames(); + this.state = 3953; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexHint() { + let localContext = new IndexHintContext(this.context, this.state); + this.enterRule(localContext, 264, MySqlParser.RULE_indexHint); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3955; + localContext._indexHintAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 66 || _la === 79 || _la === 187)) { + localContext._indexHintAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3956; + localContext._keyFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._keyFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3959; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 3957; + this.match(MySqlParser.KW_FOR); + this.state = 3958; + this.indexHintType(); + } + } + this.state = 3961; + this.match(MySqlParser.LR_BRACKET); + this.state = 3963; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 3962; + this.indexNames(); + } + } + this.state = 3965; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexHintType() { + let localContext = new IndexHintTypeContext(this.context, this.state); + this.enterRule(localContext, 266, MySqlParser.RULE_indexHintType); + try { + this.state = 3972; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_JOIN: + this.enterOuterAlt(localContext, 1); + { + this.state = 3967; + this.match(MySqlParser.KW_JOIN); + } + break; + case MySqlParser.KW_ORDER: + this.enterOuterAlt(localContext, 2); + { + this.state = 3968; + this.match(MySqlParser.KW_ORDER); + this.state = 3969; + this.match(MySqlParser.KW_BY); + } + break; + case MySqlParser.KW_GROUP: + this.enterOuterAlt(localContext, 3); + { + this.state = 3970; + this.match(MySqlParser.KW_GROUP); + this.state = 3971; + this.match(MySqlParser.KW_BY); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + joinPart() { + let localContext = new JoinPartContext(this.context, this.state); + this.enterRule(localContext, 268, MySqlParser.RULE_joinPart); + let _la; + try { + let alternative; + this.state = 4023; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CROSS: + case MySqlParser.KW_INNER: + case MySqlParser.KW_JOIN: + localContext = new InnerJoinContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3975; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 35 || _la === 84) { + { + this.state = 3974; + _la = this.tokenStream.LA(1); + if (!(_la === 35 || _la === 84)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3977; + this.match(MySqlParser.KW_JOIN); + this.state = 3979; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 553, this.context)) { + case 1: + { + this.state = 3978; + this.match(MySqlParser.KW_LATERAL); + } + break; + } + this.state = 3981; + this.tableSourceItem(); + this.state = 3985; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 554, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3982; + this.joinSpec(); + } + } + } + this.state = 3987; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 554, this.context); + } + } + break; + case MySqlParser.KW_STRAIGHT_JOIN: + localContext = new StraightJoinContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3988; + this.match(MySqlParser.KW_STRAIGHT_JOIN); + this.state = 3989; + this.tableSourceItem(); + this.state = 3993; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 555, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3990; + this.joinSpec(); + } + } + } + this.state = 3995; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 555, this.context); + } + } + break; + case MySqlParser.KW_LEFT: + case MySqlParser.KW_RIGHT: + localContext = new OuterJoinContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 3996; + _la = this.tokenStream.LA(1); + if (!(_la === 98 || _la === 150)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3998; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 127) { + { + this.state = 3997; + this.match(MySqlParser.KW_OUTER); + } + } + this.state = 4000; + this.match(MySqlParser.KW_JOIN); + this.state = 4002; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 557, this.context)) { + case 1: + { + this.state = 4001; + this.match(MySqlParser.KW_LATERAL); + } + break; + } + this.state = 4004; + this.tableSourceItem(); + this.state = 4008; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 558, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4005; + this.joinSpec(); + } + } + } + this.state = 4010; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 558, this.context); + } + } + break; + case MySqlParser.KW_NATURAL: + localContext = new NaturalJoinContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4011; + this.match(MySqlParser.KW_NATURAL); + this.state = 4019; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 84 || _la === 98 || _la === 150) { + { + this.state = 4014; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_INNER: + { + this.state = 4012; + this.match(MySqlParser.KW_INNER); + } + break; + case MySqlParser.KW_LEFT: + case MySqlParser.KW_RIGHT: + { + this.state = 4013; + _la = this.tokenStream.LA(1); + if (!(_la === 98 || _la === 150)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4017; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 127) { + { + this.state = 4016; + this.match(MySqlParser.KW_OUTER); + } + } + } + } + this.state = 4021; + this.match(MySqlParser.KW_JOIN); + this.state = 4022; + this.tableSourceItem(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + joinSpec() { + let localContext = new JoinSpecContext(this.context, this.state); + this.enterRule(localContext, 270, MySqlParser.RULE_joinSpec); + try { + this.state = 4032; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ON: + this.enterOuterAlt(localContext, 1); + { + { + this.state = 4025; + this.match(MySqlParser.KW_ON); + this.state = 4026; + this.expression(0); + } + } + break; + case MySqlParser.KW_USING: + this.enterOuterAlt(localContext, 2); + { + this.state = 4027; + this.match(MySqlParser.KW_USING); + this.state = 4028; + this.match(MySqlParser.LR_BRACKET); + this.state = 4029; + this.columnNames(); + this.state = 4030; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + queryExpression() { + let localContext = new QueryExpressionContext(this.context, this.state); + this.enterRule(localContext, 272, MySqlParser.RULE_queryExpression); + try { + this.state = 4042; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 564, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4034; + this.match(MySqlParser.LR_BRACKET); + this.state = 4035; + this.querySpecification(); + this.state = 4036; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4038; + this.match(MySqlParser.LR_BRACKET); + this.state = 4039; + this.queryExpression(); + this.state = 4040; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + querySpecification() { + let localContext = new QuerySpecificationContext(this.context, this.state); + this.enterRule(localContext, 274, MySqlParser.RULE_querySpecification); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4044; + this.match(MySqlParser.KW_SELECT); + this.state = 4048; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 565, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4045; + this.selectSpec(); + } + } + } + this.state = 4050; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 565, this.context); + } + this.state = 4051; + this.selectElements(); + this.state = 4053; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 566, this.context)) { + case 1: + { + this.state = 4052; + this.intoClause(); + } + break; + } + this.state = 4055; + this.fromClause(); + this.state = 4057; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 567, this.context)) { + case 1: + { + this.state = 4056; + this.groupByClause(); + } + break; + } + this.state = 4060; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 568, this.context)) { + case 1: + { + this.state = 4059; + this.havingClause(); + } + break; + } + this.state = 4063; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 569, this.context)) { + case 1: + { + this.state = 4062; + this.windowClause(); + } + break; + } + this.state = 4066; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 570, this.context)) { + case 1: + { + this.state = 4065; + this.orderByClause(); + } + break; + } + this.state = 4069; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 571, this.context)) { + case 1: + { + this.state = 4068; + this.limitClause(); + } + break; + } + this.state = 4072; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 572, this.context)) { + case 1: + { + this.state = 4071; + this.intoClause(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + unionStatement() { + let localContext = new UnionStatementContext(this.context, this.state); + this.enterRule(localContext, 276, MySqlParser.RULE_unionStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4074; + this.match(MySqlParser.KW_UNION); + this.state = 4076; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 4075; + localContext._unionType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._unionType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 4080; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + { + this.state = 4078; + this.querySpecification(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 4079; + this.queryExpression(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lateralStatement() { + let localContext = new LateralStatementContext(this.context, this.state); + this.enterRule(localContext, 278, MySqlParser.RULE_lateralStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4082; + this.match(MySqlParser.KW_LATERAL); + this.state = 4097; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 578, this.context)) { + case 1: + { + this.state = 4083; + this.querySpecification(); + } + break; + case 2: + { + this.state = 4084; + this.queryExpression(); + } + break; + case 3: + { + { + this.state = 4085; + this.match(MySqlParser.LR_BRACKET); + this.state = 4088; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + { + this.state = 4086; + this.querySpecification(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 4087; + this.queryExpression(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4090; + this.match(MySqlParser.RR_BRACKET); + this.state = 4095; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 577, this.context)) { + case 1: + { + this.state = 4092; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4091; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4094; + localContext._alias = this.uid(); + } + break; + } + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonTable() { + let localContext = new JsonTableContext(this.context, this.state); + this.enterRule(localContext, 280, MySqlParser.RULE_jsonTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4099; + this.match(MySqlParser.KW_JSON_TABLE); + this.state = 4100; + this.match(MySqlParser.LR_BRACKET); + this.state = 4101; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4102; + this.match(MySqlParser.COMMA); + this.state = 4103; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4104; + this.match(MySqlParser.KW_COLUMNS); + this.state = 4105; + this.match(MySqlParser.LR_BRACKET); + this.state = 4106; + this.jsonColumnList(); + this.state = 4107; + this.match(MySqlParser.RR_BRACKET); + this.state = 4108; + this.match(MySqlParser.RR_BRACKET); + this.state = 4113; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 580, this.context)) { + case 1: + { + this.state = 4110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4109; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4112; + localContext._alias = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonColumnList() { + let localContext = new JsonColumnListContext(this.context, this.state); + this.enterRule(localContext, 282, MySqlParser.RULE_jsonColumnList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4115; + this.jsonColumn(); + this.state = 4120; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4116; + this.match(MySqlParser.COMMA); + this.state = 4117; + this.jsonColumn(); + } + } + this.state = 4122; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonColumn() { + let localContext = new JsonColumnContext(this.context, this.state); + this.enterRule(localContext, 284, MySqlParser.RULE_jsonColumn); + let _la; + try { + this.state = 4152; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 587, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4123; + this.columnName(); + this.state = 4140; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FOR: + { + this.state = 4124; + this.match(MySqlParser.KW_FOR); + this.state = 4125; + this.match(MySqlParser.KW_ORDINALITY); + } + break; + case MySqlParser.KW_CHARACTER: + case MySqlParser.KW_SET: + case MySqlParser.KW_TINYINT: + case MySqlParser.KW_SMALLINT: + case MySqlParser.KW_MEDIUMINT: + case MySqlParser.KW_MIDDLEINT: + case MySqlParser.KW_INT: + case MySqlParser.KW_INT1: + case MySqlParser.KW_INT2: + case MySqlParser.KW_INT3: + case MySqlParser.KW_INT4: + case MySqlParser.KW_INT8: + case MySqlParser.KW_INTEGER: + case MySqlParser.KW_BIGINT: + case MySqlParser.KW_REAL: + case MySqlParser.KW_DOUBLE: + case MySqlParser.KW_FLOAT: + case MySqlParser.KW_FLOAT4: + case MySqlParser.KW_FLOAT8: + case MySqlParser.KW_DECIMAL: + case MySqlParser.KW_DEC: + case MySqlParser.KW_NUMERIC: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_CHAR: + case MySqlParser.KW_VARCHAR: + case MySqlParser.KW_NVARCHAR: + case MySqlParser.KW_NATIONAL: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_VARBINARY: + case MySqlParser.KW_TINYBLOB: + case MySqlParser.KW_BLOB: + case MySqlParser.KW_MEDIUMBLOB: + case MySqlParser.KW_LONG: + case MySqlParser.KW_LONGBLOB: + case MySqlParser.KW_TINYTEXT: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_MEDIUMTEXT: + case MySqlParser.KW_LONGTEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_JSON: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_GEOMCOLLECTION: + case MySqlParser.KW_GEOMETRY: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + { + this.state = 4126; + this.dataType(); + this.state = 4138; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PATH: + { + this.state = 4127; + this.match(MySqlParser.KW_PATH); + this.state = 4128; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4130; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 582, this.context)) { + case 1: + { + this.state = 4129; + this.jsonOnEmpty(); + } + break; + } + this.state = 4133; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42 || _la === 116 || _la === 382) { + { + this.state = 4132; + this.jsonOnError(); + } + } + } + break; + case MySqlParser.KW_EXISTS: + { + this.state = 4135; + this.match(MySqlParser.KW_EXISTS); + this.state = 4136; + this.match(MySqlParser.KW_PATH); + this.state = 4137; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4142; + this.match(MySqlParser.KW_NESTED); + this.state = 4144; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 257) { + { + this.state = 4143; + this.match(MySqlParser.KW_PATH); + } + } + this.state = 4146; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4147; + this.match(MySqlParser.KW_COLUMNS); + this.state = 4148; + this.match(MySqlParser.LR_BRACKET); + this.state = 4149; + this.jsonColumnList(); + this.state = 4150; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonOnEmpty() { + let localContext = new JsonOnEmptyContext(this.context, this.state); + this.enterRule(localContext, 286, MySqlParser.RULE_jsonOnEmpty); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4158; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NULL_LITERAL: + { + this.state = 4154; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case MySqlParser.KW_ERROR: + { + this.state = 4155; + this.match(MySqlParser.KW_ERROR); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 4156; + this.match(MySqlParser.KW_DEFAULT); + this.state = 4157; + this.defaultValue(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4160; + this.match(MySqlParser.KW_ON); + this.state = 4161; + this.match(MySqlParser.KW_EMPTY); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonOnError() { + let localContext = new JsonOnErrorContext(this.context, this.state); + this.enterRule(localContext, 288, MySqlParser.RULE_jsonOnError); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4167; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NULL_LITERAL: + { + this.state = 4163; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case MySqlParser.KW_ERROR: + { + this.state = 4164; + this.match(MySqlParser.KW_ERROR); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 4165; + this.match(MySqlParser.KW_DEFAULT); + this.state = 4166; + this.defaultValue(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4169; + this.match(MySqlParser.KW_ON); + this.state = 4170; + this.match(MySqlParser.KW_ERROR); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectSpec() { + let localContext = new SelectSpecContext(this.context, this.state); + this.enterRule(localContext, 290, MySqlParser.RULE_selectSpec); + let _la; + try { + this.state = 4180; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALL: + case MySqlParser.KW_DISTINCT: + case MySqlParser.KW_DISTINCTROW: + this.enterOuterAlt(localContext, 1); + { + this.state = 4172; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49 || _la === 50)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_HIGH_PRIORITY: + this.enterOuterAlt(localContext, 2); + { + this.state = 4173; + this.match(MySqlParser.KW_HIGH_PRIORITY); + } + break; + case MySqlParser.KW_STRAIGHT_JOIN: + this.enterOuterAlt(localContext, 3); + { + this.state = 4174; + this.match(MySqlParser.KW_STRAIGHT_JOIN); + } + break; + case MySqlParser.KW_SQL_SMALL_RESULT: + this.enterOuterAlt(localContext, 4); + { + this.state = 4175; + this.match(MySqlParser.KW_SQL_SMALL_RESULT); + } + break; + case MySqlParser.KW_SQL_BIG_RESULT: + this.enterOuterAlt(localContext, 5); + { + this.state = 4176; + this.match(MySqlParser.KW_SQL_BIG_RESULT); + } + break; + case MySqlParser.KW_SQL_BUFFER_RESULT: + this.enterOuterAlt(localContext, 6); + { + this.state = 4177; + this.match(MySqlParser.KW_SQL_BUFFER_RESULT); + } + break; + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + this.enterOuterAlt(localContext, 7); + { + this.state = 4178; + _la = this.tokenStream.LA(1); + if (!(_la === 637 || _la === 638)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_SQL_CALC_FOUND_ROWS: + this.enterOuterAlt(localContext, 8); + { + this.state = 4179; + this.match(MySqlParser.KW_SQL_CALC_FOUND_ROWS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectElements() { + let localContext = new SelectElementsContext(this.context, this.state); + this.enterRule(localContext, 292, MySqlParser.RULE_selectElements); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4184; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 591, this.context)) { + case 1: + { + this.state = 4182; + localContext._star = this.match(MySqlParser.STAR); + } + break; + case 2: + { + this.state = 4183; + this.selectElement(); + } + break; + } + this.state = 4190; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 592, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4186; + this.match(MySqlParser.COMMA); + this.state = 4187; + this.selectElement(); + } + } + } + this.state = 4192; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 592, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectElement() { + let localContext = new SelectElementContext(this.context, this.state); + this.enterRule(localContext, 294, MySqlParser.RULE_selectElement); + let _la; + try { + this.state = 4222; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 600, this.context)) { + case 1: + localContext = new SelectExpressionElementContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4195; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 593, this.context)) { + case 1: + { + this.state = 4193; + this.match(MySqlParser.LOCAL_ID); + this.state = 4194; + this.match(MySqlParser.VAR_ASSIGN); + } + break; + } + this.state = 4197; + this.expression(0); + this.state = 4202; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 595, this.context)) { + case 1: + { + this.state = 4199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4198; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4201; + localContext._alias = this.uid(); + } + break; + } + } + break; + case 2: + localContext = new SelectFunctionElementContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4204; + this.functionCall(); + this.state = 4209; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 597, this.context)) { + case 1: + { + this.state = 4206; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4205; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4208; + localContext._alias = this.uid(); + } + break; + } + } + break; + case 3: + localContext = new SelectStarElementContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4211; + localContext._select_element = this.fullId(); + this.state = 4212; + this.match(MySqlParser.DOT); + this.state = 4213; + this.match(MySqlParser.STAR); + } + break; + case 4: + localContext = new SelectColumnElementContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4215; + this.columnName(); + this.state = 4220; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 599, this.context)) { + case 1: + { + this.state = 4217; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4216; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4219; + localContext._alias = this.uid(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intoClause() { + let localContext = new IntoClauseContext(this.context, this.state); + this.enterRule(localContext, 296, MySqlParser.RULE_intoClause); + let _la; + try { + let alternative; + this.state = 4260; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 607, this.context)) { + case 1: + localContext = new SelectIntoVariablesContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4224; + this.match(MySqlParser.KW_INTO); + this.state = 4225; + this.assignmentField(); + this.state = 4230; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 601, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4226; + this.match(MySqlParser.COMMA); + this.state = 4227; + this.assignmentField(); + } + } + } + this.state = 4232; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 601, this.context); + } + } + break; + case 2: + localContext = new SelectIntoDumpFileContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4233; + this.match(MySqlParser.KW_INTO); + this.state = 4234; + this.match(MySqlParser.KW_DUMPFILE); + this.state = 4235; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 3: + localContext = new SelectIntoTextFileContext(localContext); + this.enterOuterAlt(localContext, 3); + { + { + this.state = 4236; + this.match(MySqlParser.KW_INTO); + this.state = 4237; + this.match(MySqlParser.KW_OUTFILE); + this.state = 4238; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + this.state = 4242; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 602, this.context)) { + case 1: + { + this.state = 4239; + this.match(MySqlParser.KW_CHARACTER); + this.state = 4240; + this.match(MySqlParser.KW_SET); + this.state = 4241; + localContext._charset = this.charsetName(); + } + break; + } + this.state = 4250; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 604, this.context)) { + case 1: + { + this.state = 4244; + localContext._fieldsFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 337 || _la === 398)) { + localContext._fieldsFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4246; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4245; + this.selectFieldsInto(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4248; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 603, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + } + this.state = 4258; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 606, this.context)) { + case 1: + { + this.state = 4252; + this.match(MySqlParser.KW_LINES); + this.state = 4254; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4253; + this.selectLinesInto(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4256; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 605, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectFieldsInto() { + let localContext = new SelectFieldsIntoContext(this.context, this.state); + this.enterRule(localContext, 298, MySqlParser.RULE_selectFieldsInto); + let _la; + try { + this.state = 4274; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TERMINATED: + this.enterOuterAlt(localContext, 1); + { + this.state = 4262; + this.match(MySqlParser.KW_TERMINATED); + this.state = 4263; + this.match(MySqlParser.KW_BY); + this.state = 4264; + localContext._terminationField = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ENCLOSED: + case MySqlParser.KW_OPTIONALLY: + this.enterOuterAlt(localContext, 2); + { + this.state = 4266; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 123) { + { + this.state = 4265; + this.match(MySqlParser.KW_OPTIONALLY); + } + } + this.state = 4268; + this.match(MySqlParser.KW_ENCLOSED); + this.state = 4269; + this.match(MySqlParser.KW_BY); + this.state = 4270; + localContext._enclosion = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ESCAPED: + this.enterOuterAlt(localContext, 3); + { + this.state = 4271; + this.match(MySqlParser.KW_ESCAPED); + this.state = 4272; + this.match(MySqlParser.KW_BY); + this.state = 4273; + localContext._escaping = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectLinesInto() { + let localContext = new SelectLinesIntoContext(this.context, this.state); + this.enterRule(localContext, 300, MySqlParser.RULE_selectLinesInto); + try { + this.state = 4282; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_STARTING: + this.enterOuterAlt(localContext, 1); + { + this.state = 4276; + this.match(MySqlParser.KW_STARTING); + this.state = 4277; + this.match(MySqlParser.KW_BY); + this.state = 4278; + localContext._starting = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_TERMINATED: + this.enterOuterAlt(localContext, 2); + { + this.state = 4279; + this.match(MySqlParser.KW_TERMINATED); + this.state = 4280; + this.match(MySqlParser.KW_BY); + this.state = 4281; + localContext._terminationLine = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fromClause() { + let localContext = new FromClauseContext(this.context, this.state); + this.enterRule(localContext, 302, MySqlParser.RULE_fromClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4286; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 611, this.context)) { + case 1: + { + this.state = 4284; + this.match(MySqlParser.KW_FROM); + this.state = 4285; + this.tableSources(); + } + break; + } + this.state = 4290; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 612, this.context)) { + case 1: + { + this.state = 4288; + this.match(MySqlParser.KW_WHERE); + this.state = 4289; + localContext._whereExpr = this.expression(0); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupByClause() { + let localContext = new GroupByClauseContext(this.context, this.state); + this.enterRule(localContext, 304, MySqlParser.RULE_groupByClause); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4292; + this.match(MySqlParser.KW_GROUP); + this.state = 4293; + this.match(MySqlParser.KW_BY); + this.state = 4294; + this.groupByItem(); + this.state = 4299; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 613, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4295; + this.match(MySqlParser.COMMA); + this.state = 4296; + this.groupByItem(); + } + } + } + this.state = 4301; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 613, this.context); + } + this.state = 4304; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 614, this.context)) { + case 1: + { + this.state = 4302; + this.match(MySqlParser.KW_WITH); + this.state = 4303; + this.match(MySqlParser.KW_ROLLUP); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + havingClause() { + let localContext = new HavingClauseContext(this.context, this.state); + this.enterRule(localContext, 306, MySqlParser.RULE_havingClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4306; + this.match(MySqlParser.KW_HAVING); + this.state = 4307; + localContext._havingExpr = this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + windowClause() { + let localContext = new WindowClauseContext(this.context, this.state); + this.enterRule(localContext, 308, MySqlParser.RULE_windowClause); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4309; + this.match(MySqlParser.KW_WINDOW); + this.state = 4310; + this.windowName(); + this.state = 4311; + this.match(MySqlParser.KW_AS); + this.state = 4312; + this.match(MySqlParser.LR_BRACKET); + this.state = 4313; + this.windowSpec(); + this.state = 4314; + this.match(MySqlParser.RR_BRACKET); + this.state = 4324; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 615, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4315; + this.match(MySqlParser.COMMA); + this.state = 4316; + this.windowName(); + this.state = 4317; + this.match(MySqlParser.KW_AS); + this.state = 4318; + this.match(MySqlParser.LR_BRACKET); + this.state = 4319; + this.windowSpec(); + this.state = 4320; + this.match(MySqlParser.RR_BRACKET); + } + } + } + this.state = 4326; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 615, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupByItem() { + let localContext = new GroupByItemContext(this.context, this.state); + this.enterRule(localContext, 310, MySqlParser.RULE_groupByItem); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4327; + this.expression(0); + this.state = 4329; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 616, this.context)) { + case 1: + { + this.state = 4328; + localContext._order = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45)) { + localContext._order = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + limitClause() { + let localContext = new LimitClauseContext(this.context, this.state); + this.enterRule(localContext, 312, MySqlParser.RULE_limitClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4331; + this.match(MySqlParser.KW_LIMIT); + this.state = 4342; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 618, this.context)) { + case 1: + { + this.state = 4335; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 617, this.context)) { + case 1: + { + this.state = 4332; + localContext._offset = this.limitClauseAtom(); + this.state = 4333; + this.match(MySqlParser.COMMA); + } + break; + } + this.state = 4337; + localContext._limit = this.limitClauseAtom(); + } + break; + case 2: + { + this.state = 4338; + localContext._limit = this.limitClauseAtom(); + this.state = 4339; + this.match(MySqlParser.KW_OFFSET); + this.state = 4340; + localContext._offset = this.limitClauseAtom(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + limitClauseAtom() { + let localContext = new LimitClauseAtomContext(this.context, this.state); + this.enterRule(localContext, 314, MySqlParser.RULE_limitClauseAtom); + try { + this.state = 4347; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 4344; + this.decimalLiteral(); + } + break; + case MySqlParser.LOCAL_ID: + case MySqlParser.GLOBAL_ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 4345; + this.mysqlVariable(); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 3); + { + this.state = 4346; + this.simpleId(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + startTransaction() { + let localContext = new StartTransactionContext(this.context, this.state); + this.enterRule(localContext, 316, MySqlParser.RULE_startTransaction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4349; + this.match(MySqlParser.KW_START); + this.state = 4350; + this.match(MySqlParser.KW_TRANSACTION); + this.state = 4359; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 621, this.context)) { + case 1: + { + this.state = 4351; + this.transactionMode(); + this.state = 4356; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4352; + this.match(MySqlParser.COMMA); + this.state = 4353; + this.transactionMode(); + } + } + this.state = 4358; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + beginWork() { + let localContext = new BeginWorkContext(this.context, this.state); + this.enterRule(localContext, 318, MySqlParser.RULE_beginWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4361; + this.match(MySqlParser.KW_BEGIN); + this.state = 4363; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4362; + this.match(MySqlParser.KW_WORK); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + commitWork() { + let localContext = new CommitWorkContext(this.context, this.state); + this.enterRule(localContext, 320, MySqlParser.RULE_commitWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4365; + this.match(MySqlParser.KW_COMMIT); + this.state = 4367; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4366; + this.match(MySqlParser.KW_WORK); + } + } + this.state = 4374; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 4369; + this.match(MySqlParser.KW_AND); + this.state = 4371; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4370; + localContext._nochain = this.match(MySqlParser.KW_NO); + } + } + this.state = 4373; + this.match(MySqlParser.KW_CHAIN); + } + } + this.state = 4380; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 627, this.context)) { + case 1: + { + this.state = 4377; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4376; + localContext._norelease = this.match(MySqlParser.KW_NO); + } + } + this.state = 4379; + this.match(MySqlParser.KW_RELEASE); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + rollbackWork() { + let localContext = new RollbackWorkContext(this.context, this.state); + this.enterRule(localContext, 322, MySqlParser.RULE_rollbackWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4382; + this.match(MySqlParser.KW_ROLLBACK); + this.state = 4384; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4383; + this.match(MySqlParser.KW_WORK); + } + } + this.state = 4391; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 4386; + this.match(MySqlParser.KW_AND); + this.state = 4388; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4387; + localContext._nochain = this.match(MySqlParser.KW_NO); + } + } + this.state = 4390; + this.match(MySqlParser.KW_CHAIN); + } + } + this.state = 4397; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 632, this.context)) { + case 1: + { + this.state = 4394; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4393; + localContext._norelease = this.match(MySqlParser.KW_NO); + } + } + this.state = 4396; + this.match(MySqlParser.KW_RELEASE); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + savepointStatement() { + let localContext = new SavepointStatementContext(this.context, this.state); + this.enterRule(localContext, 324, MySqlParser.RULE_savepointStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4399; + this.match(MySqlParser.KW_SAVEPOINT); + this.state = 4400; + localContext._identifier = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + rollbackStatement() { + let localContext = new RollbackStatementContext(this.context, this.state); + this.enterRule(localContext, 326, MySqlParser.RULE_rollbackStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4402; + this.match(MySqlParser.KW_ROLLBACK); + this.state = 4404; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4403; + this.match(MySqlParser.KW_WORK); + } + } + this.state = 4406; + this.match(MySqlParser.KW_TO); + this.state = 4408; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 634, this.context)) { + case 1: + { + this.state = 4407; + this.match(MySqlParser.KW_SAVEPOINT); + } + break; + } + this.state = 4410; + localContext._identifier = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + releaseStatement() { + let localContext = new ReleaseStatementContext(this.context, this.state); + this.enterRule(localContext, 328, MySqlParser.RULE_releaseStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4412; + this.match(MySqlParser.KW_RELEASE); + this.state = 4413; + this.match(MySqlParser.KW_SAVEPOINT); + this.state = 4414; + localContext._identifier = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockTables() { + let localContext = new LockTablesContext(this.context, this.state); + this.enterRule(localContext, 330, MySqlParser.RULE_lockTables); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4416; + this.match(MySqlParser.KW_LOCK); + this.state = 4417; + _la = this.tokenStream.LA(1); + if (!(_la === 173 || _la === 752)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4418; + this.lockTableElement(); + this.state = 4423; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4419; + this.match(MySqlParser.COMMA); + this.state = 4420; + this.lockTableElement(); + } + } + this.state = 4425; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + unlockTables() { + let localContext = new UnlockTablesContext(this.context, this.state); + this.enterRule(localContext, 332, MySqlParser.RULE_unlockTables); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4426; + this.match(MySqlParser.KW_UNLOCK); + this.state = 4427; + this.match(MySqlParser.KW_TABLES); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setAutocommitStatement() { + let localContext = new SetAutocommitStatementContext(this.context, this.state); + this.enterRule(localContext, 334, MySqlParser.RULE_setAutocommitStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4429; + this.match(MySqlParser.KW_SET); + this.state = 4430; + this.match(MySqlParser.KW_AUTOCOMMIT); + this.state = 4431; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4432; + localContext._autocommitValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._autocommitValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setTransactionStatement() { + let localContext = new SetTransactionStatementContext(this.context, this.state); + this.enterRule(localContext, 336, MySqlParser.RULE_setTransactionStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4434; + this.match(MySqlParser.KW_SET); + this.state = 4436; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 413 || _la === 593) { + { + this.state = 4435; + localContext._transactionContext = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 593)) { + localContext._transactionContext = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 4438; + this.match(MySqlParser.KW_TRANSACTION); + this.state = 4439; + this.transactionOption(); + this.state = 4444; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4440; + this.match(MySqlParser.COMMA); + this.state = 4441; + this.transactionOption(); + } + } + this.state = 4446; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionMode() { + let localContext = new TransactionModeContext(this.context, this.state); + this.enterRule(localContext, 338, MySqlParser.RULE_transactionMode); + try { + this.state = 4454; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 638, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4447; + this.match(MySqlParser.KW_WITH); + this.state = 4448; + this.match(MySqlParser.KW_CONSISTENT); + this.state = 4449; + this.match(MySqlParser.KW_SNAPSHOT); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4450; + this.match(MySqlParser.KW_READ); + this.state = 4451; + this.match(MySqlParser.KW_WRITE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 4452; + this.match(MySqlParser.KW_READ); + this.state = 4453; + this.match(MySqlParser.KW_ONLY); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockTableElement() { + let localContext = new LockTableElementContext(this.context, this.state); + this.enterRule(localContext, 340, MySqlParser.RULE_lockTableElement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4456; + this.tableName(); + this.state = 4461; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074311168) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4458; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4457; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4460; + localContext._alias = this.uid(); + } + } + this.state = 4463; + this.lockAction(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockAction() { + let localContext = new LockActionContext(this.context, this.state); + this.enterRule(localContext, 342, MySqlParser.RULE_lockAction); + let _la; + try { + this.state = 4473; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_READ: + this.enterOuterAlt(localContext, 1); + { + this.state = 4465; + this.match(MySqlParser.KW_READ); + this.state = 4467; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 450) { + { + this.state = 4466; + this.match(MySqlParser.KW_LOCAL); + } + } + } + break; + case MySqlParser.KW_LOW_PRIORITY: + case MySqlParser.KW_WRITE: + this.enterOuterAlt(localContext, 2); + { + this.state = 4470; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 4469; + this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 4472; + this.match(MySqlParser.KW_WRITE); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionOption() { + let localContext = new TransactionOptionContext(this.context, this.state); + this.enterRule(localContext, 344, MySqlParser.RULE_transactionOption); + try { + this.state = 4482; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 644, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4475; + this.match(MySqlParser.KW_ISOLATION); + this.state = 4476; + this.match(MySqlParser.KW_LEVEL); + this.state = 4477; + this.transactionLevel(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4478; + this.match(MySqlParser.KW_READ); + this.state = 4479; + this.match(MySqlParser.KW_WRITE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 4480; + this.match(MySqlParser.KW_READ); + this.state = 4481; + this.match(MySqlParser.KW_ONLY); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionLevel() { + let localContext = new TransactionLevelContext(this.context, this.state); + this.enterRule(localContext, 346, MySqlParser.RULE_transactionLevel); + try { + this.state = 4491; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 645, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4484; + this.match(MySqlParser.KW_REPEATABLE); + this.state = 4485; + this.match(MySqlParser.KW_READ); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4486; + this.match(MySqlParser.KW_READ); + this.state = 4487; + this.match(MySqlParser.KW_COMMITTED); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 4488; + this.match(MySqlParser.KW_READ); + this.state = 4489; + this.match(MySqlParser.KW_UNCOMMITTED); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 4490; + this.match(MySqlParser.KW_SERIALIZABLE); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + changeMaster() { + let localContext = new ChangeMasterContext(this.context, this.state); + this.enterRule(localContext, 348, MySqlParser.RULE_changeMaster); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4493; + this.match(MySqlParser.KW_CHANGE); + this.state = 4494; + this.match(MySqlParser.KW_MASTER); + this.state = 4495; + this.match(MySqlParser.KW_TO); + this.state = 4496; + this.masterOption(); + this.state = 4501; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4497; + this.match(MySqlParser.COMMA); + this.state = 4498; + this.masterOption(); + } + } + this.state = 4503; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4505; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4504; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + changeReplicationFilter() { + let localContext = new ChangeReplicationFilterContext(this.context, this.state); + this.enterRule(localContext, 350, MySqlParser.RULE_changeReplicationFilter); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4507; + this.match(MySqlParser.KW_CHANGE); + this.state = 4508; + this.match(MySqlParser.KW_REPLICATION); + this.state = 4509; + this.match(MySqlParser.KW_FILTER); + this.state = 4510; + this.replicationFilter(); + this.state = 4515; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4511; + this.match(MySqlParser.COMMA); + this.state = 4512; + this.replicationFilter(); + } + } + this.state = 4517; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4519; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4518; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + changeReplicationSource() { + let localContext = new ChangeReplicationSourceContext(this.context, this.state); + this.enterRule(localContext, 352, MySqlParser.RULE_changeReplicationSource); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4521; + this.match(MySqlParser.KW_CHANGE); + this.state = 4522; + this.match(MySqlParser.KW_REPLICATION); + this.state = 4523; + this.match(MySqlParser.KW_SOURCE); + this.state = 4524; + this.match(MySqlParser.KW_TO); + this.state = 4525; + this.replicationSourceOption(); + this.state = 4530; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4526; + this.match(MySqlParser.COMMA); + this.state = 4527; + this.replicationSourceOption(); + } + } + this.state = 4532; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4534; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4533; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + purgeBinaryLogs() { + let localContext = new PurgeBinaryLogsContext(this.context, this.state); + this.enterRule(localContext, 354, MySqlParser.RULE_purgeBinaryLogs); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4536; + this.match(MySqlParser.KW_PURGE); + this.state = 4537; + localContext._purgeFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 228 || _la === 453)) { + localContext._purgeFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4538; + this.match(MySqlParser.KW_LOGS); + this.state = 4543; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TO: + { + this.state = 4539; + this.match(MySqlParser.KW_TO); + this.state = 4540; + localContext._fileName = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_BEFORE: + { + this.state = 4541; + this.match(MySqlParser.KW_BEFORE); + this.state = 4542; + localContext._timeValue = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + startSlaveOrReplica() { + let localContext = new StartSlaveOrReplicaContext(this.context, this.state); + this.enterRule(localContext, 356, MySqlParser.RULE_startSlaveOrReplica); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4545; + this.match(MySqlParser.KW_START); + this.state = 4546; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4555; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 438 || _la === 639) { + { + this.state = 4547; + this.threadType(); + this.state = 4552; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4548; + this.match(MySqlParser.COMMA); + this.state = 4549; + this.threadType(); + } + } + this.state = 4554; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4559; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 676) { + { + this.state = 4557; + this.match(MySqlParser.KW_UNTIL); + this.state = 4558; + this.untilOption(); + } + } + this.state = 4564; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 363 || _la === 529 || _la === 535 || _la === 678) { + { + { + this.state = 4561; + this.connectionOptions(); + } + } + this.state = 4566; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4568; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4567; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stopSlaveOrReplica() { + let localContext = new StopSlaveOrReplicaContext(this.context, this.state); + this.enterRule(localContext, 358, MySqlParser.RULE_stopSlaveOrReplica); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4570; + this.match(MySqlParser.KW_STOP); + this.state = 4571; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4580; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 438 || _la === 639) { + { + this.state = 4572; + this.threadType(); + this.state = 4577; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4573; + this.match(MySqlParser.COMMA); + this.state = 4574; + this.threadType(); + } + } + this.state = 4579; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4583; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4582; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + startGroupReplication() { + let localContext = new StartGroupReplicationContext(this.context, this.state); + this.enterRule(localContext, 360, MySqlParser.RULE_startGroupReplication); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4585; + this.match(MySqlParser.KW_START); + this.state = 4586; + this.match(MySqlParser.KW_GROUP_REPLICATION); + this.state = 4590; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 678) { + { + this.state = 4587; + this.match(MySqlParser.KW_USER); + this.state = 4588; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4589; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 4596; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 662, this.context)) { + case 1: + { + this.state = 4592; + this.match(MySqlParser.COMMA); + this.state = 4593; + this.match(MySqlParser.KW_PASSWORD); + this.state = 4594; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4595; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + this.state = 4602; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 4598; + this.match(MySqlParser.COMMA); + this.state = 4599; + this.match(MySqlParser.KW_DEFAULT_AUTH); + this.state = 4600; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4601; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stopGroupReplication() { + let localContext = new StopGroupReplicationContext(this.context, this.state); + this.enterRule(localContext, 362, MySqlParser.RULE_stopGroupReplication); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4604; + this.match(MySqlParser.KW_STOP); + this.state = 4605; + this.match(MySqlParser.KW_GROUP_REPLICATION); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + masterOption() { + let localContext = new MasterOptionContext(this.context, this.state); + this.enterRule(localContext, 364, MySqlParser.RULE_masterOption); + let _la; + try { + this.state = 4634; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_MASTER_BIND: + case MySqlParser.KW_MASTER_COMPRESSION_ALGORITHMS: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PUBLIC_KEY_PATH: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_CIPHERSUITES: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_NETWORK_NAMESPACE: + case MySqlParser.KW_RELAY_LOG_FILE: + localContext = new MasterStringOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4607; + this.stringMasterOption(); + this.state = 4608; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4609; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_ZSTD_COMPRESSION_LEVEL: + case MySqlParser.KW_RELAY_LOG_POS: + localContext = new MasterDecimalOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4611; + this.decimalMasterOption(); + this.state = 4612; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4613; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MASTER_SSL_VERIFY_SERVER_CERT: + case MySqlParser.KW_GET_MASTER_PUBLIC_KEY: + case MySqlParser.KW_GTID_ONLY: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_REQUIRE_ROW_FORMAT: + case MySqlParser.KW_SOURCE_CONNECTION_AUTO_FAILOVER: + localContext = new MasterBoolOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4615; + this.boolMasterOption(); + this.state = 4616; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4617; + localContext._boolVal = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolVal = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + localContext = new V8AddMasterOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4619; + this.v8NewMasterOption(); + } + break; + case MySqlParser.KW_IGNORE_SERVER_IDS: + localContext = new MasterUidListOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4620; + this.match(MySqlParser.KW_IGNORE_SERVER_IDS); + this.state = 4621; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4622; + this.match(MySqlParser.LR_BRACKET); + this.state = 4631; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4623; + localContext._server_id = this.uid(); + this.state = 4628; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4624; + this.match(MySqlParser.COMMA); + this.state = 4625; + localContext._server_id = this.uid(); + } + } + this.state = 4630; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4633; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stringMasterOption() { + let localContext = new StringMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 366, MySqlParser.RULE_stringMasterOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4636; + _la = this.tokenStream.LA(1); + if (!(_la === 108 || ((((_la - 455)) & ~0x1F) === 0 && ((1 << (_la - 455)) & 4190897) !== 0) || _la === 499 || _la === 557)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + decimalMasterOption() { + let localContext = new DecimalMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 368, MySqlParser.RULE_decimalMasterOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4638; + _la = this.tokenStream.LA(1); + if (!(((((_la - 456)) & ~0x1F) === 0 && ((1 << (_la - 456)) & 2097831) !== 0) || _la === 558)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + boolMasterOption() { + let localContext = new BoolMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 370, MySqlParser.RULE_boolMasterOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4640; + _la = this.tokenStream.LA(1); + if (!(_la === 109 || _la === 411 || _la === 416 || _la === 454 || _la === 466 || _la === 573 || _la === 617)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + v8NewMasterOption() { + let localContext = new V8NewMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 372, MySqlParser.RULE_v8NewMasterOption); + let _la; + try { + this.state = 4655; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + this.enterOuterAlt(localContext, 1); + { + this.state = 4642; + this.match(MySqlParser.KW_PRIVILEGE_CHECKS_USER); + this.state = 4643; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4644; + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + this.enterOuterAlt(localContext, 2); + { + this.state = 4645; + this.match(MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK); + this.state = 4646; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4647; + _la = this.tokenStream.LA(1); + if (!(_la === 118 || _la === 119 || _la === 507)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + this.enterOuterAlt(localContext, 3); + { + this.state = 4648; + this.match(MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS); + this.state = 4649; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4653; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_OFF: + { + this.state = 4650; + this.match(MySqlParser.KW_OFF); + } + break; + case MySqlParser.KW_LOCAL: + { + this.state = 4651; + this.match(MySqlParser.KW_LOCAL); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.STRING_LITERAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 4652; + this.gtuidSet(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replicationSourceOption() { + let localContext = new ReplicationSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 374, MySqlParser.RULE_replicationSourceOption); + let _la; + try { + this.state = 4684; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NETWORK_NAMESPACE: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_SOURCE_BIND: + case MySqlParser.KW_SOURCE_HOST: + case MySqlParser.KW_SOURCE_USER: + case MySqlParser.KW_SOURCE_PASSWORD: + case MySqlParser.KW_SOURCE_LOG_FILE: + case MySqlParser.KW_SOURCE_COMPRESSION_ALGORITHMS: + case MySqlParser.KW_SOURCE_SSL_CA: + case MySqlParser.KW_SOURCE_SSL_CAPATH: + case MySqlParser.KW_SOURCE_SSL_CERT: + case MySqlParser.KW_SOURCE_SSL_CRL: + case MySqlParser.KW_SOURCE_SSL_CRLPATH: + case MySqlParser.KW_SOURCE_SSL_KEY: + case MySqlParser.KW_SOURCE_SSL_CIPHER: + case MySqlParser.KW_SOURCE_TLS_VERSION: + case MySqlParser.KW_SOURCE_TLS_CIPHERSUITES: + case MySqlParser.KW_SOURCE_PUBLIC_KEY_PATH: + localContext = new SourceStringOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4657; + this.stringSourceOption(); + this.state = 4658; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4659; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_SOURCE_PORT: + case MySqlParser.KW_SOURCE_LOG_POS: + case MySqlParser.KW_SOURCE_HEARTBEAT_PERIOD: + case MySqlParser.KW_SOURCE_CONNECT_RETRY: + case MySqlParser.KW_SOURCE_RETRY_COUNT: + case MySqlParser.KW_SOURCE_DELAY: + case MySqlParser.KW_SOURCE_ZSTD_COMPRESSION_LEVEL: + localContext = new SourceDecimalOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4661; + this.decimalSourceOption(); + this.state = 4662; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4663; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_GET_SOURCE_PUBLIC_KEY: + case MySqlParser.KW_GTID_ONLY: + case MySqlParser.KW_REQUIRE_ROW_FORMAT: + case MySqlParser.KW_SOURCE_AUTO_POSITION: + case MySqlParser.KW_SOURCE_CONNECTION_AUTO_FAILOVER: + case MySqlParser.KW_SOURCE_SSL: + case MySqlParser.KW_SOURCE_SSL_VERIFY_SERVER_CERT: + localContext = new SourceBoolOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4665; + this.boolSourceOption(); + this.state = 4666; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4667; + localContext._boolVal = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolVal = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + localContext = new SourceOtherOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4669; + this.otherSourceOption(); + } + break; + case MySqlParser.KW_IGNORE_SERVER_IDS: + localContext = new SourceUidListOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4670; + this.match(MySqlParser.KW_IGNORE_SERVER_IDS); + this.state = 4671; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4672; + this.match(MySqlParser.LR_BRACKET); + this.state = 4681; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4673; + localContext._server_id = this.uid(); + this.state = 4678; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4674; + this.match(MySqlParser.COMMA); + this.state = 4675; + localContext._server_id = this.uid(); + } + } + this.state = 4680; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4683; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stringSourceOption() { + let localContext = new StringSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 376, MySqlParser.RULE_stringSourceOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4686; + _la = this.tokenStream.LA(1); + if (!(_la === 499 || _la === 557 || ((((_la - 606)) & ~0x1F) === 0 && ((1 << (_la - 606)) & 125771823) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + decimalSourceOption() { + let localContext = new DecimalSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 378, MySqlParser.RULE_decimalSourceOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4688; + _la = this.tokenStream.LA(1); + if (!(_la === 558 || ((((_la - 610)) & ~0x1F) === 0 && ((1 << (_la - 610)) & 1397) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + boolSourceOption() { + let localContext = new BoolSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 380, MySqlParser.RULE_boolSourceOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4690; + _la = this.tokenStream.LA(1); + if (!(_la === 412 || _la === 416 || _la === 573 || ((((_la - 613)) & ~0x1F) === 0 && ((1 << (_la - 613)) & 65809) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + otherSourceOption() { + let localContext = new OtherSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 382, MySqlParser.RULE_otherSourceOption); + let _la; + try { + this.state = 4705; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + this.enterOuterAlt(localContext, 1); + { + this.state = 4692; + this.match(MySqlParser.KW_PRIVILEGE_CHECKS_USER); + this.state = 4693; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4694; + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + this.enterOuterAlt(localContext, 2); + { + this.state = 4695; + this.match(MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK); + this.state = 4696; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4697; + _la = this.tokenStream.LA(1); + if (!(_la === 70 || _la === 118 || _la === 119 || _la === 507)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + this.enterOuterAlt(localContext, 3); + { + this.state = 4698; + this.match(MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS); + this.state = 4699; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4703; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_OFF: + { + this.state = 4700; + this.match(MySqlParser.KW_OFF); + } + break; + case MySqlParser.KW_LOCAL: + { + this.state = 4701; + this.match(MySqlParser.KW_LOCAL); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.STRING_LITERAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 4702; + this.gtuidSet(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + channelOption() { + let localContext = new ChannelOptionContext(this.context, this.state); + this.enterRule(localContext, 384, MySqlParser.RULE_channelOption); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4707; + this.match(MySqlParser.KW_FOR); + this.state = 4708; + this.match(MySqlParser.KW_CHANNEL); + this.state = 4709; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replicationFilter() { + let localContext = new ReplicationFilterContext(this.context, this.state); + this.enterRule(localContext, 386, MySqlParser.RULE_replicationFilter); + let _la; + try { + this.state = 4774; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_REPLICATE_DO_DB: + localContext = new DoDbReplicationContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4711; + this.match(MySqlParser.KW_REPLICATE_DO_DB); + this.state = 4712; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4713; + this.match(MySqlParser.LR_BRACKET); + this.state = 4714; + this.databaseName(); + this.state = 4719; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4715; + this.match(MySqlParser.COMMA); + this.state = 4716; + this.databaseName(); + } + } + this.state = 4721; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4722; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_IGNORE_DB: + localContext = new IgnoreDbReplicationContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4724; + this.match(MySqlParser.KW_REPLICATE_IGNORE_DB); + this.state = 4725; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4726; + this.match(MySqlParser.LR_BRACKET); + this.state = 4727; + this.databaseName(); + this.state = 4732; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4728; + this.match(MySqlParser.COMMA); + this.state = 4729; + this.databaseName(); + } + } + this.state = 4734; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4735; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_DO_TABLE: + localContext = new DoTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4737; + this.match(MySqlParser.KW_REPLICATE_DO_TABLE); + this.state = 4738; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4739; + this.match(MySqlParser.LR_BRACKET); + this.state = 4740; + this.tableNames(); + this.state = 4741; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + localContext = new IgnoreTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4743; + this.match(MySqlParser.KW_REPLICATE_IGNORE_TABLE); + this.state = 4744; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4745; + this.match(MySqlParser.LR_BRACKET); + this.state = 4746; + this.tableNames(); + this.state = 4747; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + localContext = new WildDoTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4749; + this.match(MySqlParser.KW_REPLICATE_WILD_DO_TABLE); + this.state = 4750; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4751; + this.match(MySqlParser.LR_BRACKET); + this.state = 4752; + this.simpleStrings(); + this.state = 4753; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + localContext = new WildIgnoreTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 4755; + this.match(MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE); + this.state = 4756; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4757; + this.match(MySqlParser.LR_BRACKET); + this.state = 4758; + this.simpleStrings(); + this.state = 4759; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_REWRITE_DB: + localContext = new RewriteDbReplicationContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 4761; + this.match(MySqlParser.KW_REPLICATE_REWRITE_DB); + this.state = 4762; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4763; + this.match(MySqlParser.LR_BRACKET); + this.state = 4764; + this.tablePair(); + this.state = 4769; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4765; + this.match(MySqlParser.COMMA); + this.state = 4766; + this.tablePair(); + } + } + this.state = 4771; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4772; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablePair() { + let localContext = new TablePairContext(this.context, this.state); + this.enterRule(localContext, 388, MySqlParser.RULE_tablePair); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4776; + this.match(MySqlParser.LR_BRACKET); + this.state = 4777; + localContext._firstTable = this.tableName(); + this.state = 4778; + this.match(MySqlParser.COMMA); + this.state = 4779; + localContext._secondTable = this.tableName(); + this.state = 4780; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + threadType() { + let localContext = new ThreadTypeContext(this.context, this.state); + this.enterRule(localContext, 390, MySqlParser.RULE_threadType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4782; + _la = this.tokenStream.LA(1); + if (!(_la === 438 || _la === 639)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + untilOption() { + let localContext = new UntilOptionContext(this.context, this.state); + this.enterRule(localContext, 392, MySqlParser.RULE_untilOption); + let _la; + try { + this.state = 4809; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + localContext = new GtidsUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4784; + localContext._gtids = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 633 || _la === 635)) { + localContext._gtids = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4785; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4786; + this.gtuidSet(); + } + break; + case MySqlParser.KW_MASTER_LOG_FILE: + localContext = new MasterLogUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4787; + this.match(MySqlParser.KW_MASTER_LOG_FILE); + this.state = 4788; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4789; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4790; + this.match(MySqlParser.COMMA); + this.state = 4791; + this.match(MySqlParser.KW_MASTER_LOG_POS); + this.state = 4792; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4793; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SOURCE_LOG_FILE: + localContext = new SourceLogUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4794; + this.match(MySqlParser.KW_SOURCE_LOG_FILE); + this.state = 4795; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4796; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4797; + this.match(MySqlParser.COMMA); + this.state = 4798; + this.match(MySqlParser.KW_SOURCE_LOG_POS); + this.state = 4799; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4800; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_RELAY_LOG_FILE: + localContext = new RelayLogUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4801; + this.match(MySqlParser.KW_RELAY_LOG_FILE); + this.state = 4802; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4803; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4804; + this.match(MySqlParser.COMMA); + this.state = 4805; + this.match(MySqlParser.KW_RELAY_LOG_POS); + this.state = 4806; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4807; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + localContext = new SqlGapsUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4808; + this.match(MySqlParser.KW_SQL_AFTER_MTS_GAPS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + connectionOptions() { + let localContext = new ConnectionOptionsContext(this.context, this.state); + this.enterRule(localContext, 394, MySqlParser.RULE_connectionOptions); + try { + this.state = 4823; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_USER: + localContext = new UserConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4811; + this.match(MySqlParser.KW_USER); + this.state = 4812; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4813; + localContext._conOptUser = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PASSWORD: + localContext = new PasswordConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4814; + this.match(MySqlParser.KW_PASSWORD); + this.state = 4815; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4816; + localContext._conOptPassword = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_DEFAULT_AUTH: + localContext = new DefaultAuthConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4817; + this.match(MySqlParser.KW_DEFAULT_AUTH); + this.state = 4818; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4819; + localContext._conOptDefAuth = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PLUGIN_DIR: + localContext = new PluginDirConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4820; + this.match(MySqlParser.KW_PLUGIN_DIR); + this.state = 4821; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4822; + localContext._conOptPluginDir = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + gtuidSet() { + let localContext = new GtuidSetContext(this.context, this.state); + this.enterRule(localContext, 396, MySqlParser.RULE_gtuidSet); + try { + let alternative; + this.state = 4834; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 4825; + this.uuidSet(); + this.state = 4830; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 680, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4826; + this.match(MySqlParser.COMMA); + this.state = 4827; + this.uuidSet(); + } + } + } + this.state = 4832; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 680, this.context); + } + } + break; + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 2); + { + this.state = 4833; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaStartTransaction() { + let localContext = new XaStartTransactionContext(this.context, this.state); + this.enterRule(localContext, 398, MySqlParser.RULE_xaStartTransaction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4836; + this.match(MySqlParser.KW_XA); + this.state = 4837; + localContext._xaStart = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 317 || _la === 640)) { + localContext._xaStart = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4838; + this.xid(); + this.state = 4840; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 91 || _la === 577) { + { + this.state = 4839; + localContext._xaAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 91 || _la === 577)) { + localContext._xaAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaEndTransaction() { + let localContext = new XaEndTransactionContext(this.context, this.state); + this.enterRule(localContext, 400, MySqlParser.RULE_xaEndTransaction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4842; + this.match(MySqlParser.KW_XA); + this.state = 4843; + this.match(MySqlParser.KW_END); + this.state = 4844; + this.xid(); + this.state = 4850; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 654) { + { + this.state = 4845; + this.match(MySqlParser.KW_SUSPEND); + this.state = 4848; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4846; + this.match(MySqlParser.KW_FOR); + this.state = 4847; + this.match(MySqlParser.KW_MIGRATE); + } + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaPrepareStatement() { + let localContext = new XaPrepareStatementContext(this.context, this.state); + this.enterRule(localContext, 402, MySqlParser.RULE_xaPrepareStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4852; + this.match(MySqlParser.KW_XA); + this.state = 4853; + this.match(MySqlParser.KW_PREPARE); + this.state = 4854; + this.xid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaCommitWork() { + let localContext = new XaCommitWorkContext(this.context, this.state); + this.enterRule(localContext, 404, MySqlParser.RULE_xaCommitWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4856; + this.match(MySqlParser.KW_XA); + this.state = 4857; + this.match(MySqlParser.KW_COMMIT); + this.state = 4858; + this.xid(); + this.state = 4861; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 513) { + { + this.state = 4859; + this.match(MySqlParser.KW_ONE); + this.state = 4860; + this.match(MySqlParser.KW_PHASE); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaRollbackWork() { + let localContext = new XaRollbackWorkContext(this.context, this.state); + this.enterRule(localContext, 406, MySqlParser.RULE_xaRollbackWork); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4863; + this.match(MySqlParser.KW_XA); + this.state = 4864; + this.match(MySqlParser.KW_ROLLBACK); + this.state = 4865; + this.xid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaRecoverWork() { + let localContext = new XaRecoverWorkContext(this.context, this.state); + this.enterRule(localContext, 408, MySqlParser.RULE_xaRecoverWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4867; + this.match(MySqlParser.KW_XA); + this.state = 4868; + this.match(MySqlParser.KW_RECOVER); + this.state = 4871; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 33) { + { + this.state = 4869; + this.match(MySqlParser.KW_CONVERT); + this.state = 4870; + this.xid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + prepareStatement() { + let localContext = new PrepareStatementContext(this.context, this.state); + this.enterRule(localContext, 410, MySqlParser.RULE_prepareStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4873; + this.match(MySqlParser.KW_PREPARE); + this.state = 4874; + localContext._stmt_name = this.uid(); + this.state = 4875; + this.match(MySqlParser.KW_FROM); + this.state = 4878; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 4876; + localContext._query = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.LOCAL_ID: + { + this.state = 4877; + localContext._variable = this.match(MySqlParser.LOCAL_ID); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + executeStatement() { + let localContext = new ExecuteStatementContext(this.context, this.state); + this.enterRule(localContext, 412, MySqlParser.RULE_executeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4880; + this.match(MySqlParser.KW_EXECUTE); + this.state = 4881; + localContext._stmt_name = this.uid(); + this.state = 4884; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 4882; + this.match(MySqlParser.KW_USING); + this.state = 4883; + this.userVariables(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + deallocatePrepare() { + let localContext = new DeallocatePrepareContext(this.context, this.state); + this.enterRule(localContext, 414, MySqlParser.RULE_deallocatePrepare); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4886; + localContext._dropFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 51 || _la === 362)) { + localContext._dropFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4887; + this.match(MySqlParser.KW_PREPARE); + this.state = 4888; + localContext._stmt_name = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + routineBody() { + let localContext = new RoutineBodyContext(this.context, this.state); + this.enterRule(localContext, 416, MySqlParser.RULE_routineBody); + try { + this.state = 4892; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 689, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4890; + this.blockStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4891; + this.sqlStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + blockStatement() { + let localContext = new BlockStatementContext(this.context, this.state); + this.enterRule(localContext, 418, MySqlParser.RULE_blockStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4897; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 690, this.context)) { + case 1: + { + this.state = 4894; + localContext._begin = this.uid(); + this.state = 4895; + this.match(MySqlParser.COLON_SYMB); + } + break; + } + this.state = 4899; + this.match(MySqlParser.KW_BEGIN); + this.state = 4905; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 691, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4900; + this.declareVariable(); + this.state = 4901; + this.match(MySqlParser.SEMI); + } + } + } + this.state = 4907; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 691, this.context); + } + this.state = 4913; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 692, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4908; + this.declareCondition(); + this.state = 4909; + this.match(MySqlParser.SEMI); + } + } + } + this.state = 4915; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 692, this.context); + } + this.state = 4921; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 693, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4916; + this.declareCursor(); + this.state = 4917; + this.match(MySqlParser.SEMI); + } + } + } + this.state = 4923; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 693, this.context); + } + this.state = 4929; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 41) { + { + { + this.state = 4924; + this.declareHandler(); + this.state = 4925; + this.match(MySqlParser.SEMI); + } + } + this.state = 4931; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4935; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 695, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4932; + this.procedureSqlStatement(); + } + } + } + this.state = 4937; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 695, this.context); + } + this.state = 4938; + this.match(MySqlParser.KW_END); + this.state = 4940; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 696, this.context)) { + case 1: + { + this.state = 4939; + localContext._end = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + caseStatement() { + let localContext = new CaseStatementContext(this.context, this.state); + this.enterRule(localContext, 420, MySqlParser.RULE_caseStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4942; + this.match(MySqlParser.KW_CASE); + this.state = 4945; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 697, this.context)) { + case 1: + { + this.state = 4943; + localContext._case_value = this.uid(); + } + break; + case 2: + { + this.state = 4944; + this.expression(0); + } + break; + } + this.state = 4948; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 4947; + this.caseAlternative(); + } + } + this.state = 4950; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 191); + this.state = 4958; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 4952; + this.match(MySqlParser.KW_ELSE); + this.state = 4954; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4953; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4956; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 699, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + this.state = 4960; + this.match(MySqlParser.KW_END); + this.state = 4961; + this.match(MySqlParser.KW_CASE); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ifStatement() { + let localContext = new IfStatementContext(this.context, this.state); + this.enterRule(localContext, 422, MySqlParser.RULE_ifStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4963; + this.match(MySqlParser.KW_IF); + this.state = 4964; + this.expression(0); + this.state = 4965; + this.match(MySqlParser.KW_THEN); + this.state = 4967; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4966; + localContext._procedureSqlStatement = this.procedureSqlStatement(); + localContext._thenStatements.push(localContext._procedureSqlStatement); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4969; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 701, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 4974; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 54) { + { + { + this.state = 4971; + this.elifAlternative(); + } + } + this.state = 4976; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4983; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 4977; + this.match(MySqlParser.KW_ELSE); + this.state = 4979; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4978; + localContext._procedureSqlStatement = this.procedureSqlStatement(); + localContext._elseStatements.push(localContext._procedureSqlStatement); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4981; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 703, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + this.state = 4985; + this.match(MySqlParser.KW_END); + this.state = 4986; + this.match(MySqlParser.KW_IF); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + iterateStatement() { + let localContext = new IterateStatementContext(this.context, this.state); + this.enterRule(localContext, 424, MySqlParser.RULE_iterateStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4988; + this.match(MySqlParser.KW_ITERATE); + this.state = 4989; + localContext._label = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + leaveStatement() { + let localContext = new LeaveStatementContext(this.context, this.state); + this.enterRule(localContext, 426, MySqlParser.RULE_leaveStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4991; + this.match(MySqlParser.KW_LEAVE); + this.state = 4992; + localContext._label = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loopStatement() { + let localContext = new LoopStatementContext(this.context, this.state); + this.enterRule(localContext, 428, MySqlParser.RULE_loopStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4997; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4994; + localContext._begin_label = this.uid(); + this.state = 4995; + this.match(MySqlParser.COLON_SYMB); + } + } + this.state = 4999; + this.match(MySqlParser.KW_LOOP); + this.state = 5001; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5000; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5003; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 706, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 5005; + this.match(MySqlParser.KW_END); + this.state = 5006; + this.match(MySqlParser.KW_LOOP); + this.state = 5008; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5007; + localContext._end_label = this.uid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + repeatStatement() { + let localContext = new RepeatStatementContext(this.context, this.state); + this.enterRule(localContext, 430, MySqlParser.RULE_repeatStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5013; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 708, this.context)) { + case 1: + { + this.state = 5010; + localContext._begin_label = this.uid(); + this.state = 5011; + this.match(MySqlParser.COLON_SYMB); + } + break; + } + this.state = 5015; + this.match(MySqlParser.KW_REPEAT); + this.state = 5017; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5016; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5019; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 709, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 5021; + this.match(MySqlParser.KW_UNTIL); + this.state = 5022; + this.expression(0); + this.state = 5023; + this.match(MySqlParser.KW_END); + this.state = 5024; + this.match(MySqlParser.KW_REPEAT); + this.state = 5026; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5025; + localContext._end_label = this.uid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + returnStatement() { + let localContext = new ReturnStatementContext(this.context, this.state); + this.enterRule(localContext, 432, MySqlParser.RULE_returnStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5028; + this.match(MySqlParser.KW_RETURN); + this.state = 5029; + this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + whileStatement() { + let localContext = new WhileStatementContext(this.context, this.state); + this.enterRule(localContext, 434, MySqlParser.RULE_whileStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5034; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5031; + localContext._begin_label = this.uid(); + this.state = 5032; + this.match(MySqlParser.COLON_SYMB); + } + } + this.state = 5036; + this.match(MySqlParser.KW_WHILE); + this.state = 5037; + this.expression(0); + this.state = 5038; + this.match(MySqlParser.KW_DO); + this.state = 5040; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5039; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5042; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 712, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 5044; + this.match(MySqlParser.KW_END); + this.state = 5045; + this.match(MySqlParser.KW_WHILE); + this.state = 5047; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5046; + localContext._end_label = this.uid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + cursorStatement() { + let localContext = new CursorStatementContext(this.context, this.state); + this.enterRule(localContext, 436, MySqlParser.RULE_cursorStatement); + let _la; + try { + this.state = 5064; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CLOSE: + localContext = new CloseCursorContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5049; + this.match(MySqlParser.KW_CLOSE); + this.state = 5050; + localContext._cursor_name = this.uid(); + } + break; + case MySqlParser.KW_FETCH: + localContext = new FetchCursorContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5051; + this.match(MySqlParser.KW_FETCH); + this.state = 5056; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 715, this.context)) { + case 1: + { + this.state = 5053; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 501) { + { + this.state = 5052; + this.match(MySqlParser.KW_NEXT); + } + } + this.state = 5055; + this.match(MySqlParser.KW_FROM); + } + break; + } + this.state = 5058; + localContext._cursor_name = this.uid(); + this.state = 5059; + this.match(MySqlParser.KW_INTO); + this.state = 5060; + localContext._var_names = this.uidList(); + } + break; + case MySqlParser.KW_OPEN: + localContext = new OpenCursorContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5062; + this.match(MySqlParser.KW_OPEN); + this.state = 5063; + localContext._cursor_name = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareVariable() { + let localContext = new DeclareVariableContext(this.context, this.state); + this.enterRule(localContext, 438, MySqlParser.RULE_declareVariable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5066; + this.match(MySqlParser.KW_DECLARE); + this.state = 5067; + localContext._var_names = this.uidList(); + this.state = 5068; + this.dataType(); + this.state = 5071; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 5069; + this.match(MySqlParser.KW_DEFAULT); + this.state = 5070; + this.expression(0); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareCondition() { + let localContext = new DeclareConditionContext(this.context, this.state); + this.enterRule(localContext, 440, MySqlParser.RULE_declareCondition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5073; + this.match(MySqlParser.KW_DECLARE); + this.state = 5074; + localContext._condition_name = this.uid(); + this.state = 5075; + this.match(MySqlParser.KW_CONDITION); + this.state = 5076; + this.match(MySqlParser.KW_FOR); + this.state = 5083; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5077; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SQLSTATE: + { + this.state = 5078; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 5080; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 5079; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 5082; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareCursor() { + let localContext = new DeclareCursorContext(this.context, this.state); + this.enterRule(localContext, 442, MySqlParser.RULE_declareCursor); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5085; + this.match(MySqlParser.KW_DECLARE); + this.state = 5086; + localContext._condition_name = this.uid(); + this.state = 5087; + this.match(MySqlParser.KW_CURSOR); + this.state = 5088; + this.match(MySqlParser.KW_FOR); + this.state = 5089; + this.selectStatement(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareHandler() { + let localContext = new DeclareHandlerContext(this.context, this.state); + this.enterRule(localContext, 444, MySqlParser.RULE_declareHandler); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5091; + this.match(MySqlParser.KW_DECLARE); + this.state = 5092; + localContext._handlerAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 32 || _la === 61 || _la === 180)) { + localContext._handlerAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5093; + this.match(MySqlParser.KW_HANDLER); + this.state = 5094; + this.match(MySqlParser.KW_FOR); + this.state = 5095; + this.handlerConditionValue(); + this.state = 5100; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5096; + this.match(MySqlParser.COMMA); + this.state = 5097; + this.handlerConditionValue(); + } + } + this.state = 5102; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5103; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerConditionValue() { + let localContext = new HandlerConditionValueContext(this.context, this.state); + this.enterRule(localContext, 446, MySqlParser.RULE_handlerConditionValue); + let _la; + try { + this.state = 5116; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + localContext = new HandlerConditionCodeContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5105; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SQLSTATE: + localContext = new HandlerConditionStateContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5106; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 5108; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 5107; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 5110; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + localContext = new HandlerConditionNameContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5111; + localContext._condition_name = this.uid(); + } + break; + case MySqlParser.KW_SQLWARNING: + localContext = new HandlerConditionWarningContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 5112; + this.match(MySqlParser.KW_SQLWARNING); + } + break; + case MySqlParser.KW_NOT: + localContext = new HandlerConditionNotfoundContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 5113; + this.match(MySqlParser.KW_NOT); + this.state = 5114; + this.match(MySqlParser.KW_FOUND); + } + break; + case MySqlParser.KW_SQLEXCEPTION: + localContext = new HandlerConditionExceptionContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 5115; + this.match(MySqlParser.KW_SQLEXCEPTION); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + procedureSqlStatement() { + let localContext = new ProcedureSqlStatementContext(this.context, this.state); + this.enterRule(localContext, 448, MySqlParser.RULE_procedureSqlStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5120; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 723, this.context)) { + case 1: + { + this.state = 5118; + this.compoundStatement(); + } + break; + case 2: + { + this.state = 5119; + this.sqlStatement(); + } + break; + } + this.state = 5122; + this.match(MySqlParser.SEMI); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + caseAlternative() { + let localContext = new CaseAlternativeContext(this.context, this.state); + this.enterRule(localContext, 450, MySqlParser.RULE_caseAlternative); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5124; + this.match(MySqlParser.KW_WHEN); + this.state = 5127; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 724, this.context)) { + case 1: + { + this.state = 5125; + this.constant(); + } + break; + case 2: + { + this.state = 5126; + this.expression(0); + } + break; + } + this.state = 5129; + this.match(MySqlParser.KW_THEN); + this.state = 5131; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5130; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5133; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 725, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + elifAlternative() { + let localContext = new ElifAlternativeContext(this.context, this.state); + this.enterRule(localContext, 452, MySqlParser.RULE_elifAlternative); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5135; + this.match(MySqlParser.KW_ELSEIF); + this.state = 5136; + this.expression(0); + this.state = 5137; + this.match(MySqlParser.KW_THEN); + this.state = 5139; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5138; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5141; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 726, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterUser() { + let localContext = new AlterUserContext(this.context, this.state); + this.enterRule(localContext, 454, MySqlParser.RULE_alterUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5143; + this.match(MySqlParser.KW_ALTER); + this.state = 5144; + this.match(MySqlParser.KW_USER); + this.state = 5146; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 727, this.context)) { + case 1: + { + this.state = 5145; + this.ifExists(); + } + break; + } + this.state = 5204; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 739, this.context)) { + case 1: + { + { + this.state = 5148; + this.userSpecification(); + this.state = 5153; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5149; + this.match(MySqlParser.COMMA); + this.state = 5150; + this.userSpecification(); + } + } + this.state = 5155; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + case 2: + { + { + this.state = 5156; + this.alterUserAuthOption(); + this.state = 5161; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5157; + this.match(MySqlParser.COMMA); + this.state = 5158; + this.alterUserAuthOption(); + } + } + this.state = 5163; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5178; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 5164; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5176; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NONE: + { + this.state = 5165; + this.match(MySqlParser.KW_NONE); + } + break; + case MySqlParser.KW_SSL: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_X509: + { + this.state = 5166; + this.tlsOption(); + this.state = 5173; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 11 || _la === 169 || _la === 331 || _la === 441 || _la === 651 || _la === 693) { + { + { + this.state = 5168; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5167; + this.match(MySqlParser.KW_AND); + } + } + this.state = 5170; + this.tlsOption(); + } + } + this.state = 5175; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5186; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 735, this.context)) { + case 1: + { + this.state = 5180; + this.match(MySqlParser.KW_WITH); + this.state = 5182; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 5181; + this.userResourceOption(); + } + } + this.state = 5184; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 51) !== 0)); + } + break; + } + this.state = 5192; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 304 || _la === 395 || _la === 529 || _la === 530) { + { + this.state = 5190; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + { + this.state = 5188; + this.userPasswordOption(); + } + break; + case MySqlParser.KW_ACCOUNT: + { + this.state = 5189; + this.userLockOption(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + this.state = 5194; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5197; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 15 || _la === 340) { + { + this.state = 5195; + _la = this.tokenStream.LA(1); + if (!(_la === 15 || _la === 340)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5196; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + break; + case 3: + { + { + { + this.state = 5199; + this.userOrRoleName(); + } + this.state = 5200; + this.match(MySqlParser.KW_DEFAULT); + this.state = 5201; + this.match(MySqlParser.KW_ROLE); + this.state = 5202; + this.roleOption(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createUser() { + let localContext = new CreateUserContext(this.context, this.state); + this.enterRule(localContext, 456, MySqlParser.RULE_createUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5206; + this.match(MySqlParser.KW_CREATE); + this.state = 5207; + this.match(MySqlParser.KW_USER); + this.state = 5209; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5208; + this.ifNotExists(); + } + } + this.state = 5211; + this.userName(); + this.state = 5213; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 423) { + { + this.state = 5212; + this.createUserAuthOption(); + } + } + this.state = 5222; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5215; + this.match(MySqlParser.COMMA); + this.state = 5216; + this.userName(); + this.state = 5218; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 423) { + { + this.state = 5217; + this.createUserAuthOption(); + } + } + } + } + this.state = 5224; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5228; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 5225; + this.match(MySqlParser.KW_DEFAULT); + this.state = 5226; + this.match(MySqlParser.KW_ROLE); + this.state = 5227; + this.roleOption(); + } + } + this.state = 5244; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 5230; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5242; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NONE: + { + this.state = 5231; + this.match(MySqlParser.KW_NONE); + } + break; + case MySqlParser.KW_SSL: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_X509: + { + this.state = 5232; + this.tlsOption(); + this.state = 5239; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 11 || _la === 169 || _la === 331 || _la === 441 || _la === 651 || _la === 693) { + { + { + this.state = 5234; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5233; + this.match(MySqlParser.KW_AND); + } + } + this.state = 5236; + this.tlsOption(); + } + } + this.state = 5241; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5252; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 750, this.context)) { + case 1: + { + this.state = 5246; + this.match(MySqlParser.KW_WITH); + this.state = 5248; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 5247; + this.userResourceOption(); + } + } + this.state = 5250; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 51) !== 0)); + } + break; + } + this.state = 5258; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 304 || _la === 395 || _la === 529 || _la === 530) { + { + this.state = 5256; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + { + this.state = 5254; + this.userPasswordOption(); + } + break; + case MySqlParser.KW_ACCOUNT: + { + this.state = 5255; + this.userLockOption(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + this.state = 5260; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5263; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 15 || _la === 340) { + { + this.state = 5261; + _la = this.tokenStream.LA(1); + if (!(_la === 15 || _la === 340)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5262; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropUser() { + let localContext = new DropUserContext(this.context, this.state); + this.enterRule(localContext, 458, MySqlParser.RULE_dropUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5265; + this.match(MySqlParser.KW_DROP); + this.state = 5266; + this.match(MySqlParser.KW_USER); + this.state = 5268; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5267; + this.ifExists(); + } + } + this.state = 5270; + this.userName(); + this.state = 5275; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5271; + this.match(MySqlParser.COMMA); + this.state = 5272; + this.userName(); + } + } + this.state = 5277; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + grantStatement() { + let localContext = new GrantStatementContext(this.context, this.state); + this.enterRule(localContext, 460, MySqlParser.RULE_grantStatement); + let _la; + try { + let alternative; + this.state = 5367; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 773, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5278; + this.match(MySqlParser.KW_GRANT); + this.state = 5279; + this.privelegeClause(); + this.state = 5284; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5280; + this.match(MySqlParser.COMMA); + this.state = 5281; + this.privelegeClause(); + } + } + this.state = 5286; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5287; + this.match(MySqlParser.KW_ON); + this.state = 5289; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 757, this.context)) { + case 1: + { + this.state = 5288; + this.privilegeObjectType(); + } + break; + } + this.state = 5291; + this.privilegeLevel(); + this.state = 5292; + this.match(MySqlParser.KW_TO); + this.state = 5302; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 759, this.context)) { + case 1: + { + { + this.state = 5293; + this.userAuthOption(); + this.state = 5298; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5294; + this.match(MySqlParser.COMMA); + this.state = 5295; + this.userAuthOption(); + } + } + this.state = 5300; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + case 2: + { + this.state = 5301; + this.userOrRoleNames(); + } + break; + } + this.state = 5318; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 5304; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5316; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NONE: + { + this.state = 5305; + localContext._tlsNone = this.match(MySqlParser.KW_NONE); + } + break; + case MySqlParser.KW_SSL: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_X509: + { + this.state = 5306; + this.tlsOption(); + this.state = 5313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 11 || _la === 169 || _la === 331 || _la === 441 || _la === 651 || _la === 693) { + { + { + this.state = 5308; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5307; + this.match(MySqlParser.KW_AND); + } + } + this.state = 5310; + this.tlsOption(); + } + } + this.state = 5315; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5329; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 766, this.context)) { + case 1: + { + this.state = 5320; + this.match(MySqlParser.KW_WITH); + this.state = 5326; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 765, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + this.state = 5324; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_GRANT: + { + this.state = 5321; + this.match(MySqlParser.KW_GRANT); + this.state = 5322; + this.match(MySqlParser.KW_OPTION); + } + break; + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + { + this.state = 5323; + this.userResourceOption(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5328; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 765, this.context); + } + } + break; + } + this.state = 5338; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 5331; + this.match(MySqlParser.KW_AS); + this.state = 5332; + this.userName(); + this.state = 5336; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 767, this.context)) { + case 1: + { + this.state = 5333; + this.match(MySqlParser.KW_WITH); + this.state = 5334; + this.match(MySqlParser.KW_ROLE); + this.state = 5335; + this.roleOption(); + } + break; + } + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5340; + this.match(MySqlParser.KW_GRANT); + this.state = 5343; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 769, this.context)) { + case 1: + { + this.state = 5341; + this.match(MySqlParser.KW_PROXY); + this.state = 5342; + this.match(MySqlParser.KW_ON); + } + break; + } + { + this.state = 5345; + this.userOrRoleName(); + } + this.state = 5350; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5346; + this.match(MySqlParser.COMMA); + { + this.state = 5347; + this.userOrRoleName(); + } + } + } + this.state = 5352; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5353; + this.match(MySqlParser.KW_TO); + { + this.state = 5354; + this.userOrRoleName(); + } + this.state = 5359; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5355; + this.match(MySqlParser.COMMA); + { + this.state = 5356; + this.userOrRoleName(); + } + } + } + this.state = 5361; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5365; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 772, this.context)) { + case 1: + { + this.state = 5362; + this.match(MySqlParser.KW_WITH); + this.state = 5363; + this.match(MySqlParser.KW_ADMIN); + this.state = 5364; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + roleOption() { + let localContext = new RoleOptionContext(this.context, this.state); + this.enterRule(localContext, 462, MySqlParser.RULE_roleOption); + let _la; + try { + this.state = 5377; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 775, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5369; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5370; + this.match(MySqlParser.KW_NONE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5371; + this.match(MySqlParser.KW_ALL); + this.state = 5374; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 59) { + { + this.state = 5372; + this.match(MySqlParser.KW_EXCEPT); + this.state = 5373; + this.userOrRoleNames(); + } + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5376; + this.userOrRoleNames(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + grantProxy() { + let localContext = new GrantProxyContext(this.context, this.state); + this.enterRule(localContext, 464, MySqlParser.RULE_grantProxy); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5379; + this.match(MySqlParser.KW_GRANT); + this.state = 5380; + this.match(MySqlParser.KW_PROXY); + this.state = 5381; + this.match(MySqlParser.KW_ON); + this.state = 5382; + localContext._fromFirst = this.userName(); + this.state = 5383; + this.match(MySqlParser.KW_TO); + this.state = 5384; + localContext._toFirst = this.userName(); + this.state = 5389; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5385; + this.match(MySqlParser.COMMA); + this.state = 5386; + localContext._userName = this.userName(); + localContext._toOther.push(localContext._userName); + } + } + this.state = 5391; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5395; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 777, this.context)) { + case 1: + { + this.state = 5392; + this.match(MySqlParser.KW_WITH); + this.state = 5393; + this.match(MySqlParser.KW_GRANT); + this.state = 5394; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterResourceGroup() { + let localContext = new AlterResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 466, MySqlParser.RULE_alterResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5397; + this.match(MySqlParser.KW_ALTER); + this.state = 5398; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5399; + this.match(MySqlParser.KW_GROUP); + this.state = 5400; + this.groupName(); + this.state = 5406; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 190) { + { + this.state = 5401; + this.match(MySqlParser.KW_VCPU); + this.state = 5403; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5402; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5405; + this.resourceGroupVcpuSpec(); + } + } + this.state = 5413; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 837) { + { + this.state = 5408; + this.match(MySqlParser.KW_THREAD_PRIORITY); + this.state = 5410; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5409; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5412; + this.decimalLiteral(); + } + } + this.state = 5419; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 5415; + _la = this.tokenStream.LA(1); + if (!(_la === 368 || _la === 375)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5417; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 66) { + { + this.state = 5416; + this.match(MySqlParser.KW_FORCE); + } + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createResourceGroup() { + let localContext = new CreateResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 468, MySqlParser.RULE_createResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5421; + this.match(MySqlParser.KW_CREATE); + this.state = 5422; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5423; + this.match(MySqlParser.KW_GROUP); + this.state = 5424; + this.groupNameCreate(); + this.state = 5425; + this.match(MySqlParser.KW_TYPE); + this.state = 5426; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 5427; + _la = this.tokenStream.LA(1); + if (!(_la === 678 || _la === 835)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5433; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 190) { + { + this.state = 5428; + this.match(MySqlParser.KW_VCPU); + this.state = 5430; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5429; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5432; + this.resourceGroupVcpuSpec(); + } + } + this.state = 5440; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 837) { + { + this.state = 5435; + this.match(MySqlParser.KW_THREAD_PRIORITY); + this.state = 5437; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5436; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5439; + this.decimalLiteral(); + } + } + this.state = 5443; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 5442; + _la = this.tokenStream.LA(1); + if (!(_la === 368 || _la === 375)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropResourceGroup() { + let localContext = new DropResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 470, MySqlParser.RULE_dropResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5445; + this.match(MySqlParser.KW_DROP); + this.state = 5446; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5447; + this.match(MySqlParser.KW_GROUP); + this.state = 5448; + this.groupName(); + this.state = 5450; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 66) { + { + this.state = 5449; + this.match(MySqlParser.KW_FORCE); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setResourceGroup() { + let localContext = new SetResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 472, MySqlParser.RULE_setResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5452; + this.match(MySqlParser.KW_SET); + this.state = 5453; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5454; + this.match(MySqlParser.KW_GROUP); + this.state = 5455; + this.groupName(); + this.state = 5465; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 5456; + this.match(MySqlParser.KW_FOR); + this.state = 5457; + this.decimalLiteral(); + this.state = 5462; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5458; + this.match(MySqlParser.COMMA); + this.state = 5459; + this.decimalLiteral(); + } + } + this.state = 5464; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resourceGroupVcpuSpec() { + let localContext = new ResourceGroupVcpuSpecContext(this.context, this.state); + this.enterRule(localContext, 474, MySqlParser.RULE_resourceGroupVcpuSpec); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5472; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 792, this.context)) { + case 1: + { + this.state = 5467; + this.decimalLiteral(); + } + break; + case 2: + { + this.state = 5468; + this.decimalLiteral(); + this.state = 5469; + this.match(MySqlParser.MINUS); + this.state = 5470; + this.decimalLiteral(); + } + break; + } + this.state = 5478; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 793, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 5474; + this.match(MySqlParser.COMMA); + this.state = 5475; + this.resourceGroupVcpuSpec(); + } + } + } + this.state = 5480; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 793, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameUser() { + let localContext = new RenameUserContext(this.context, this.state); + this.enterRule(localContext, 476, MySqlParser.RULE_renameUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5481; + this.match(MySqlParser.KW_RENAME); + this.state = 5482; + this.match(MySqlParser.KW_USER); + this.state = 5483; + this.renameUserClause(); + this.state = 5488; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5484; + this.match(MySqlParser.COMMA); + this.state = 5485; + this.renameUserClause(); + } + } + this.state = 5490; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + revokeStatement() { + let localContext = new RevokeStatementContext(this.context, this.state); + this.enterRule(localContext, 478, MySqlParser.RULE_revokeStatement); + let _la; + try { + this.state = 5543; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 805, this.context)) { + case 1: + localContext = new DetailRevokeContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5491; + this.match(MySqlParser.KW_REVOKE); + this.state = 5493; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5492; + this.ifExists(); + } + } + this.state = 5495; + this.privelegeClause(); + this.state = 5500; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5496; + this.match(MySqlParser.COMMA); + this.state = 5497; + this.privelegeClause(); + } + } + this.state = 5502; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5503; + this.match(MySqlParser.KW_ON); + this.state = 5505; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 797, this.context)) { + case 1: + { + this.state = 5504; + this.privilegeObjectType(); + } + break; + } + this.state = 5507; + this.privilegeLevel(); + this.state = 5508; + this.match(MySqlParser.KW_FROM); + this.state = 5509; + this.userOrRoleNames(); + this.state = 5511; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 5510; + this.ignoreUnknownUser(); + } + } + } + break; + case 2: + localContext = new ShortRevokeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5513; + this.match(MySqlParser.KW_REVOKE); + this.state = 5515; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5514; + this.ifExists(); + } + } + this.state = 5517; + this.match(MySqlParser.KW_ALL); + this.state = 5519; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 734) { + { + this.state = 5518; + this.match(MySqlParser.KW_PRIVILEGES); + } + } + this.state = 5521; + this.match(MySqlParser.COMMA); + this.state = 5522; + this.match(MySqlParser.KW_GRANT); + this.state = 5523; + this.match(MySqlParser.KW_OPTION); + this.state = 5524; + this.match(MySqlParser.KW_FROM); + this.state = 5525; + this.userOrRoleNames(); + this.state = 5527; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 5526; + this.ignoreUnknownUser(); + } + } + } + break; + case 3: + localContext = new ProxyAndRoleRevokeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5529; + this.match(MySqlParser.KW_REVOKE); + this.state = 5531; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 802, this.context)) { + case 1: + { + this.state = 5530; + this.ifExists(); + } + break; + } + this.state = 5535; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 803, this.context)) { + case 1: + { + this.state = 5533; + this.match(MySqlParser.KW_PROXY); + this.state = 5534; + this.match(MySqlParser.KW_ON); + } + break; + } + this.state = 5537; + this.userOrRoleNames(); + this.state = 5538; + this.match(MySqlParser.KW_FROM); + this.state = 5539; + this.userOrRoleNames(); + this.state = 5541; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 5540; + this.ignoreUnknownUser(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ignoreUnknownUser() { + let localContext = new IgnoreUnknownUserContext(this.context, this.state); + this.enterRule(localContext, 480, MySqlParser.RULE_ignoreUnknownUser); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5545; + this.match(MySqlParser.KW_IGNORE); + this.state = 5546; + this.match(MySqlParser.KW_UNKNOWN); + this.state = 5547; + this.match(MySqlParser.KW_USER); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilegeObjectType() { + let localContext = new PrivilegeObjectTypeContext(this.context, this.state); + this.enterRule(localContext, 482, MySqlParser.RULE_privilegeObjectType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5549; + _la = this.tokenStream.LA(1); + if (!(_la === 132 || _la === 173 || _la === 409)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setPasswordStatement() { + let localContext = new SetPasswordStatementContext(this.context, this.state); + this.enterRule(localContext, 484, MySqlParser.RULE_setPasswordStatement); + let _la; + try { + this.state = 5583; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 812, this.context)) { + case 1: + localContext = new V57Context(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5551; + this.match(MySqlParser.KW_SET); + this.state = 5552; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5555; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 5553; + this.match(MySqlParser.KW_FOR); + this.state = 5554; + this.userName(); + } + } + this.state = 5557; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 5560; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_PASSWORD: + { + this.state = 5558; + this.passwordFunctionClause(); + } + break; + case MySqlParser.STRING_LITERAL: + { + this.state = 5559; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + localContext = new V80Context(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5562; + this.match(MySqlParser.KW_SET); + this.state = 5563; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5566; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 5564; + this.match(MySqlParser.KW_FOR); + this.state = 5565; + this.userName(); + } + } + this.state = 5572; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TO: + { + this.state = 5568; + this.match(MySqlParser.KW_TO); + this.state = 5569; + this.match(MySqlParser.KW_RANDOM); + } + break; + case MySqlParser.EQUAL_SYMBOL: + { + this.state = 5570; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 5571; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5576; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 810, this.context)) { + case 1: + { + this.state = 5574; + this.match(MySqlParser.KW_REPLACE); + this.state = 5575; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + this.state = 5581; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 147) { + { + this.state = 5578; + this.match(MySqlParser.KW_RETAIN); + this.state = 5579; + this.match(MySqlParser.KW_CURRENT); + this.state = 5580; + this.match(MySqlParser.KW_PASSWORD); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userSpecification() { + let localContext = new UserSpecificationContext(this.context, this.state); + this.enterRule(localContext, 486, MySqlParser.RULE_userSpecification); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5585; + this.userName(); + this.state = 5586; + this.userPasswordOption(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterUserAuthOption() { + let localContext = new AlterUserAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 488, MySqlParser.RULE_alterUserAuthOption); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5588; + this.userName(); + this.state = 5614; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 815, this.context)) { + case 1: + { + this.state = 5589; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5590; + this.match(MySqlParser.KW_BY); + this.state = 5591; + this.match(MySqlParser.STRING_LITERAL); + this.state = 5592; + this.authOptionClause(); + } + break; + case 2: + { + this.state = 5593; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5594; + this.match(MySqlParser.KW_BY); + this.state = 5595; + this.match(MySqlParser.KW_RANDOM); + this.state = 5596; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5597; + this.authOptionClause(); + } + break; + case 3: + { + this.state = 5598; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5599; + this.match(MySqlParser.KW_WITH); + this.state = 5600; + this.authenticationRule(); + } + break; + case 4: + { + this.state = 5601; + this.match(MySqlParser.KW_DISCARD); + this.state = 5602; + this.match(MySqlParser.KW_OLD); + this.state = 5603; + this.match(MySqlParser.KW_PASSWORD); + } + break; + case 5: + { + this.state = 5609; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5604; + _la = this.tokenStream.LA(1); + if (!(_la === 6 || _la === 51 || _la === 492)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5605; + this.factor(); + this.state = 5607; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 423) { + { + this.state = 5606; + this.factorAuthOption(); + } + } + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5611; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 814, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + case 6: + { + this.state = 5613; + this.registrationOption(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createUserAuthOption() { + let localContext = new CreateUserAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 490, MySqlParser.RULE_createUserAuthOption); + let _la; + try { + this.state = 5652; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 822, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5616; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5617; + this.match(MySqlParser.KW_BY); + this.state = 5623; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5618; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + { + this.state = 5619; + this.match(MySqlParser.KW_RANDOM); + this.state = 5620; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + case MySqlParser.KW_PASSWORD: + { + { + this.state = 5621; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5622; + this.match(MySqlParser.STRING_LITERAL); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5627; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5625; + this.match(MySqlParser.KW_AND); + this.state = 5626; + this.createUserAuthOption(); + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5629; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5630; + this.match(MySqlParser.KW_WITH); + this.state = 5631; + localContext._authPlugin = this.uid(); + this.state = 5640; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BY: + { + { + this.state = 5632; + this.match(MySqlParser.KW_BY); + this.state = 5636; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5633; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + { + this.state = 5634; + this.match(MySqlParser.KW_RANDOM); + this.state = 5635; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + break; + case MySqlParser.KW_AS: + { + this.state = 5638; + this.match(MySqlParser.KW_AS); + this.state = 5639; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_AND: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_REQUIRE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + this.state = 5644; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5642; + this.match(MySqlParser.KW_AND); + this.state = 5643; + this.createUserAuthOption(); + } + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5646; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5647; + this.match(MySqlParser.KW_WITH); + this.state = 5648; + localContext._authPlugin = this.uid(); + this.state = 5650; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 427) { + { + this.state = 5649; + this.createUserInitialAuthOption(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createUserInitialAuthOption() { + let localContext = new CreateUserInitialAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 492, MySqlParser.RULE_createUserInitialAuthOption); + try { + this.state = 5671; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 824, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5654; + this.match(MySqlParser.KW_INITIAL); + this.state = 5655; + this.match(MySqlParser.KW_AUTHENTICATION); + this.state = 5656; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5657; + this.match(MySqlParser.KW_BY); + this.state = 5661; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_RANDOM: + { + { + this.state = 5658; + this.match(MySqlParser.KW_RANDOM); + this.state = 5659; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + case MySqlParser.STRING_LITERAL: + { + this.state = 5660; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5663; + this.match(MySqlParser.KW_INITIAL); + this.state = 5664; + this.match(MySqlParser.KW_AUTHENTICATION); + this.state = 5665; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5666; + this.match(MySqlParser.KW_WITH); + this.state = 5667; + localContext._authPlugin = this.uid(); + this.state = 5668; + this.match(MySqlParser.KW_AS); + this.state = 5669; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userAuthOption() { + let localContext = new UserAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 494, MySqlParser.RULE_userAuthOption); + try { + this.state = 5698; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 825, this.context)) { + case 1: + localContext = new HashAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5673; + this.userName(); + this.state = 5674; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5675; + this.match(MySqlParser.KW_BY); + this.state = 5676; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5677; + localContext._hashed = this.match(MySqlParser.STRING_LITERAL); + } + break; + case 2: + localContext = new RandomAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5679; + this.userName(); + this.state = 5680; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5681; + this.match(MySqlParser.KW_BY); + this.state = 5682; + this.match(MySqlParser.KW_RANDOM); + this.state = 5683; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5684; + this.authOptionClause(); + } + break; + case 3: + localContext = new StringAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5686; + this.userName(); + this.state = 5687; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5688; + this.match(MySqlParser.KW_BY); + this.state = 5689; + this.match(MySqlParser.STRING_LITERAL); + this.state = 5690; + this.authOptionClause(); + } + break; + case 4: + localContext = new ModuleAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 5692; + this.userName(); + this.state = 5693; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5694; + this.match(MySqlParser.KW_WITH); + this.state = 5695; + this.authenticationRule(); + } + break; + case 5: + localContext = new SimpleAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 5697; + this.userName(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + authOptionClause() { + let localContext = new AuthOptionClauseContext(this.context, this.state); + this.enterRule(localContext, 496, MySqlParser.RULE_authOptionClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5702; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 826, this.context)) { + case 1: + { + this.state = 5700; + this.match(MySqlParser.KW_REPLACE); + this.state = 5701; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + this.state = 5707; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 147) { + { + this.state = 5704; + this.match(MySqlParser.KW_RETAIN); + this.state = 5705; + this.match(MySqlParser.KW_CURRENT); + this.state = 5706; + this.match(MySqlParser.KW_PASSWORD); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + authenticationRule() { + let localContext = new AuthenticationRuleContext(this.context, this.state); + this.enterRule(localContext, 498, MySqlParser.RULE_authenticationRule); + let _la; + try { + this.state = 5723; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 830, this.context)) { + case 1: + localContext = new ModuleContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5709; + localContext._authPlugin = this.uid(); + this.state = 5717; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 829, this.context)) { + case 1: + { + this.state = 5710; + _la = this.tokenStream.LA(1); + if (!(_la === 13 || _la === 20 || _la === 188)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5714; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5711; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + this.state = 5712; + this.match(MySqlParser.KW_RANDOM); + this.state = 5713; + this.match(MySqlParser.KW_PASSWORD); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5716; + this.authOptionClause(); + } + break; + } + } + break; + case 2: + localContext = new PasswordModuleOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5719; + localContext._authPlugin = this.uid(); + this.state = 5720; + this.match(MySqlParser.KW_USING); + this.state = 5721; + this.passwordFunctionClause(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tlsOption() { + let localContext = new TlsOptionContext(this.context, this.state); + this.enterRule(localContext, 500, MySqlParser.RULE_tlsOption); + try { + this.state = 5733; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SSL: + this.enterOuterAlt(localContext, 1); + { + this.state = 5725; + this.match(MySqlParser.KW_SSL); + } + break; + case MySqlParser.KW_X509: + this.enterOuterAlt(localContext, 2); + { + this.state = 5726; + this.match(MySqlParser.KW_X509); + } + break; + case MySqlParser.KW_CIPHER: + this.enterOuterAlt(localContext, 3); + { + this.state = 5727; + this.match(MySqlParser.KW_CIPHER); + this.state = 5728; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ISSUER: + this.enterOuterAlt(localContext, 4); + { + this.state = 5729; + this.match(MySqlParser.KW_ISSUER); + this.state = 5730; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_SUBJECT: + this.enterOuterAlt(localContext, 5); + { + this.state = 5731; + this.match(MySqlParser.KW_SUBJECT); + this.state = 5732; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userResourceOption() { + let localContext = new UserResourceOptionContext(this.context, this.state); + this.enterRule(localContext, 502, MySqlParser.RULE_userResourceOption); + try { + this.state = 5743; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + this.enterOuterAlt(localContext, 1); + { + this.state = 5735; + this.match(MySqlParser.KW_MAX_QUERIES_PER_HOUR); + this.state = 5736; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + this.enterOuterAlt(localContext, 2); + { + this.state = 5737; + this.match(MySqlParser.KW_MAX_UPDATES_PER_HOUR); + this.state = 5738; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + this.enterOuterAlt(localContext, 3); + { + this.state = 5739; + this.match(MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR); + this.state = 5740; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MAX_USER_CONNECTIONS: + this.enterOuterAlt(localContext, 4); + { + this.state = 5741; + this.match(MySqlParser.KW_MAX_USER_CONNECTIONS); + this.state = 5742; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userPasswordOption() { + let localContext = new UserPasswordOptionContext(this.context, this.state); + this.enterRule(localContext, 504, MySqlParser.RULE_userPasswordOption); + let _la; + try { + this.state = 5783; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 838, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5745; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5746; + this.match(MySqlParser.KW_EXPIRE); + this.state = 5753; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 5747; + localContext._expireType = this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.KW_NEVER: + { + this.state = 5748; + localContext._expireType = this.match(MySqlParser.KW_NEVER); + } + break; + case MySqlParser.KW_INTERVAL: + { + this.state = 5749; + localContext._expireType = this.match(MySqlParser.KW_INTERVAL); + this.state = 5750; + this.decimalLiteral(); + this.state = 5751; + this.match(MySqlParser.KW_DAY); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5755; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5756; + this.match(MySqlParser.KW_HISTORY); + this.state = 5759; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 5757; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5758; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5761; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5762; + this.match(MySqlParser.KW_REUSE); + this.state = 5763; + this.match(MySqlParser.KW_INTERVAL); + this.state = 5768; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 5764; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5765; + this.decimalLiteral(); + this.state = 5766; + this.match(MySqlParser.KW_DAY); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5770; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5771; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5772; + this.match(MySqlParser.KW_CURRENT); + this.state = 5774; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42 || _la === 122) { + { + this.state = 5773; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 122)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 5776; + this.match(MySqlParser.KW_FAILED_LOGIN_ATTEMPTS); + this.state = 5777; + this.decimalLiteral(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 5778; + this.match(MySqlParser.KW_PASSWORD_LOCK_TIME); + this.state = 5781; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5779; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_UNBOUNDED: + { + this.state = 5780; + this.match(MySqlParser.KW_UNBOUNDED); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userLockOption() { + let localContext = new UserLockOptionContext(this.context, this.state); + this.enterRule(localContext, 506, MySqlParser.RULE_userLockOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5785; + this.match(MySqlParser.KW_ACCOUNT); + this.state = 5786; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 104 || _la === 183)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + factorAuthOption() { + let localContext = new FactorAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 508, MySqlParser.RULE_factorAuthOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5788; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5791; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 5789; + this.match(MySqlParser.KW_WITH); + this.state = 5790; + localContext._authPlugin = this.uid(); + } + } + this.state = 5801; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BY: + { + { + this.state = 5793; + this.match(MySqlParser.KW_BY); + this.state = 5797; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5794; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + { + this.state = 5795; + this.match(MySqlParser.KW_RANDOM); + this.state = 5796; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + break; + case MySqlParser.KW_AS: + { + this.state = 5799; + this.match(MySqlParser.KW_AS); + this.state = 5800; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + registrationOption() { + let localContext = new RegistrationOptionContext(this.context, this.state); + this.enterRule(localContext, 510, MySqlParser.RULE_registrationOption); + try { + this.state = 5818; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 842, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5803; + this.factor(); + this.state = 5804; + this.match(MySqlParser.KW_INITIATE); + this.state = 5805; + this.match(MySqlParser.KW_REGISTRATION); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5807; + this.factor(); + this.state = 5808; + this.match(MySqlParser.KW_FINISH); + this.state = 5809; + this.match(MySqlParser.KW_REGISTRATION); + this.state = 5810; + this.match(MySqlParser.KW_SET); + this.state = 5811; + this.match(MySqlParser.KW_CHALLENGE_RESPONSE); + this.state = 5812; + this.match(MySqlParser.KW_AS); + this.state = 5813; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5815; + this.factor(); + this.state = 5816; + this.match(MySqlParser.KW_UNREGISTER); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + factor() { + let localContext = new FactorContext(this.context, this.state); + this.enterRule(localContext, 512, MySqlParser.RULE_factor); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5820; + _la = this.tokenStream.LA(1); + if (!(_la === 873 || _la === 874)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5821; + this.match(MySqlParser.KW_FACTOR); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privelegeClause() { + let localContext = new PrivelegeClauseContext(this.context, this.state); + this.enterRule(localContext, 514, MySqlParser.RULE_privelegeClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5823; + this.privilege(); + this.state = 5828; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 5824; + this.match(MySqlParser.LR_BRACKET); + this.state = 5825; + this.columnNames(); + this.state = 5826; + this.match(MySqlParser.RR_BRACKET); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilege() { + let localContext = new PrivilegeContext(this.context, this.state); + this.enterRule(localContext, 516, MySqlParser.RULE_privilege); + let _la; + try { + this.state = 5923; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 848, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5830; + this.match(MySqlParser.KW_ALL); + this.state = 5832; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 734) { + { + this.state = 5831; + this.match(MySqlParser.KW_PRIVILEGES); + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5834; + this.match(MySqlParser.KW_ALTER); + this.state = 5836; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 743) { + { + this.state = 5835; + this.match(MySqlParser.KW_ROUTINE); + } + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5838; + this.match(MySqlParser.KW_CREATE); + this.state = 5846; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TEMPORARY: + { + this.state = 5839; + this.match(MySqlParser.KW_TEMPORARY); + this.state = 5840; + this.match(MySqlParser.KW_TABLES); + } + break; + case MySqlParser.KW_ROUTINE: + { + this.state = 5841; + this.match(MySqlParser.KW_ROUTINE); + } + break; + case MySqlParser.KW_VIEW: + { + this.state = 5842; + this.match(MySqlParser.KW_VIEW); + } + break; + case MySqlParser.KW_USER: + { + this.state = 5843; + this.match(MySqlParser.KW_USER); + } + break; + case MySqlParser.KW_TABLESPACE: + { + this.state = 5844; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case MySqlParser.KW_ROLE: + { + this.state = 5845; + this.match(MySqlParser.KW_ROLE); + } + break; + case MySqlParser.KW_ON: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + break; + default: + break; + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5848; + this.match(MySqlParser.KW_DELETE); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 5849; + this.match(MySqlParser.KW_DROP); + this.state = 5851; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 582) { + { + this.state = 5850; + this.match(MySqlParser.KW_ROLE); + } + } + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 5853; + this.match(MySqlParser.KW_EVENT); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 5854; + this.match(MySqlParser.KW_EXECUTE); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 5855; + this.match(MySqlParser.KW_FILE); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 5856; + this.match(MySqlParser.KW_GRANT); + this.state = 5857; + this.match(MySqlParser.KW_OPTION); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 5858; + this.match(MySqlParser.KW_INDEX); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 5859; + this.match(MySqlParser.KW_INSERT); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 5860; + this.match(MySqlParser.KW_LOCK); + this.state = 5861; + this.match(MySqlParser.KW_TABLES); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 5862; + this.match(MySqlParser.KW_PROCESS); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 5863; + this.match(MySqlParser.KW_PROXY); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 5864; + this.match(MySqlParser.KW_REFERENCES); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 5865; + this.match(MySqlParser.KW_RELOAD); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 5866; + this.match(MySqlParser.KW_REPLICATION); + this.state = 5867; + _la = this.tokenStream.LA(1); + if (!(_la === 333 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 18: + this.enterOuterAlt(localContext, 18); + { + this.state = 5868; + this.match(MySqlParser.KW_SELECT); + } + break; + case 19: + this.enterOuterAlt(localContext, 19); + { + this.state = 5869; + this.match(MySqlParser.KW_SHOW); + this.state = 5870; + _la = this.tokenStream.LA(1); + if (!(_la === 40 || _la === 684)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 20: + this.enterOuterAlt(localContext, 20); + { + this.state = 5871; + this.match(MySqlParser.KW_SHUTDOWN); + } + break; + case 21: + this.enterOuterAlt(localContext, 21); + { + this.state = 5872; + this.match(MySqlParser.KW_SUPER); + } + break; + case 22: + this.enterOuterAlt(localContext, 22); + { + this.state = 5873; + this.match(MySqlParser.KW_TRIGGER); + } + break; + case 23: + this.enterOuterAlt(localContext, 23); + { + this.state = 5874; + this.match(MySqlParser.KW_UPDATE); + } + break; + case 24: + this.enterOuterAlt(localContext, 24); + { + this.state = 5875; + this.match(MySqlParser.KW_USAGE); + } + break; + case 25: + this.enterOuterAlt(localContext, 25); + { + this.state = 5876; + this.match(MySqlParser.KW_APPLICATION_PASSWORD_ADMIN); + } + break; + case 26: + this.enterOuterAlt(localContext, 26); + { + this.state = 5877; + this.match(MySqlParser.KW_AUDIT_ABORT_EXEMPT); + } + break; + case 27: + this.enterOuterAlt(localContext, 27); + { + this.state = 5878; + this.match(MySqlParser.KW_AUDIT_ADMIN); + } + break; + case 28: + this.enterOuterAlt(localContext, 28); + { + this.state = 5879; + this.match(MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN); + } + break; + case 29: + this.enterOuterAlt(localContext, 29); + { + this.state = 5880; + this.match(MySqlParser.KW_BACKUP_ADMIN); + } + break; + case 30: + this.enterOuterAlt(localContext, 30); + { + this.state = 5881; + this.match(MySqlParser.KW_BINLOG_ADMIN); + } + break; + case 31: + this.enterOuterAlt(localContext, 31); + { + this.state = 5882; + this.match(MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN); + } + break; + case 32: + this.enterOuterAlt(localContext, 32); + { + this.state = 5883; + this.match(MySqlParser.KW_CLONE_ADMIN); + } + break; + case 33: + this.enterOuterAlt(localContext, 33); + { + this.state = 5884; + this.match(MySqlParser.KW_CONNECTION_ADMIN); + } + break; + case 34: + this.enterOuterAlt(localContext, 34); + { + this.state = 5885; + this.match(MySqlParser.KW_ENCRYPTION_KEY_ADMIN); + } + break; + case 35: + this.enterOuterAlt(localContext, 35); + { + this.state = 5886; + this.match(MySqlParser.KW_FIREWALL_ADMIN); + } + break; + case 36: + this.enterOuterAlt(localContext, 36); + { + this.state = 5887; + this.match(MySqlParser.KW_FIREWALL_EXEMPT); + } + break; + case 37: + this.enterOuterAlt(localContext, 37); + { + this.state = 5888; + this.match(MySqlParser.KW_FIREWALL_USER); + } + break; + case 38: + this.enterOuterAlt(localContext, 38); + { + this.state = 5889; + this.match(MySqlParser.KW_FLUSH_OPTIMIZER_COSTS); + } + break; + case 39: + this.enterOuterAlt(localContext, 39); + { + this.state = 5890; + this.match(MySqlParser.KW_FLUSH_STATUS); + } + break; + case 40: + this.enterOuterAlt(localContext, 40); + { + this.state = 5891; + this.match(MySqlParser.KW_FLUSH_TABLES); + } + break; + case 41: + this.enterOuterAlt(localContext, 41); + { + this.state = 5892; + this.match(MySqlParser.KW_FLUSH_USER_RESOURCES); + } + break; + case 42: + this.enterOuterAlt(localContext, 42); + { + this.state = 5893; + this.match(MySqlParser.KW_GROUP_REPLICATION_ADMIN); + } + break; + case 43: + this.enterOuterAlt(localContext, 43); + { + this.state = 5894; + this.match(MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE); + } + break; + case 44: + this.enterOuterAlt(localContext, 44); + { + this.state = 5895; + this.match(MySqlParser.KW_INNODB_REDO_LOG_ENABLE); + } + break; + case 45: + this.enterOuterAlt(localContext, 45); + { + this.state = 5896; + this.match(MySqlParser.KW_NDB_STORED_USER); + } + break; + case 46: + this.enterOuterAlt(localContext, 46); + { + this.state = 5897; + this.match(MySqlParser.KW_PASSWORDLESS_USER_ADMIN); + } + break; + case 47: + this.enterOuterAlt(localContext, 47); + { + this.state = 5898; + this.match(MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN); + } + break; + case 48: + this.enterOuterAlt(localContext, 48); + { + this.state = 5899; + this.match(MySqlParser.KW_REPLICATION_APPLIER); + } + break; + case 49: + this.enterOuterAlt(localContext, 49); + { + this.state = 5900; + this.match(MySqlParser.KW_REPLICATION_SLAVE_ADMIN); + } + break; + case 50: + this.enterOuterAlt(localContext, 50); + { + this.state = 5901; + this.match(MySqlParser.KW_RESOURCE_GROUP_ADMIN); + } + break; + case 51: + this.enterOuterAlt(localContext, 51); + { + this.state = 5902; + this.match(MySqlParser.KW_RESOURCE_GROUP_USER); + } + break; + case 52: + this.enterOuterAlt(localContext, 52); + { + this.state = 5903; + this.match(MySqlParser.KW_ROLE_ADMIN); + } + break; + case 53: + this.enterOuterAlt(localContext, 53); + { + this.state = 5904; + this.match(MySqlParser.KW_SERVICE_CONNECTION_ADMIN); + } + break; + case 54: + this.enterOuterAlt(localContext, 54); + { + this.state = 5905; + this.match(MySqlParser.KW_SESSION_VARIABLES_ADMIN); + } + break; + case 55: + this.enterOuterAlt(localContext, 55); + { + this.state = 5906; + this.match(MySqlParser.KW_SET_USER_ID); + } + break; + case 56: + this.enterOuterAlt(localContext, 56); + { + this.state = 5907; + this.match(MySqlParser.KW_SKIP_QUERY_REWRITE); + } + break; + case 57: + this.enterOuterAlt(localContext, 57); + { + this.state = 5908; + this.match(MySqlParser.KW_SHOW_ROUTINE); + } + break; + case 58: + this.enterOuterAlt(localContext, 58); + { + this.state = 5909; + this.match(MySqlParser.KW_SYSTEM_USER); + } + break; + case 59: + this.enterOuterAlt(localContext, 59); + { + this.state = 5910; + this.match(MySqlParser.KW_SYSTEM_VARIABLES_ADMIN); + } + break; + case 60: + this.enterOuterAlt(localContext, 60); + { + this.state = 5911; + this.match(MySqlParser.KW_TABLE_ENCRYPTION_ADMIN); + } + break; + case 61: + this.enterOuterAlt(localContext, 61); + { + this.state = 5912; + this.match(MySqlParser.KW_TP_CONNECTION_ADMIN); + } + break; + case 62: + this.enterOuterAlt(localContext, 62); + { + this.state = 5913; + this.match(MySqlParser.KW_VERSION_TOKEN_ADMIN); + } + break; + case 63: + this.enterOuterAlt(localContext, 63); + { + this.state = 5914; + this.match(MySqlParser.KW_XA_RECOVER_ADMIN); + } + break; + case 64: + this.enterOuterAlt(localContext, 64); + { + this.state = 5915; + this.match(MySqlParser.KW_LOAD); + this.state = 5916; + this.match(MySqlParser.KW_FROM); + this.state = 5917; + this.match(MySqlParser.KW_S3); + } + break; + case 65: + this.enterOuterAlt(localContext, 65); + { + this.state = 5918; + this.match(MySqlParser.KW_SELECT); + this.state = 5919; + this.match(MySqlParser.KW_INTO); + this.state = 5920; + this.match(MySqlParser.KW_S3); + } + break; + case 66: + this.enterOuterAlt(localContext, 66); + { + this.state = 5921; + this.match(MySqlParser.KW_INVOKE); + this.state = 5922; + this.match(MySqlParser.KW_LAMBDA); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilegeLevel() { + let localContext = new PrivilegeLevelContext(this.context, this.state); + this.enterRule(localContext, 518, MySqlParser.RULE_privilegeLevel); + try { + this.state = 5941; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 849, this.context)) { + case 1: + localContext = new CurrentSchemaPriviLevelContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5925; + this.match(MySqlParser.STAR); + } + break; + case 2: + localContext = new GlobalPrivLevelContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5926; + this.match(MySqlParser.STAR); + this.state = 5927; + this.match(MySqlParser.DOT); + this.state = 5928; + this.match(MySqlParser.STAR); + } + break; + case 3: + localContext = new DefiniteSchemaPrivLevelContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5929; + this.uid(); + this.state = 5930; + this.match(MySqlParser.DOT); + this.state = 5931; + this.match(MySqlParser.STAR); + } + break; + case 4: + localContext = new DefiniteFullTablePrivLevelContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 5933; + this.uid(); + this.state = 5934; + this.match(MySqlParser.DOT); + this.state = 5935; + this.uid(); + } + break; + case 5: + localContext = new DefiniteFullTablePrivLevel2Context(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 5937; + this.uid(); + this.state = 5938; + this.dottedId(); + } + break; + case 6: + localContext = new DefiniteTablePrivLevelContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 5940; + this.uid(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameUserClause() { + let localContext = new RenameUserClauseContext(this.context, this.state); + this.enterRule(localContext, 520, MySqlParser.RULE_renameUserClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5943; + localContext._fromFirst = this.userName(); + this.state = 5944; + this.match(MySqlParser.KW_TO); + this.state = 5945; + localContext._toFirst = this.userName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + analyzeTable() { + let localContext = new AnalyzeTableContext(this.context, this.state); + this.enterRule(localContext, 522, MySqlParser.RULE_analyzeTable); + let _la; + try { + this.state = 5995; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 856, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5947; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5949; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5948; + this.tableActionOption(); + } + } + this.state = 5951; + this.match(MySqlParser.KW_TABLE); + this.state = 5952; + this.tableNames(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5953; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5955; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5954; + this.tableActionOption(); + } + } + this.state = 5957; + this.match(MySqlParser.KW_TABLE); + this.state = 5958; + this.tableName(); + this.state = 5959; + this.match(MySqlParser.KW_UPDATE); + this.state = 5960; + this.match(MySqlParser.KW_HISTOGRAM); + this.state = 5961; + this.match(MySqlParser.KW_ON); + this.state = 5962; + this.columnNames(); + this.state = 5967; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 852, this.context)) { + case 1: + { + this.state = 5963; + this.match(MySqlParser.KW_WITH); + this.state = 5964; + this.decimalLiteral(); + this.state = 5965; + this.match(MySqlParser.KW_BUCKETS); + } + break; + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5969; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5971; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5970; + this.tableActionOption(); + } + } + this.state = 5973; + this.match(MySqlParser.KW_TABLE); + this.state = 5974; + this.tableName(); + this.state = 5975; + this.match(MySqlParser.KW_UPDATE); + this.state = 5976; + this.match(MySqlParser.KW_HISTOGRAM); + this.state = 5977; + this.match(MySqlParser.KW_ON); + this.state = 5978; + this.columnName(); + this.state = 5982; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 5979; + this.match(MySqlParser.KW_USING); + this.state = 5980; + this.match(MySqlParser.KW_DATA); + this.state = 5981; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5984; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5986; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5985; + this.tableActionOption(); + } + } + this.state = 5988; + this.match(MySqlParser.KW_TABLE); + this.state = 5989; + this.tableName(); + this.state = 5990; + this.match(MySqlParser.KW_DROP); + this.state = 5991; + this.match(MySqlParser.KW_HISTOGRAM); + this.state = 5992; + this.match(MySqlParser.KW_ON); + this.state = 5993; + this.columnNames(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checkTable() { + let localContext = new CheckTableContext(this.context, this.state); + this.enterRule(localContext, 524, MySqlParser.RULE_checkTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5997; + this.match(MySqlParser.KW_CHECK); + this.state = 5998; + this.match(MySqlParser.KW_TABLE); + this.state = 5999; + this.tableNames(); + this.state = 6003; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 65 || _la === 327 || _la === 392 || _la === 396 || _la === 484 || _la === 549) { + { + { + this.state = 6000; + this.checkTableOption(); + } + } + this.state = 6005; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checksumTable() { + let localContext = new ChecksumTableContext(this.context, this.state); + this.enterRule(localContext, 526, MySqlParser.RULE_checksumTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6006; + this.match(MySqlParser.KW_CHECKSUM); + this.state = 6007; + this.match(MySqlParser.KW_TABLE); + this.state = 6008; + this.tableNames(); + this.state = 6010; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392 || _la === 549) { + { + this.state = 6009; + localContext._actionOption = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 392 || _la === 549)) { + localContext._actionOption = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + optimizeTable() { + let localContext = new OptimizeTableContext(this.context, this.state); + this.enterRule(localContext, 528, MySqlParser.RULE_optimizeTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6012; + this.match(MySqlParser.KW_OPTIMIZE); + this.state = 6014; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 6013; + this.tableActionOption(); + } + } + this.state = 6016; + _la = this.tokenStream.LA(1); + if (!(_la === 173 || _la === 752)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6017; + this.tableNames(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + repairTable() { + let localContext = new RepairTableContext(this.context, this.state); + this.enterRule(localContext, 530, MySqlParser.RULE_repairTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6019; + this.match(MySqlParser.KW_REPAIR); + this.state = 6021; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 6020; + this.tableActionOption(); + } + } + this.state = 6023; + this.match(MySqlParser.KW_TABLE); + this.state = 6024; + this.tableNames(); + this.state = 6026; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 549) { + { + this.state = 6025; + this.match(MySqlParser.KW_QUICK); + } + } + this.state = 6029; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6028; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6032; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 679) { + { + this.state = 6031; + this.match(MySqlParser.KW_USE_FRM); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableActionOption() { + let localContext = new TableActionOptionContext(this.context, this.state); + this.enterRule(localContext, 532, MySqlParser.RULE_tableActionOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6034; + _la = this.tokenStream.LA(1); + if (!(_la === 115 || _la === 450)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checkTableOption() { + let localContext = new CheckTableOptionContext(this.context, this.state); + this.enterRule(localContext, 534, MySqlParser.RULE_checkTableOption); + try { + this.state = 6043; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FOR: + this.enterOuterAlt(localContext, 1); + { + this.state = 6036; + this.match(MySqlParser.KW_FOR); + this.state = 6037; + this.match(MySqlParser.KW_UPGRADE); + } + break; + case MySqlParser.KW_QUICK: + this.enterOuterAlt(localContext, 2); + { + this.state = 6038; + this.match(MySqlParser.KW_QUICK); + } + break; + case MySqlParser.KW_FAST: + this.enterOuterAlt(localContext, 3); + { + this.state = 6039; + this.match(MySqlParser.KW_FAST); + } + break; + case MySqlParser.KW_MEDIUM: + this.enterOuterAlt(localContext, 4); + { + this.state = 6040; + this.match(MySqlParser.KW_MEDIUM); + } + break; + case MySqlParser.KW_EXTENDED: + this.enterOuterAlt(localContext, 5); + { + this.state = 6041; + this.match(MySqlParser.KW_EXTENDED); + } + break; + case MySqlParser.KW_CHANGED: + this.enterOuterAlt(localContext, 6); + { + this.state = 6042; + this.match(MySqlParser.KW_CHANGED); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createFunction() { + let localContext = new CreateFunctionContext(this.context, this.state); + this.enterRule(localContext, 536, MySqlParser.RULE_createFunction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6045; + this.match(MySqlParser.KW_CREATE); + this.state = 6047; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 307) { + { + this.state = 6046; + this.match(MySqlParser.KW_AGGREGATE); + } + } + this.state = 6049; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6051; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 866, this.context)) { + case 1: + { + this.state = 6050; + this.ifNotExists(); + } + break; + } + this.state = 6053; + this.functionNameCreate(); + this.state = 6054; + this.match(MySqlParser.KW_RETURNS); + this.state = 6055; + localContext._returnType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 208)) & ~0x1F) === 0 && ((1 << (_la - 208)) & 261) !== 0) || _la === 649)) { + localContext._returnType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6056; + this.match(MySqlParser.KW_SONAME); + this.state = 6057; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + installComponent() { + let localContext = new InstallComponentContext(this.context, this.state); + this.enterRule(localContext, 538, MySqlParser.RULE_installComponent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6059; + this.match(MySqlParser.KW_INSTALL); + this.state = 6060; + this.match(MySqlParser.KW_COMPONENT); + this.state = 6061; + localContext._component_name = this.uid(); + this.state = 6066; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6062; + this.match(MySqlParser.COMMA); + this.state = 6063; + localContext._component_name = this.uid(); + } + } + this.state = 6068; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 6078; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 869, this.context)) { + case 1: + { + this.state = 6069; + this.match(MySqlParser.KW_SET); + this.state = 6070; + this.variableExpr(); + this.state = 6075; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6071; + this.match(MySqlParser.COMMA); + this.state = 6072; + this.variableExpr(); + } + } + this.state = 6077; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + variableExpr() { + let localContext = new VariableExprContext(this.context, this.state); + this.enterRule(localContext, 540, MySqlParser.RULE_variableExpr); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6080; + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 531 || _la === 893 || _la === 894)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6081; + localContext._system_var_name = this.fullId(); + this.state = 6082; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6083; + this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uninstallComponent() { + let localContext = new UninstallComponentContext(this.context, this.state); + this.enterRule(localContext, 542, MySqlParser.RULE_uninstallComponent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6085; + this.match(MySqlParser.KW_UNINSTALL); + this.state = 6086; + this.match(MySqlParser.KW_COMPONENT); + this.state = 6087; + localContext._component_name = this.uid(); + this.state = 6092; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6088; + this.match(MySqlParser.COMMA); + this.state = 6089; + localContext._component_name = this.uid(); + } + } + this.state = 6094; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + installPlugin() { + let localContext = new InstallPluginContext(this.context, this.state); + this.enterRule(localContext, 544, MySqlParser.RULE_installPlugin); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6095; + this.match(MySqlParser.KW_INSTALL); + this.state = 6096; + this.match(MySqlParser.KW_PLUGIN); + this.state = 6097; + localContext._pluginName = this.uid(); + this.state = 6098; + this.match(MySqlParser.KW_SONAME); + this.state = 6099; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uninstallPlugin() { + let localContext = new UninstallPluginContext(this.context, this.state); + this.enterRule(localContext, 546, MySqlParser.RULE_uninstallPlugin); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6101; + this.match(MySqlParser.KW_UNINSTALL); + this.state = 6102; + this.match(MySqlParser.KW_PLUGIN); + this.state = 6103; + localContext._pluginName = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + cloneStatement() { + let localContext = new CloneStatementContext(this.context, this.state); + this.enterRule(localContext, 548, MySqlParser.RULE_cloneStatement); + let _la; + try { + this.state = 6135; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 876, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6105; + this.match(MySqlParser.KW_CLONE); + this.state = 6106; + this.match(MySqlParser.KW_LOCAL); + this.state = 6107; + this.match(MySqlParser.KW_DATA); + this.state = 6108; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 6110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 6109; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 6112; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6113; + this.match(MySqlParser.KW_CLONE); + this.state = 6114; + this.match(MySqlParser.KW_INSTANCE); + this.state = 6115; + this.match(MySqlParser.KW_FROM); + this.state = 6116; + this.userHostPort(); + this.state = 6117; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 6118; + this.match(MySqlParser.KW_BY); + this.state = 6119; + this.match(MySqlParser.STRING_LITERAL); + this.state = 6126; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 360) { + { + this.state = 6120; + this.match(MySqlParser.KW_DATA); + this.state = 6121; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 6123; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 6122; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 6125; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 6133; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 6128; + this.match(MySqlParser.KW_REQUIRE); + this.state = 6130; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 6129; + this.match(MySqlParser.KW_NO); + } + } + this.state = 6132; + this.match(MySqlParser.KW_SSL); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setStatement() { + let localContext = new SetStatementContext(this.context, this.state); + this.enterRule(localContext, 550, MySqlParser.RULE_setStatement); + let _la; + try { + this.state = 6189; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 884, this.context)) { + case 1: + localContext = new SetVariableContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6137; + this.match(MySqlParser.KW_SET); + this.state = 6138; + this.variableClause(); + this.state = 6139; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6142; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 877, this.context)) { + case 1: + { + this.state = 6140; + this.expression(0); + } + break; + case 2: + { + this.state = 6141; + this.match(MySqlParser.KW_ON); + } + break; + } + this.state = 6153; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6144; + this.match(MySqlParser.COMMA); + this.state = 6145; + this.variableClause(); + this.state = 6146; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6149; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 878, this.context)) { + case 1: + { + this.state = 6147; + this.expression(0); + } + break; + case 2: + { + this.state = 6148; + this.match(MySqlParser.KW_ON); + } + break; + } + } + } + this.state = 6155; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + localContext = new SetCharsetContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6156; + this.match(MySqlParser.KW_SET); + this.state = 6157; + this.charSet(); + this.state = 6160; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 6158; + this.charsetName(); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 6159; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 3: + localContext = new SetNamesContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 6162; + this.match(MySqlParser.KW_SET); + this.state = 6163; + this.match(MySqlParser.KW_NAMES); + this.state = 6170; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 6164; + this.charsetName(); + this.state = 6167; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 28) { + { + this.state = 6165; + this.match(MySqlParser.KW_COLLATE); + this.state = 6166; + this.collationName(); + } + } + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 6169; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 4: + localContext = new SetPasswordContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 6172; + this.setPasswordStatement(); + } + break; + case 5: + localContext = new SetTransactionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 6173; + this.setTransactionStatement(); + } + break; + case 6: + localContext = new SetAutocommitContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 6174; + this.setAutocommitStatement(); + } + break; + case 7: + localContext = new SetNewValueInsideTriggerContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 6175; + this.match(MySqlParser.KW_SET); + this.state = 6176; + localContext._system_var_name = this.fullId(); + this.state = 6177; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6178; + this.expression(0); + this.state = 6186; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6179; + this.match(MySqlParser.COMMA); + this.state = 6180; + localContext._system_var_name = this.fullId(); + this.state = 6181; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6182; + this.expression(0); + } + } + this.state = 6188; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showStatement() { + let localContext = new ShowStatementContext(this.context, this.state); + this.enterRule(localContext, 552, MySqlParser.RULE_showStatement); + let _la; + try { + this.state = 6375; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 913, this.context)) { + case 1: + localContext = new ShowMasterLogsContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6191; + this.match(MySqlParser.KW_SHOW); + this.state = 6192; + localContext._logFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 228 || _la === 453)) { + localContext._logFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6193; + this.match(MySqlParser.KW_LOGS); + } + break; + case 2: + localContext = new ShowLogEventsContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6194; + this.match(MySqlParser.KW_SHOW); + this.state = 6195; + localContext._logFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 318 || _la === 559)) { + localContext._logFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6196; + this.match(MySqlParser.KW_EVENTS); + this.state = 6199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 80) { + { + this.state = 6197; + this.match(MySqlParser.KW_IN); + this.state = 6198; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 6203; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68) { + { + this.state = 6201; + this.match(MySqlParser.KW_FROM); + this.state = 6202; + localContext._fromPosition = this.decimalLiteral(); + } + } + this.state = 6212; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 6205; + this.match(MySqlParser.KW_LIMIT); + this.state = 6209; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 887, this.context)) { + case 1: + { + this.state = 6206; + localContext._offset = this.decimalLiteral(); + this.state = 6207; + this.match(MySqlParser.COMMA); + } + break; + } + this.state = 6211; + localContext._rowCount = this.decimalLiteral(); + } + } + this.state = 6215; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6214; + this.channelOption(); + } + } + } + break; + case 3: + localContext = new ShowObjectFilterContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 6217; + this.match(MySqlParser.KW_SHOW); + this.state = 6218; + this.showCommonEntity(); + this.state = 6220; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6219; + this.showFilter(); + } + } + } + break; + case 4: + localContext = new ShowColumnsContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 6222; + this.match(MySqlParser.KW_SHOW); + this.state = 6224; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6223; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6227; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 408) { + { + this.state = 6226; + this.match(MySqlParser.KW_FULL); + } + } + this.state = 6229; + localContext._columnsFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 337 || _la === 398)) { + localContext._columnsFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6230; + localContext._tableFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._tableFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6231; + this.tableName(); + this.state = 6234; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6232; + localContext._schemaFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._schemaFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6233; + this.databaseName(); + } + } + this.state = 6237; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6236; + this.showFilter(); + } + } + } + break; + case 5: + localContext = new ShowCreateDbContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 6239; + this.match(MySqlParser.KW_SHOW); + this.state = 6240; + this.match(MySqlParser.KW_CREATE); + this.state = 6241; + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6243; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 895, this.context)) { + case 1: + { + this.state = 6242; + this.ifNotExists(); + } + break; + } + this.state = 6245; + this.databaseName(); + } + break; + case 6: + localContext = new ShowCreateFullIdObjectContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 6246; + this.match(MySqlParser.KW_SHOW); + this.state = 6247; + this.match(MySqlParser.KW_CREATE); + this.state = 6248; + _la = this.tokenStream.LA(1); + if (!(_la === 132 || _la === 178 || _la === 385)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6249; + this.fullId(); + } + break; + case 7: + localContext = new ShowCreateFunctionContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 6250; + this.match(MySqlParser.KW_SHOW); + this.state = 6251; + this.match(MySqlParser.KW_CREATE); + this.state = 6252; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6253; + this.functionName(); + } + break; + case 8: + localContext = new ShowCreateViewContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 6254; + this.match(MySqlParser.KW_SHOW); + this.state = 6255; + this.match(MySqlParser.KW_CREATE); + this.state = 6256; + this.match(MySqlParser.KW_VIEW); + this.state = 6257; + this.viewName(); + } + break; + case 9: + localContext = new ShowCreateTableContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 6258; + this.match(MySqlParser.KW_SHOW); + this.state = 6259; + this.match(MySqlParser.KW_CREATE); + this.state = 6260; + this.match(MySqlParser.KW_TABLE); + this.state = 6261; + this.tableName(); + } + break; + case 10: + localContext = new ShowCreateUserContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 6262; + this.match(MySqlParser.KW_SHOW); + this.state = 6263; + this.match(MySqlParser.KW_CREATE); + this.state = 6264; + this.match(MySqlParser.KW_USER); + this.state = 6265; + this.userName(); + } + break; + case 11: + localContext = new ShowEngineContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 6266; + this.match(MySqlParser.KW_SHOW); + this.state = 6267; + this.match(MySqlParser.KW_ENGINE); + this.state = 6268; + this.engineName(); + this.state = 6269; + localContext._engineOption = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 493 || _la === 645)) { + localContext._engineOption = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 12: + localContext = new ShowGlobalInfoContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 6271; + this.match(MySqlParser.KW_SHOW); + this.state = 6272; + this.showGlobalInfoClause(); + } + break; + case 13: + localContext = new ShowErrorsContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 6273; + this.match(MySqlParser.KW_SHOW); + this.state = 6274; + localContext._errorFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 383 || _la === 688)) { + localContext._errorFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6282; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 6275; + this.match(MySqlParser.KW_LIMIT); + this.state = 6279; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 896, this.context)) { + case 1: + { + this.state = 6276; + localContext._offset = this.decimalLiteral(); + this.state = 6277; + this.match(MySqlParser.COMMA); + } + break; + } + this.state = 6281; + localContext._rowCount = this.decimalLiteral(); + } + } + } + break; + case 14: + localContext = new ShowCountErrorsContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 6284; + this.match(MySqlParser.KW_SHOW); + this.state = 6285; + this.match(MySqlParser.KW_COUNT); + this.state = 6286; + this.match(MySqlParser.LR_BRACKET); + this.state = 6287; + this.match(MySqlParser.STAR); + this.state = 6288; + this.match(MySqlParser.RR_BRACKET); + this.state = 6289; + localContext._errorFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 383 || _la === 688)) { + localContext._errorFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 15: + localContext = new ShowSchemaFilterContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 6290; + this.match(MySqlParser.KW_SHOW); + this.state = 6291; + this.showSchemaEntity(); + this.state = 6294; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6292; + localContext._schemaFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._schemaFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6293; + this.databaseName(); + } + } + this.state = 6297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6296; + this.showFilter(); + } + } + } + break; + case 16: + localContext = new ShowPercedureCodeContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 6299; + this.match(MySqlParser.KW_SHOW); + this.state = 6300; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 6301; + this.match(MySqlParser.KW_CODE); + this.state = 6302; + localContext._proc_name = this.fullId(); + } + break; + case 17: + localContext = new ShowFunctionCodeContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 6303; + this.match(MySqlParser.KW_SHOW); + this.state = 6304; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6305; + this.match(MySqlParser.KW_CODE); + this.state = 6306; + this.functionName(); + } + break; + case 18: + localContext = new ShowGrantsContext(localContext); + this.enterOuterAlt(localContext, 18); + { + this.state = 6307; + this.match(MySqlParser.KW_SHOW); + this.state = 6308; + this.match(MySqlParser.KW_GRANTS); + this.state = 6315; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6309; + this.match(MySqlParser.KW_FOR); + this.state = 6310; + this.userOrRoleName(); + this.state = 6313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 6311; + this.match(MySqlParser.KW_USING); + this.state = 6312; + this.userOrRoleNames(); + } + } + } + } + } + break; + case 19: + localContext = new ShowIndexesContext(localContext); + this.enterOuterAlt(localContext, 19); + { + this.state = 6317; + this.match(MySqlParser.KW_SHOW); + this.state = 6319; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6318; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6321; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 93 || _la === 426)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6322; + localContext._tableFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._tableFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6323; + this.tableName(); + this.state = 6326; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6324; + localContext._schemaFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._schemaFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6325; + this.databaseName(); + } + } + this.state = 6330; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 6328; + this.match(MySqlParser.KW_WHERE); + this.state = 6329; + this.expression(0); + } + } + } + break; + case 20: + localContext = new ShowOpenTablesContext(localContext); + this.enterOuterAlt(localContext, 20); + { + this.state = 6332; + this.match(MySqlParser.KW_SHOW); + this.state = 6333; + this.match(MySqlParser.KW_OPEN); + this.state = 6334; + this.match(MySqlParser.KW_TABLES); + this.state = 6337; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6335; + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6336; + this.databaseName(); + } + } + this.state = 6340; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6339; + this.showFilter(); + } + } + } + break; + case 21: + localContext = new ShowProfileContext(localContext); + this.enterOuterAlt(localContext, 21); + { + this.state = 6342; + this.match(MySqlParser.KW_SHOW); + this.state = 6343; + this.match(MySqlParser.KW_PROFILE); + this.state = 6352; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 320 || _la === 355 || _la === 358 || _la === 439 || _la === 521 || _la === 605 || _la === 655 || _la === 802) { + { + this.state = 6344; + this.showProfileType(); + this.state = 6349; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6345; + this.match(MySqlParser.COMMA); + this.state = 6346; + this.showProfileType(); + } + } + this.state = 6351; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 6357; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6354; + this.match(MySqlParser.KW_FOR); + this.state = 6355; + this.match(MySqlParser.KW_QUERY); + this.state = 6356; + localContext._queryCount = this.decimalLiteral(); + } + } + this.state = 6365; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 6359; + this.match(MySqlParser.KW_LIMIT); + this.state = 6360; + localContext._rowCount = this.decimalLiteral(); + this.state = 6363; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 509) { + { + this.state = 6361; + this.match(MySqlParser.KW_OFFSET); + this.state = 6362; + localContext._offset = this.decimalLiteral(); + } + } + } + } + } + break; + case 22: + localContext = new ShowSlaveStatusContext(localContext); + this.enterOuterAlt(localContext, 22); + { + this.state = 6367; + this.match(MySqlParser.KW_SHOW); + this.state = 6368; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6369; + this.match(MySqlParser.KW_STATUS); + this.state = 6371; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6370; + this.channelOption(); + } + } + } + break; + case 23: + localContext = new ShowReplicasContext(localContext); + this.enterOuterAlt(localContext, 23); + { + this.state = 6373; + this.match(MySqlParser.KW_SHOW); + this.state = 6374; + this.match(MySqlParser.KW_REPLICAS); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + variableClause() { + let localContext = new VariableClauseContext(this.context, this.state); + this.enterRule(localContext, 554, MySqlParser.RULE_variableClause); + let _la; + try { + this.state = 6387; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LOCAL_ID: + this.enterOuterAlt(localContext, 1); + { + this.state = 6377; + this.match(MySqlParser.LOCAL_ID); + } + break; + case MySqlParser.GLOBAL_ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 6378; + this.match(MySqlParser.GLOBAL_ID); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PERSIST: + case MySqlParser.KW_PERSIST_ONLY: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.AT_SIGN: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 3); + { + this.state = 6384; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 915, this.context)) { + case 1: + { + this.state = 6381; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 870) { + { + this.state = 6379; + this.match(MySqlParser.AT_SIGN); + this.state = 6380; + this.match(MySqlParser.AT_SIGN); + } + } + this.state = 6383; + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 450 || _la === 531 || _la === 532 || _la === 593)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 6386; + localContext._target = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showCommonEntity() { + let localContext = new ShowCommonEntityContext(this.context, this.state); + this.enterRule(localContext, 556, MySqlParser.RULE_showCommonEntity); + let _la; + try { + this.state = 6403; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CHARACTER: + this.enterOuterAlt(localContext, 1); + { + this.state = 6389; + this.match(MySqlParser.KW_CHARACTER); + this.state = 6390; + this.match(MySqlParser.KW_SET); + } + break; + case MySqlParser.KW_CHARSET: + this.enterOuterAlt(localContext, 2); + { + this.state = 6391; + this.match(MySqlParser.KW_CHARSET); + } + break; + case MySqlParser.KW_COLLATION: + this.enterOuterAlt(localContext, 3); + { + this.state = 6392; + this.match(MySqlParser.KW_COLLATION); + } + break; + case MySqlParser.KW_DATABASES: + this.enterOuterAlt(localContext, 4); + { + this.state = 6393; + this.match(MySqlParser.KW_DATABASES); + } + break; + case MySqlParser.KW_SCHEMAS: + this.enterOuterAlt(localContext, 5); + { + this.state = 6394; + this.match(MySqlParser.KW_SCHEMAS); + } + break; + case MySqlParser.KW_FUNCTION: + this.enterOuterAlt(localContext, 6); + { + this.state = 6395; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6396; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_PROCEDURE: + this.enterOuterAlt(localContext, 7); + { + this.state = 6397; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 6398; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_VARIABLES: + this.enterOuterAlt(localContext, 8); + { + this.state = 6400; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 413 || _la === 593) { + { + this.state = 6399; + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 593)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6402; + _la = this.tokenStream.LA(1); + if (!(_la === 645 || _la === 683)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showFilter() { + let localContext = new ShowFilterContext(this.context, this.state); + this.enterRule(localContext, 558, MySqlParser.RULE_showFilter); + try { + this.state = 6409; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_LIKE: + this.enterOuterAlt(localContext, 1); + { + this.state = 6405; + this.match(MySqlParser.KW_LIKE); + this.state = 6406; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_WHERE: + this.enterOuterAlt(localContext, 2); + { + this.state = 6407; + this.match(MySqlParser.KW_WHERE); + this.state = 6408; + this.expression(0); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showGlobalInfoClause() { + let localContext = new ShowGlobalInfoClauseContext(this.context, this.state); + this.enterRule(localContext, 560, MySqlParser.RULE_showGlobalInfoClause); + let _la; + try { + this.state = 6428; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_STORAGE: + this.enterOuterAlt(localContext, 1); + { + this.state = 6412; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 647) { + { + this.state = 6411; + this.match(MySqlParser.KW_STORAGE); + } + } + this.state = 6414; + this.match(MySqlParser.KW_ENGINES); + } + break; + case MySqlParser.KW_MASTER: + this.enterOuterAlt(localContext, 2); + { + this.state = 6415; + this.match(MySqlParser.KW_MASTER); + this.state = 6416; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_PLUGINS: + this.enterOuterAlt(localContext, 3); + { + this.state = 6417; + this.match(MySqlParser.KW_PLUGINS); + } + break; + case MySqlParser.KW_PRIVILEGES: + this.enterOuterAlt(localContext, 4); + { + this.state = 6418; + this.match(MySqlParser.KW_PRIVILEGES); + } + break; + case MySqlParser.KW_FULL: + case MySqlParser.KW_PROCESSLIST: + this.enterOuterAlt(localContext, 5); + { + this.state = 6420; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 408) { + { + this.state = 6419; + this.match(MySqlParser.KW_FULL); + } + } + this.state = 6422; + this.match(MySqlParser.KW_PROCESSLIST); + } + break; + case MySqlParser.KW_PROFILES: + this.enterOuterAlt(localContext, 6); + { + this.state = 6423; + this.match(MySqlParser.KW_PROFILES); + } + break; + case MySqlParser.KW_SLAVE: + this.enterOuterAlt(localContext, 7); + { + this.state = 6424; + this.match(MySqlParser.KW_SLAVE); + this.state = 6425; + this.match(MySqlParser.KW_HOSTS); + } + break; + case MySqlParser.KW_AUTHORS: + this.enterOuterAlt(localContext, 8); + { + this.state = 6426; + this.match(MySqlParser.KW_AUTHORS); + } + break; + case MySqlParser.KW_CONTRIBUTORS: + this.enterOuterAlt(localContext, 9); + { + this.state = 6427; + this.match(MySqlParser.KW_CONTRIBUTORS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showSchemaEntity() { + let localContext = new ShowSchemaEntityContext(this.context, this.state); + this.enterRule(localContext, 562, MySqlParser.RULE_showSchemaEntity); + let _la; + try { + this.state = 6441; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_EVENTS: + this.enterOuterAlt(localContext, 1); + { + this.state = 6430; + this.match(MySqlParser.KW_EVENTS); + } + break; + case MySqlParser.KW_TABLE: + this.enterOuterAlt(localContext, 2); + { + this.state = 6431; + this.match(MySqlParser.KW_TABLE); + this.state = 6432; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_FULL: + case MySqlParser.KW_TABLES: + this.enterOuterAlt(localContext, 3); + { + this.state = 6434; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6433; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6437; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 408) { + { + this.state = 6436; + this.match(MySqlParser.KW_FULL); + } + } + this.state = 6439; + this.match(MySqlParser.KW_TABLES); + } + break; + case MySqlParser.KW_TRIGGERS: + this.enterOuterAlt(localContext, 4); + { + this.state = 6440; + this.match(MySqlParser.KW_TRIGGERS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showProfileType() { + let localContext = new ShowProfileTypeContext(this.context, this.state); + this.enterRule(localContext, 564, MySqlParser.RULE_showProfileType); + try { + this.state = 6455; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALL: + this.enterOuterAlt(localContext, 1); + { + this.state = 6443; + this.match(MySqlParser.KW_ALL); + } + break; + case MySqlParser.KW_BLOCK: + this.enterOuterAlt(localContext, 2); + { + this.state = 6444; + this.match(MySqlParser.KW_BLOCK); + this.state = 6445; + this.match(MySqlParser.KW_IO); + } + break; + case MySqlParser.KW_CONTEXT: + this.enterOuterAlt(localContext, 3); + { + this.state = 6446; + this.match(MySqlParser.KW_CONTEXT); + this.state = 6447; + this.match(MySqlParser.KW_SWITCHES); + } + break; + case MySqlParser.KW_CPU: + this.enterOuterAlt(localContext, 4); + { + this.state = 6448; + this.match(MySqlParser.KW_CPU); + } + break; + case MySqlParser.KW_IPC: + this.enterOuterAlt(localContext, 5); + { + this.state = 6449; + this.match(MySqlParser.KW_IPC); + } + break; + case MySqlParser.KW_MEMORY: + this.enterOuterAlt(localContext, 6); + { + this.state = 6450; + this.match(MySqlParser.KW_MEMORY); + } + break; + case MySqlParser.KW_PAGE: + this.enterOuterAlt(localContext, 7); + { + this.state = 6451; + this.match(MySqlParser.KW_PAGE); + this.state = 6452; + this.match(MySqlParser.KW_FAULTS); + } + break; + case MySqlParser.KW_SOURCE: + this.enterOuterAlt(localContext, 8); + { + this.state = 6453; + this.match(MySqlParser.KW_SOURCE); + } + break; + case MySqlParser.KW_SWAPS: + this.enterOuterAlt(localContext, 9); + { + this.state = 6454; + this.match(MySqlParser.KW_SWAPS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + binlogStatement() { + let localContext = new BinlogStatementContext(this.context, this.state); + this.enterRule(localContext, 566, MySqlParser.RULE_binlogStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6457; + this.match(MySqlParser.KW_BINLOG); + this.state = 6458; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + cacheIndexStatement() { + let localContext = new CacheIndexStatementContext(this.context, this.state); + this.enterRule(localContext, 568, MySqlParser.RULE_cacheIndexStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6460; + this.match(MySqlParser.KW_CACHE); + this.state = 6461; + this.match(MySqlParser.KW_INDEX); + this.state = 6479; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 929, this.context)) { + case 1: + { + this.state = 6462; + this.tableIndex(); + this.state = 6467; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6463; + this.match(MySqlParser.COMMA); + this.state = 6464; + this.tableIndex(); + } + } + this.state = 6469; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + { + this.state = 6470; + this.tableName(); + this.state = 6471; + this.match(MySqlParser.KW_PARTITION); + this.state = 6472; + this.match(MySqlParser.LR_BRACKET); + this.state = 6475; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 6473; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 6474; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6477; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 6481; + this.match(MySqlParser.KW_IN); + this.state = 6482; + this.databaseName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + flushStatement() { + let localContext = new FlushStatementContext(this.context, this.state); + this.enterRule(localContext, 570, MySqlParser.RULE_flushStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6484; + this.match(MySqlParser.KW_FLUSH); + this.state = 6486; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 6485; + this.tableActionOption(); + } + } + this.state = 6488; + this.flushOption(); + this.state = 6493; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6489; + this.match(MySqlParser.COMMA); + this.state = 6490; + this.flushOption(); + } + } + this.state = 6495; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + killStatement() { + let localContext = new KillStatementContext(this.context, this.state); + this.enterRule(localContext, 572, MySqlParser.RULE_killStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6496; + this.match(MySqlParser.KW_KILL); + this.state = 6498; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 932, this.context)) { + case 1: + { + this.state = 6497; + localContext._connectionFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 349 || _la === 548)) { + localContext._connectionFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 6500; + this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadIndexIntoCache() { + let localContext = new LoadIndexIntoCacheContext(this.context, this.state); + this.enterRule(localContext, 574, MySqlParser.RULE_loadIndexIntoCache); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6502; + this.match(MySqlParser.KW_LOAD); + this.state = 6503; + this.match(MySqlParser.KW_INDEX); + this.state = 6504; + this.match(MySqlParser.KW_INTO); + this.state = 6505; + this.match(MySqlParser.KW_CACHE); + this.state = 6506; + this.loadedTableIndexes(); + this.state = 6511; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6507; + this.match(MySqlParser.COMMA); + this.state = 6508; + this.loadedTableIndexes(); + } + } + this.state = 6513; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetStatement() { + let localContext = new ResetStatementContext(this.context, this.state); + this.enterRule(localContext, 576, MySqlParser.RULE_resetStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6514; + this.match(MySqlParser.KW_RESET); + this.state = 6515; + this.resetOption(); + this.state = 6520; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6516; + this.match(MySqlParser.COMMA); + this.state = 6517; + this.resetOption(); + } + } + this.state = 6522; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetOption() { + let localContext = new ResetOptionContext(this.context, this.state); + this.enterRule(localContext, 578, MySqlParser.RULE_resetOption); + try { + this.state = 6528; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_MASTER: + this.enterOuterAlt(localContext, 1); + { + this.state = 6523; + this.match(MySqlParser.KW_MASTER); + } + break; + case MySqlParser.KW_REPLICA: + this.enterOuterAlt(localContext, 2); + { + this.state = 6524; + this.match(MySqlParser.KW_REPLICA); + } + break; + case MySqlParser.KW_QUERY: + this.enterOuterAlt(localContext, 3); + { + this.state = 6525; + this.match(MySqlParser.KW_QUERY); + this.state = 6526; + this.match(MySqlParser.KW_CACHE); + } + break; + case MySqlParser.KW_SLAVE: + this.enterOuterAlt(localContext, 4); + { + this.state = 6527; + this.match(MySqlParser.KW_SLAVE); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetPersist() { + let localContext = new ResetPersistContext(this.context, this.state); + this.enterRule(localContext, 580, MySqlParser.RULE_resetPersist); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6530; + this.match(MySqlParser.KW_RESET); + this.state = 6531; + this.match(MySqlParser.KW_PERSIST); + this.state = 6536; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 937, this.context)) { + case 1: + { + this.state = 6533; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 936, this.context)) { + case 1: + { + this.state = 6532; + this.ifExists(); + } + break; + } + this.state = 6535; + localContext._system_var_name = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetAllChannel() { + let localContext = new ResetAllChannelContext(this.context, this.state); + this.enterRule(localContext, 582, MySqlParser.RULE_resetAllChannel); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6538; + this.match(MySqlParser.KW_RESET); + this.state = 6539; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6541; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7) { + { + this.state = 6540; + this.match(MySqlParser.KW_ALL); + } + } + this.state = 6544; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6543; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + reStartStatement() { + let localContext = new ReStartStatementContext(this.context, this.state); + this.enterRule(localContext, 584, MySqlParser.RULE_reStartStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6546; + this.match(MySqlParser.KW_RESTART); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + shutdownStatement() { + let localContext = new ShutdownStatementContext(this.context, this.state); + this.enterRule(localContext, 586, MySqlParser.RULE_shutdownStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6548; + this.match(MySqlParser.KW_SHUTDOWN); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableIndex() { + let localContext = new TableIndexContext(this.context, this.state); + this.enterRule(localContext, 588, MySqlParser.RULE_tableIndex); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6550; + this.tableName(); + this.state = 6556; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 6551; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6552; + this.match(MySqlParser.LR_BRACKET); + this.state = 6553; + this.indexNames(); + this.state = 6554; + this.match(MySqlParser.RR_BRACKET); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + flushOption() { + let localContext = new FlushOptionContext(this.context, this.state); + this.enterRule(localContext, 590, MySqlParser.RULE_flushOption); + let _la; + try { + this.state = 6590; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 947, this.context)) { + case 1: + localContext = new SimpleFlushOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6576; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DES_KEY_FILE: + { + this.state = 6558; + this.match(MySqlParser.KW_DES_KEY_FILE); + } + break; + case MySqlParser.KW_HOSTS: + { + this.state = 6559; + this.match(MySqlParser.KW_HOSTS); + } + break; + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_SLOW: + { + this.state = 6561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228 || ((((_la - 380)) & ~0x1F) === 0 && ((1 << (_la - 380)) & 1073741829) !== 0) || _la === 556 || _la === 599) { + { + this.state = 6560; + _la = this.tokenStream.LA(1); + if (!(_la === 228 || ((((_la - 380)) & ~0x1F) === 0 && ((1 << (_la - 380)) & 1073741829) !== 0) || _la === 556 || _la === 599)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6563; + this.match(MySqlParser.KW_LOGS); + } + break; + case MySqlParser.KW_OPTIMIZER_COSTS: + { + this.state = 6564; + this.match(MySqlParser.KW_OPTIMIZER_COSTS); + } + break; + case MySqlParser.KW_PRIVILEGES: + { + this.state = 6565; + this.match(MySqlParser.KW_PRIVILEGES); + } + break; + case MySqlParser.KW_QUERY: + { + this.state = 6566; + this.match(MySqlParser.KW_QUERY); + this.state = 6567; + this.match(MySqlParser.KW_CACHE); + } + break; + case MySqlParser.KW_STATUS: + { + this.state = 6568; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_USER_RESOURCES: + { + this.state = 6569; + this.match(MySqlParser.KW_USER_RESOURCES); + } + break; + case MySqlParser.KW_TABLES: + { + this.state = 6570; + this.match(MySqlParser.KW_TABLES); + this.state = 6574; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 942, this.context)) { + case 1: + { + this.state = 6571; + this.match(MySqlParser.KW_WITH); + this.state = 6572; + this.match(MySqlParser.KW_READ); + this.state = 6573; + this.match(MySqlParser.KW_LOCK); + } + break; + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + localContext = new ChannelFlushOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6578; + this.match(MySqlParser.KW_RELAY); + this.state = 6579; + this.match(MySqlParser.KW_LOGS); + this.state = 6581; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6580; + this.channelOption(); + } + } + } + break; + case 3: + localContext = new TableFlushOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 6583; + _la = this.tokenStream.LA(1); + if (!(_la === 173 || _la === 752)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6585; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 945, this.context)) { + case 1: + { + this.state = 6584; + this.tableNames(); + } + break; + } + this.state = 6588; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 946, this.context)) { + case 1: + { + this.state = 6587; + this.flushTableOption(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + flushTableOption() { + let localContext = new FlushTableOptionContext(this.context, this.state); + this.enterRule(localContext, 592, MySqlParser.RULE_flushTableOption); + try { + this.state = 6597; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_WITH: + this.enterOuterAlt(localContext, 1); + { + this.state = 6592; + this.match(MySqlParser.KW_WITH); + this.state = 6593; + this.match(MySqlParser.KW_READ); + this.state = 6594; + this.match(MySqlParser.KW_LOCK); + } + break; + case MySqlParser.KW_FOR: + this.enterOuterAlt(localContext, 2); + { + this.state = 6595; + this.match(MySqlParser.KW_FOR); + this.state = 6596; + this.match(MySqlParser.KW_EXPORT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadedTableIndexes() { + let localContext = new LoadedTableIndexesContext(this.context, this.state); + this.enterRule(localContext, 594, MySqlParser.RULE_loadedTableIndexes); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6599; + this.tableName(); + this.state = 6607; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 6600; + this.match(MySqlParser.KW_PARTITION); + this.state = 6601; + this.match(MySqlParser.LR_BRACKET); + this.state = 6604; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 6602; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 6603; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6606; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 6616; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 952, this.context)) { + case 1: + { + this.state = 6610; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 6609; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6612; + this.match(MySqlParser.LR_BRACKET); + this.state = 6613; + this.indexNames(); + this.state = 6614; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 6620; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 6618; + this.match(MySqlParser.KW_IGNORE); + this.state = 6619; + this.match(MySqlParser.KW_LEAVES); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleDescribeStatement() { + let localContext = new SimpleDescribeStatementContext(this.context, this.state); + this.enterRule(localContext, 596, MySqlParser.RULE_simpleDescribeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6622; + localContext._command = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 45)) & ~0x1F) === 0 && ((1 << (_la - 45)) & 131075) !== 0))) { + localContext._command = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6623; + this.tableName(); + this.state = 6626; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 954, this.context)) { + case 1: + { + this.state = 6624; + localContext._column = this.columnName(); + } + break; + case 2: + { + this.state = 6625; + localContext._pattern = this.match(MySqlParser.STRING_LITERAL); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fullDescribeStatement() { + let localContext = new FullDescribeStatementContext(this.context, this.state); + this.enterRule(localContext, 598, MySqlParser.RULE_fullDescribeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6628; + localContext._command = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 45)) & ~0x1F) === 0 && ((1 << (_la - 45)) & 131075) !== 0))) { + localContext._command = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6634; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_EXTENDED: + { + this.state = 6629; + this.match(MySqlParser.KW_EXTENDED); + } + break; + case MySqlParser.KW_PARTITIONS: + { + this.state = 6630; + this.match(MySqlParser.KW_PARTITIONS); + } + break; + case MySqlParser.KW_FORMAT: + { + this.state = 6631; + this.match(MySqlParser.KW_FORMAT); + this.state = 6632; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6633; + _la = this.tokenStream.LA(1); + if (!(_la === 442 || _la === 663 || _la === 666)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_DELETE: + case MySqlParser.KW_FOR: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_UPDATE: + case MySqlParser.LR_BRACKET: + break; + default: + break; + } + this.state = 6636; + this.describeObjectClause(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + analyzeDescribeStatement() { + let localContext = new AnalyzeDescribeStatementContext(this.context, this.state); + this.enterRule(localContext, 600, MySqlParser.RULE_analyzeDescribeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6638; + localContext._command = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 45)) & ~0x1F) === 0 && ((1 << (_la - 45)) & 131075) !== 0))) { + localContext._command = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6639; + this.match(MySqlParser.KW_ANALYZE); + this.state = 6643; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 826) { + { + this.state = 6640; + this.match(MySqlParser.KW_FORMAT); + this.state = 6641; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6642; + this.match(MySqlParser.KW_TREE); + } + } + this.state = 6645; + this.selectStatement(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + helpStatement() { + let localContext = new HelpStatementContext(this.context, this.state); + this.enterRule(localContext, 602, MySqlParser.RULE_helpStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6647; + this.match(MySqlParser.KW_HELP); + this.state = 6648; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + useStatement() { + let localContext = new UseStatementContext(this.context, this.state); + this.enterRule(localContext, 604, MySqlParser.RULE_useStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6650; + this.match(MySqlParser.KW_USE); + this.state = 6651; + this.databaseName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + signalStatement() { + let localContext = new SignalStatementContext(this.context, this.state); + this.enterRule(localContext, 606, MySqlParser.RULE_signalStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6653; + this.match(MySqlParser.KW_SIGNAL); + this.state = 6661; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SQLSTATE: + { + { + this.state = 6654; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 6656; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 6655; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 6658; + this.stringLiteral(); + } + } + break; + case MySqlParser.ID: + { + this.state = 6659; + this.match(MySqlParser.ID); + } + break; + case MySqlParser.REVERSE_QUOTE_ID: + { + this.state = 6660; + this.match(MySqlParser.REVERSE_QUOTE_ID); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6672; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 960, this.context)) { + case 1: + { + this.state = 6663; + this.match(MySqlParser.KW_SET); + this.state = 6664; + this.signalConditionInformation(); + this.state = 6669; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6665; + this.match(MySqlParser.COMMA); + this.state = 6666; + this.signalConditionInformation(); + } + } + this.state = 6671; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resignalStatement() { + let localContext = new ResignalStatementContext(this.context, this.state); + this.enterRule(localContext, 608, MySqlParser.RULE_resignalStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6674; + this.match(MySqlParser.KW_RESIGNAL); + this.state = 6682; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SQLSTATE: + { + { + this.state = 6675; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 6677; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 6676; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 6679; + this.stringLiteral(); + } + } + break; + case MySqlParser.ID: + { + this.state = 6680; + this.match(MySqlParser.ID); + } + break; + case MySqlParser.REVERSE_QUOTE_ID: + { + this.state = 6681; + this.match(MySqlParser.REVERSE_QUOTE_ID); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.SEMI: + break; + default: + break; + } + this.state = 6693; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 964, this.context)) { + case 1: + { + this.state = 6684; + this.match(MySqlParser.KW_SET); + this.state = 6685; + this.signalConditionInformation(); + this.state = 6690; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6686; + this.match(MySqlParser.COMMA); + this.state = 6687; + this.signalConditionInformation(); + } + } + this.state = 6692; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + signalConditionInformation() { + let localContext = new SignalConditionInformationContext(this.context, this.state); + this.enterRule(localContext, 610, MySqlParser.RULE_signalConditionInformation); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6695; + _la = this.tokenStream.LA(1); + if (!(((((_la - 332)) & ~0x1F) === 0 && ((1 << (_la - 332)) & 137887873) !== 0) || _la === 487 || _la === 495 || _la === 650 || _la === 657 || _la === 822 || _la === 832)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6696; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6701; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.START_NATIONAL_STRING_LITERAL: + case MySqlParser.STRING_LITERAL: + case MySqlParser.STRING_CHARSET_NAME: + { + this.state = 6697; + this.stringLiteral(); + } + break; + case MySqlParser.DECIMAL_LITERAL: + { + this.state = 6698; + this.match(MySqlParser.DECIMAL_LITERAL); + } + break; + case MySqlParser.LOCAL_ID: + case MySqlParser.GLOBAL_ID: + { + this.state = 6699; + this.mysqlVariable(); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.ID: + { + this.state = 6700; + this.simpleId(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + withStatement() { + let localContext = new WithStatementContext(this.context, this.state); + this.enterRule(localContext, 612, MySqlParser.RULE_withStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6703; + this.match(MySqlParser.KW_WITH); + this.state = 6705; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 966, this.context)) { + case 1: + { + this.state = 6704; + this.match(MySqlParser.KW_RECURSIVE); + } + break; + } + this.state = 6707; + this.commonTableExpressions(); + this.state = 6712; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6708; + this.match(MySqlParser.COMMA); + this.state = 6709; + this.commonTableExpressions(); + } + } + this.state = 6714; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableStatement() { + let localContext = new TableStatementContext(this.context, this.state); + this.enterRule(localContext, 614, MySqlParser.RULE_tableStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6715; + this.match(MySqlParser.KW_TABLE); + this.state = 6716; + this.tableName(); + this.state = 6718; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 968, this.context)) { + case 1: + { + this.state = 6717; + this.orderByClause(); + } + break; + } + this.state = 6721; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 969, this.context)) { + case 1: + { + this.state = 6720; + this.limitClause(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + diagnosticsStatement() { + let localContext = new DiagnosticsStatementContext(this.context, this.state); + this.enterRule(localContext, 616, MySqlParser.RULE_diagnosticsStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6723; + this.match(MySqlParser.KW_GET); + this.state = 6725; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 36 || _la === 170) { + { + this.state = 6724; + _la = this.tokenStream.LA(1); + if (!(_la === 36 || _la === 170)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6727; + this.match(MySqlParser.KW_DIAGNOSTICS); + this.state = 6759; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 974, this.context)) { + case 1: + { + { + this.state = 6728; + this.variableClause(); + this.state = 6729; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6730; + _la = this.tokenStream.LA(1); + if (!(_la === 117 || _la === 831)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6738; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6731; + this.match(MySqlParser.COMMA); + this.state = 6732; + this.variableClause(); + this.state = 6733; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6734; + _la = this.tokenStream.LA(1); + if (!(_la === 117 || _la === 831)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6740; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + case 2: + { + { + this.state = 6741; + this.match(MySqlParser.KW_CONDITION); + this.state = 6744; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 6742; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PERSIST: + case MySqlParser.KW_PERSIST_ONLY: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.AT_SIGN: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + case MySqlParser.LOCAL_ID: + case MySqlParser.GLOBAL_ID: + { + this.state = 6743; + this.variableClause(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6746; + this.variableClause(); + this.state = 6747; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6748; + this.diagnosticsConditionInformationName(); + this.state = 6756; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6749; + this.match(MySqlParser.COMMA); + this.state = 6750; + this.variableClause(); + this.state = 6751; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6752; + this.diagnosticsConditionInformationName(); + } + } + this.state = 6758; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + diagnosticsConditionInformationName() { + let localContext = new DiagnosticsConditionInformationNameContext(this.context, this.state); + this.enterRule(localContext, 618, MySqlParser.RULE_diagnosticsConditionInformationName); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6761; + _la = this.tokenStream.LA(1); + if (!(((((_la - 332)) & ~0x1F) === 0 && ((1 << (_la - 332)) & 137887873) !== 0) || _la === 487 || _la === 495 || _la === 578 || _la === 650 || _la === 657 || _la === 822 || _la === 832)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + describeObjectClause() { + let localContext = new DescribeObjectClauseContext(this.context, this.state); + this.enterRule(localContext, 620, MySqlParser.RULE_describeObjectClause); + try { + this.state = 6773; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DELETE: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_UPDATE: + case MySqlParser.LR_BRACKET: + localContext = new DescribeStatementsContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6768; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.LR_BRACKET: + { + this.state = 6763; + this.selectStatement(); + } + break; + case MySqlParser.KW_DELETE: + { + this.state = 6764; + this.deleteStatement(); + } + break; + case MySqlParser.KW_INSERT: + { + this.state = 6765; + this.insertStatement(); + } + break; + case MySqlParser.KW_REPLACE: + { + this.state = 6766; + this.replaceStatement(); + } + break; + case MySqlParser.KW_UPDATE: + { + this.state = 6767; + this.updateStatement(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_FOR: + localContext = new DescribeConnectionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6770; + this.match(MySqlParser.KW_FOR); + this.state = 6771; + this.match(MySqlParser.KW_CONNECTION); + this.state = 6772; + localContext._connection_id = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + databaseNameCreate() { + let localContext = new DatabaseNameCreateContext(this.context, this.state); + this.enterRule(localContext, 622, MySqlParser.RULE_databaseNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6775; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + databaseName() { + let localContext = new DatabaseNameContext(this.context, this.state); + this.enterRule(localContext, 624, MySqlParser.RULE_databaseName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6777; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionNameCreate() { + let localContext = new FunctionNameCreateContext(this.context, this.state); + this.enterRule(localContext, 626, MySqlParser.RULE_functionNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6779; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionName() { + let localContext = new FunctionNameContext(this.context, this.state); + this.enterRule(localContext, 628, MySqlParser.RULE_functionName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6781; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + viewNameCreate() { + let localContext = new ViewNameCreateContext(this.context, this.state); + this.enterRule(localContext, 630, MySqlParser.RULE_viewNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6783; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + viewName() { + let localContext = new ViewNameContext(this.context, this.state); + this.enterRule(localContext, 632, MySqlParser.RULE_viewName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6785; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexNameCreate() { + let localContext = new IndexNameCreateContext(this.context, this.state); + this.enterRule(localContext, 634, MySqlParser.RULE_indexNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6787; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexNames() { + let localContext = new IndexNamesContext(this.context, this.state); + this.enterRule(localContext, 636, MySqlParser.RULE_indexNames); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6789; + this.indexName(); + this.state = 6794; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6790; + this.match(MySqlParser.COMMA); + this.state = 6791; + this.indexName(); + } + } + this.state = 6796; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexName() { + let localContext = new IndexNameContext(this.context, this.state); + this.enterRule(localContext, 638, MySqlParser.RULE_indexName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6797; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupNameCreate() { + let localContext = new GroupNameCreateContext(this.context, this.state); + this.enterRule(localContext, 640, MySqlParser.RULE_groupNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6799; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupName() { + let localContext = new GroupNameContext(this.context, this.state); + this.enterRule(localContext, 642, MySqlParser.RULE_groupName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6801; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableNameCreate() { + let localContext = new TableNameCreateContext(this.context, this.state); + this.enterRule(localContext, 644, MySqlParser.RULE_tableNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6803; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableNames() { + let localContext = new TableNamesContext(this.context, this.state); + this.enterRule(localContext, 646, MySqlParser.RULE_tableNames); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 6805; + this.tableName(); + this.state = 6810; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 978, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 6806; + this.match(MySqlParser.COMMA); + this.state = 6807; + this.tableName(); + } + } + } + this.state = 6812; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 978, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableName() { + let localContext = new TableNameContext(this.context, this.state); + this.enterRule(localContext, 648, MySqlParser.RULE_tableName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6813; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userOrRoleNames() { + let localContext = new UserOrRoleNamesContext(this.context, this.state); + this.enterRule(localContext, 650, MySqlParser.RULE_userOrRoleNames); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6815; + this.userOrRoleName(); + this.state = 6820; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6816; + this.match(MySqlParser.COMMA); + this.state = 6817; + this.userOrRoleName(); + } + } + this.state = 6822; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userOrRoleName() { + let localContext = new UserOrRoleNameContext(this.context, this.state); + this.enterRule(localContext, 652, MySqlParser.RULE_userOrRoleName); + try { + this.state = 6825; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 980, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6823; + this.userName(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6824; + this.uid(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnNameCreate() { + let localContext = new ColumnNameCreateContext(this.context, this.state); + this.enterRule(localContext, 654, MySqlParser.RULE_columnNameCreate); + let _la; + try { + this.state = 6841; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 985, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6827; + this.uid(); + this.state = 6832; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 6828; + this.dottedId(); + this.state = 6830; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 6829; + this.dottedId(); + } + } + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6835; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 983, this.context)) { + case 1: + { + this.state = 6834; + this.matchWildcard(); + } + break; + } + this.state = 6837; + this.dottedId(); + this.state = 6839; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 6838; + this.dottedId(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnNames() { + let localContext = new ColumnNamesContext(this.context, this.state); + this.enterRule(localContext, 656, MySqlParser.RULE_columnNames); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 6843; + this.columnName(); + this.state = 6848; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 986, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 6844; + this.match(MySqlParser.COMMA); + this.state = 6845; + this.columnName(); + } + } + } + this.state = 6850; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 986, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnName() { + let localContext = new ColumnNameContext(this.context, this.state); + this.enterRule(localContext, 658, MySqlParser.RULE_columnName); + try { + this.state = 6866; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 991, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6851; + this.uid(); + this.state = 6856; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 988, this.context)) { + case 1: + { + this.state = 6852; + this.dottedId(); + this.state = 6854; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 987, this.context)) { + case 1: + { + this.state = 6853; + this.dottedId(); + } + break; + } + } + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6859; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 989, this.context)) { + case 1: + { + this.state = 6858; + this.matchWildcard(); + } + break; + } + this.state = 6861; + this.dottedId(); + this.state = 6863; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 990, this.context)) { + case 1: + { + this.state = 6862; + this.dottedId(); + } + break; + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6865; + if (!(this.shouldMatchEmpty())) { + throw this.createFailedPredicateException("this.shouldMatchEmpty()"); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablespaceNameCreate() { + let localContext = new TablespaceNameCreateContext(this.context, this.state); + this.enterRule(localContext, 660, MySqlParser.RULE_tablespaceNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6868; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablespaceName() { + let localContext = new TablespaceNameContext(this.context, this.state); + this.enterRule(localContext, 662, MySqlParser.RULE_tablespaceName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6870; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionNameCreate() { + let localContext = new PartitionNameCreateContext(this.context, this.state); + this.enterRule(localContext, 664, MySqlParser.RULE_partitionNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6872; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionNames() { + let localContext = new PartitionNamesContext(this.context, this.state); + this.enterRule(localContext, 666, MySqlParser.RULE_partitionNames); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 6874; + this.partitionName(); + this.state = 6879; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 992, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 6875; + this.match(MySqlParser.COMMA); + this.state = 6876; + this.partitionName(); + } + } + } + this.state = 6881; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 992, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionName() { + let localContext = new PartitionNameContext(this.context, this.state); + this.enterRule(localContext, 668, MySqlParser.RULE_partitionName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6882; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexColumnName() { + let localContext = new IndexColumnNameContext(this.context, this.state); + this.enterRule(localContext, 670, MySqlParser.RULE_indexColumnName); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6892; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 994, this.context)) { + case 1: + { + this.state = 6884; + this.uid(); + this.state = 6889; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 993, this.context)) { + case 1: + { + this.state = 6885; + this.match(MySqlParser.LR_BRACKET); + this.state = 6886; + this.decimalLiteral(); + this.state = 6887; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 2: + { + this.state = 6891; + this.expression(0); + } + break; + } + this.state = 6895; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 995, this.context)) { + case 1: + { + this.state = 6894; + localContext._sortType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45)) { + localContext._sortType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userHostPort() { + let localContext = new UserHostPortContext(this.context, this.state); + this.enterRule(localContext, 672, MySqlParser.RULE_userHostPort); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6897; + this.userAtHost(); + this.state = 6898; + this.match(MySqlParser.COLON_SYMB); + this.state = 6899; + this.decimalLiteral(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userAtHost() { + let localContext = new UserAtHostContext(this.context, this.state); + this.enterRule(localContext, 674, MySqlParser.RULE_userAtHost); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6901; + this.simpleUserName(); + this.state = 6902; + this.match(MySqlParser.HOST_IP_ADDRESS); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleUserName() { + let localContext = new SimpleUserNameContext(this.context, this.state); + this.enterRule(localContext, 676, MySqlParser.RULE_simpleUserName); + try { + this.state = 6908; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 996, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6904; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6905; + this.match(MySqlParser.ID); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6906; + this.match(MySqlParser.KW_ADMIN); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 6907; + this.keywordsCanBeId(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + hostName() { + let localContext = new HostNameContext(this.context, this.state); + this.enterRule(localContext, 678, MySqlParser.RULE_hostName); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6910; + _la = this.tokenStream.LA(1); + if (!(((((_la - 870)) & ~0x1F) === 0 && ((1 << (_la - 870)) & 6291457) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userName() { + let localContext = new UserNameContext(this.context, this.state); + this.enterRule(localContext, 680, MySqlParser.RULE_userName); + let _la; + try { + this.state = 6917; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 998, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6912; + this.simpleUserName(); + this.state = 6914; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 870)) & ~0x1F) === 0 && ((1 << (_la - 870)) & 6291457) !== 0)) { + { + this.state = 6913; + this.hostName(); + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6916; + this.currentUserExpression(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + mysqlVariable() { + let localContext = new MysqlVariableContext(this.context, this.state); + this.enterRule(localContext, 682, MySqlParser.RULE_mysqlVariable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6919; + _la = this.tokenStream.LA(1); + if (!(_la === 892 || _la === 893)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + charsetName() { + let localContext = new CharsetNameContext(this.context, this.state); + this.enterRule(localContext, 684, MySqlParser.RULE_charsetName); + try { + this.state = 6925; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 999, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6921; + this.match(MySqlParser.KW_BINARY); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6922; + this.charsetNameBase(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6923; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 6924; + this.match(MySqlParser.CHARSET_REVERSE_QOUTE_STRING); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + collationName() { + let localContext = new CollationNameContext(this.context, this.state); + this.enterRule(localContext, 686, MySqlParser.RULE_collationName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6927; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + engineName() { + let localContext = new EngineNameContext(this.context, this.state); + this.enterRule(localContext, 688, MySqlParser.RULE_engineName); + try { + this.state = 6932; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + this.enterOuterAlt(localContext, 1); + { + this.state = 6929; + this.engineNameBase(); + } + break; + case MySqlParser.ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 6930; + this.match(MySqlParser.ID); + } + break; + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 3); + { + this.state = 6931; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + engineNameBase() { + let localContext = new EngineNameBaseContext(this.context, this.state); + this.enterRule(localContext, 690, MySqlParser.RULE_engineNameBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6934; + _la = this.tokenStream.LA(1); + if (!(_la === 348 || ((((_la - 797)) & ~0x1F) === 0 && ((1 << (_la - 797)) & 4095) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uuidSet() { + let localContext = new UuidSetContext(this.context, this.state); + this.enterRule(localContext, 692, MySqlParser.RULE_uuidSet); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6936; + this.decimalLiteral(); + this.state = 6937; + this.match(MySqlParser.MINUS); + this.state = 6938; + this.decimalLiteral(); + this.state = 6939; + this.match(MySqlParser.MINUS); + this.state = 6940; + this.decimalLiteral(); + this.state = 6941; + this.match(MySqlParser.MINUS); + this.state = 6942; + this.decimalLiteral(); + this.state = 6943; + this.match(MySqlParser.MINUS); + this.state = 6944; + this.decimalLiteral(); + this.state = 6950; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 6945; + this.match(MySqlParser.COLON_SYMB); + this.state = 6946; + this.decimalLiteral(); + this.state = 6947; + this.match(MySqlParser.MINUS); + this.state = 6948; + this.decimalLiteral(); + } + } + this.state = 6952; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 878); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xid() { + let localContext = new XidContext(this.context, this.state); + this.enterRule(localContext, 694, MySqlParser.RULE_xid); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6954; + localContext._globalTableUid = this.xuidStringId(); + this.state = 6961; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 6955; + this.match(MySqlParser.COMMA); + this.state = 6956; + localContext._qualifier = this.xuidStringId(); + this.state = 6959; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 6957; + this.match(MySqlParser.COMMA); + this.state = 6958; + localContext._idFormat = this.decimalLiteral(); + } + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xuidStringId() { + let localContext = new XuidStringIdContext(this.context, this.state); + this.enterRule(localContext, 696, MySqlParser.RULE_xuidStringId); + let _la; + try { + this.state = 6970; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 6963; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.BIT_STRING: + this.enterOuterAlt(localContext, 2); + { + this.state = 6964; + this.match(MySqlParser.BIT_STRING); + } + break; + case MySqlParser.HEXADECIMAL_LITERAL: + this.enterOuterAlt(localContext, 3); + { + this.state = 6966; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 6965; + this.match(MySqlParser.HEXADECIMAL_LITERAL); + } + } + this.state = 6968; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 884); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fullId() { + let localContext = new FullIdContext(this.context, this.state); + this.enterRule(localContext, 698, MySqlParser.RULE_fullId); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6972; + this.uid(); + this.state = 6974; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1006, this.context)) { + case 1: + { + this.state = 6973; + this.dottedId(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uidList() { + let localContext = new UidListContext(this.context, this.state); + this.enterRule(localContext, 700, MySqlParser.RULE_uidList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6976; + this.uid(); + this.state = 6981; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6977; + this.match(MySqlParser.COMMA); + this.state = 6978; + this.uid(); + } + } + this.state = 6983; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uid() { + let localContext = new UidContext(this.context, this.state); + this.enterRule(localContext, 702, MySqlParser.RULE_uid); + try { + this.state = 6987; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 1); + { + this.state = 6984; + this.simpleId(); + } + break; + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + this.enterOuterAlt(localContext, 2); + { + this.state = 6985; + this.match(MySqlParser.CHARSET_REVERSE_QOUTE_STRING); + } + break; + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 3); + { + this.state = 6986; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleId() { + let localContext = new SimpleIdContext(this.context, this.state); + this.enterRule(localContext, 704, MySqlParser.RULE_simpleId); + try { + this.state = 6998; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1009, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6989; + this.match(MySqlParser.ID); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6990; + this.charsetNameBase(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6991; + this.transactionLevelBase(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 6992; + this.engineNameBase(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 6993; + this.privilegesBase(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 6994; + this.intervalTypeBase(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 6995; + this.dataTypeBase(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 6996; + this.keywordsCanBeId(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 6997; + this.scalarFunctionName(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dottedId() { + let localContext = new DottedIdContext(this.context, this.state); + this.enterRule(localContext, 706, MySqlParser.RULE_dottedId); + try { + this.state = 7004; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1010, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7000; + this.match(MySqlParser.DOT); + this.state = 7001; + this.match(MySqlParser.ID); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7002; + this.match(MySqlParser.DOT); + this.state = 7003; + this.uid(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + decimalLiteral() { + let localContext = new DecimalLiteralContext(this.context, this.state); + this.enterRule(localContext, 708, MySqlParser.RULE_decimalLiteral); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7006; + _la = this.tokenStream.LA(1); + if (!(((((_la - 871)) & ~0x1F) === 0 && ((1 << (_la - 871)) & 20495) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fileSizeLiteral() { + let localContext = new FileSizeLiteralContext(this.context, this.state); + this.enterRule(localContext, 710, MySqlParser.RULE_fileSizeLiteral); + try { + this.state = 7010; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.FILESIZE_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 7008; + this.match(MySqlParser.FILESIZE_LITERAL); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + this.enterOuterAlt(localContext, 2); + { + this.state = 7009; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stringLiteral() { + let localContext = new StringLiteralContext(this.context, this.state); + this.enterRule(localContext, 712, MySqlParser.RULE_stringLiteral); + let _la; + try { + let alternative; + this.state = 7035; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1018, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7017; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + case MySqlParser.STRING_CHARSET_NAME: + { + this.state = 7013; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 888) { + { + this.state = 7012; + this.match(MySqlParser.STRING_CHARSET_NAME); + } + } + this.state = 7015; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.START_NATIONAL_STRING_LITERAL: + { + this.state = 7016; + this.match(MySqlParser.START_NATIONAL_STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7020; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 7019; + this.match(MySqlParser.STRING_LITERAL); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7022; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1014, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7029; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + case MySqlParser.STRING_CHARSET_NAME: + { + this.state = 7025; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 888) { + { + this.state = 7024; + this.match(MySqlParser.STRING_CHARSET_NAME); + } + } + this.state = 7027; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.START_NATIONAL_STRING_LITERAL: + { + this.state = 7028; + this.match(MySqlParser.START_NATIONAL_STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7033; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1017, this.context)) { + case 1: + { + this.state = 7031; + this.match(MySqlParser.KW_COLLATE); + this.state = 7032; + this.collationName(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + booleanLiteral() { + let localContext = new BooleanLiteralContext(this.context, this.state); + this.enterRule(localContext, 714, MySqlParser.RULE_booleanLiteral); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7037; + _la = this.tokenStream.LA(1); + if (!(_la === 63 || _la === 179)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + hexadecimalLiteral() { + let localContext = new HexadecimalLiteralContext(this.context, this.state); + this.enterRule(localContext, 716, MySqlParser.RULE_hexadecimalLiteral); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7040; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 888) { + { + this.state = 7039; + this.match(MySqlParser.STRING_CHARSET_NAME); + } + } + this.state = 7042; + this.match(MySqlParser.HEXADECIMAL_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + nullNotnull() { + let localContext = new NullNotnullContext(this.context, this.state); + this.enterRule(localContext, 718, MySqlParser.RULE_nullNotnull); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7045; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7044; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7047; + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 886)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + constant() { + let localContext = new ConstantContext(this.context, this.state); + this.enterRule(localContext, 720, MySqlParser.RULE_constant); + let _la; + try { + this.state = 7061; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1022, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7049; + this.stringLiteral(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7050; + this.decimalLiteral(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7051; + this.match(MySqlParser.MINUS); + this.state = 7052; + this.decimalLiteral(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7053; + this.hexadecimalLiteral(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 7054; + this.booleanLiteral(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 7055; + this.match(MySqlParser.REAL_LITERAL); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 7056; + this.match(MySqlParser.BIT_STRING); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 7058; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7057; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7060; + localContext._nullLiteral = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 886)) { + localContext._nullLiteral = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dataType() { + let localContext = new DataTypeContext(this.context, this.state); + this.enterRule(localContext, 722, MySqlParser.RULE_dataType); + let _la; + try { + this.state = 7189; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1051, this.context)) { + case 1: + localContext = new StringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7063; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 26 || ((((_la - 224)) & ~0x1F) === 0 && ((1 << (_la - 224)) & 31239) !== 0) || _la === 498)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7065; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 240) { + { + this.state = 7064; + this.match(MySqlParser.KW_VARYING); + } + } + this.state = 7068; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1024, this.context)) { + case 1: + { + this.state = 7067; + this.lengthOneDimension(); + } + break; + } + this.state = 7071; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1025, this.context)) { + case 1: + { + this.state = 7070; + this.match(MySqlParser.KW_BINARY); + } + break; + } + this.state = 7076; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7073; + this.charSet(); + this.state = 7074; + this.charsetName(); + } + } + this.state = 7081; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1027, this.context)) { + case 1: + { + this.state = 7078; + this.match(MySqlParser.KW_COLLATE); + this.state = 7079; + this.collationName(); + } + break; + case 2: + { + this.state = 7080; + this.match(MySqlParser.KW_BINARY); + } + break; + } + } + break; + case 2: + localContext = new NationalVaryingStringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7083; + this.match(MySqlParser.KW_NATIONAL); + this.state = 7084; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 26 || _la === 224)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7085; + this.match(MySqlParser.KW_VARYING); + this.state = 7087; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1028, this.context)) { + case 1: + { + this.state = 7086; + this.lengthOneDimension(); + } + break; + } + this.state = 7090; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7089; + this.match(MySqlParser.KW_BINARY); + } + } + } + break; + case 3: + localContext = new NationalStringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 7092; + this.match(MySqlParser.KW_NATIONAL); + this.state = 7093; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 26 || _la === 224 || _la === 225)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7095; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1030, this.context)) { + case 1: + { + this.state = 7094; + this.lengthOneDimension(); + } + break; + } + this.state = 7098; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7097; + this.match(MySqlParser.KW_BINARY); + } + } + } + break; + case 4: + localContext = new NationalStringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 7100; + this.match(MySqlParser.KW_NCHAR); + this.state = 7101; + localContext._typeName = this.match(MySqlParser.KW_VARCHAR); + this.state = 7103; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1032, this.context)) { + case 1: + { + this.state = 7102; + this.lengthOneDimension(); + } + break; + } + this.state = 7106; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7105; + this.match(MySqlParser.KW_BINARY); + } + } + } + break; + case 5: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 7108; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 198)) & ~0x1F) === 0 && ((1 << (_la - 198)) & 4095) !== 0))) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7110; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1034, this.context)) { + case 1: + { + this.state = 7109; + this.lengthOneDimension(); + } + break; + } + this.state = 7115; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7112; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7117; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 6: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 7118; + localContext._typeName = this.match(MySqlParser.KW_REAL); + this.state = 7120; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1036, this.context)) { + case 1: + { + this.state = 7119; + this.lengthTwoDimension(); + } + break; + } + this.state = 7125; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7122; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7127; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 7: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 7128; + localContext._typeName = this.match(MySqlParser.KW_DOUBLE); + this.state = 7130; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 212) { + { + this.state = 7129; + this.match(MySqlParser.KW_PRECISION); + } + } + this.state = 7133; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1039, this.context)) { + case 1: + { + this.state = 7132; + this.lengthTwoDimension(); + } + break; + } + this.state = 7138; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7135; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7140; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 8: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 7141; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 213)) & ~0x1F) === 0 && ((1 << (_la - 213)) & 63) !== 0) || _la === 403)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7143; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1041, this.context)) { + case 1: + { + this.state = 7142; + this.lengthTwoOptionalDimension(); + } + break; + } + this.state = 7148; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7145; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7150; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 9: + localContext = new SimpleDataTypeContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 7151; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 4237313) !== 0) || _la === 321 || _la === 322)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 10: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 7152; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 220)) & ~0x1F) === 0 && ((1 << (_la - 220)) & 2831) !== 0) || _la === 319)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7154; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1043, this.context)) { + case 1: + { + this.state = 7153; + this.lengthOneDimension(); + } + break; + } + } + break; + case 11: + localContext = new CollectionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 7156; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 155 || _la === 239)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7157; + this.collectionOptions(); + this.state = 7159; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7158; + this.match(MySqlParser.KW_BINARY); + } + } + this.state = 7164; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7161; + this.charSet(); + this.state = 7162; + this.charsetName(); + } + } + } + break; + case 12: + localContext = new SpatialDataTypeContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 7166; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 442 || ((((_la - 813)) & ~0x1F) === 0 && ((1 << (_la - 813)) & 511) !== 0))) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7169; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 834) { + { + this.state = 7167; + this.match(MySqlParser.KW_SRID); + this.state = 7168; + this.decimalLiteral(); + } + } + } + break; + case 13: + localContext = new LongVarcharDataTypeContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 7171; + localContext._typeName = this.match(MySqlParser.KW_LONG); + this.state = 7173; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 225) { + { + this.state = 7172; + this.match(MySqlParser.KW_VARCHAR); + } + } + this.state = 7176; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7175; + this.match(MySqlParser.KW_BINARY); + } + } + this.state = 7181; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7178; + this.charSet(); + this.state = 7179; + this.charsetName(); + } + } + this.state = 7185; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1050, this.context)) { + case 1: + { + this.state = 7183; + this.match(MySqlParser.KW_COLLATE); + this.state = 7184; + this.collationName(); + } + break; + } + } + break; + case 14: + localContext = new LongVarbinaryDataTypeContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 7187; + this.match(MySqlParser.KW_LONG); + this.state = 7188; + this.match(MySqlParser.KW_VARBINARY); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + collectionOptions() { + let localContext = new CollectionOptionsContext(this.context, this.state); + this.enterRule(localContext, 724, MySqlParser.RULE_collectionOptions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7191; + this.match(MySqlParser.LR_BRACKET); + this.state = 7192; + this.match(MySqlParser.STRING_LITERAL); + this.state = 7197; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7193; + this.match(MySqlParser.COMMA); + this.state = 7194; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 7199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7200; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + convertedDataType() { + let localContext = new ConvertedDataTypeContext(this.context, this.state); + this.enterRule(localContext, 726, MySqlParser.RULE_convertedDataType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7224; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_NCHAR: + { + this.state = 7202; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 228 || _la === 498)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7204; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 7203; + this.lengthOneDimension(); + } + } + } + break; + case MySqlParser.KW_CHAR: + { + this.state = 7206; + localContext._typeName = this.match(MySqlParser.KW_CHAR); + this.state = 7208; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 7207; + this.lengthOneDimension(); + } + } + this.state = 7213; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7210; + this.charSet(); + this.state = 7211; + this.charsetName(); + } + } + } + break; + case MySqlParser.KW_INT: + case MySqlParser.KW_INTEGER: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_JSON: + { + this.state = 7215; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 202)) & ~0x1F) === 0 && ((1 << (_la - 202)) & 1441857) !== 0) || _la === 442)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_DECIMAL: + case MySqlParser.KW_DEC: + { + this.state = 7216; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 216 || _la === 217)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7218; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 7217; + this.lengthTwoOptionalDimension(); + } + } + } + break; + case MySqlParser.KW_UNSIGNED: + case MySqlParser.KW_SIGNED: + { + this.state = 7220; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7222; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 202 || _la === 208) { + { + this.state = 7221; + _la = this.tokenStream.LA(1); + if (!(_la === 202 || _la === 208)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7227; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 12) { + { + this.state = 7226; + this.match(MySqlParser.KW_ARRAY); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lengthOneDimension() { + let localContext = new LengthOneDimensionContext(this.context, this.state); + this.enterRule(localContext, 728, MySqlParser.RULE_lengthOneDimension); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7229; + this.match(MySqlParser.LR_BRACKET); + this.state = 7230; + this.decimalLiteral(); + this.state = 7231; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lengthTwoDimension() { + let localContext = new LengthTwoDimensionContext(this.context, this.state); + this.enterRule(localContext, 730, MySqlParser.RULE_lengthTwoDimension); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7233; + this.match(MySqlParser.LR_BRACKET); + this.state = 7234; + this.decimalLiteral(); + this.state = 7235; + this.match(MySqlParser.COMMA); + this.state = 7236; + this.decimalLiteral(); + this.state = 7237; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lengthTwoOptionalDimension() { + let localContext = new LengthTwoOptionalDimensionContext(this.context, this.state); + this.enterRule(localContext, 732, MySqlParser.RULE_lengthTwoOptionalDimension); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7239; + this.match(MySqlParser.LR_BRACKET); + this.state = 7240; + this.decimalLiteral(); + this.state = 7243; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 7241; + this.match(MySqlParser.COMMA); + this.state = 7242; + this.decimalLiteral(); + } + } + this.state = 7245; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexColumnNames() { + let localContext = new IndexColumnNamesContext(this.context, this.state); + this.enterRule(localContext, 734, MySqlParser.RULE_indexColumnNames); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7247; + this.match(MySqlParser.LR_BRACKET); + this.state = 7248; + this.indexColumnName(); + this.state = 7253; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7249; + this.match(MySqlParser.COMMA); + this.state = 7250; + this.indexColumnName(); + } + } + this.state = 7255; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7256; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expressions() { + let localContext = new ExpressionsContext(this.context, this.state); + this.enterRule(localContext, 736, MySqlParser.RULE_expressions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7258; + this.expression(0); + this.state = 7263; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7259; + this.match(MySqlParser.COMMA); + this.state = 7260; + this.expression(0); + } + } + this.state = 7265; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + valuesOrValueList() { + let localContext = new ValuesOrValueListContext(this.context, this.state); + this.enterRule(localContext, 738, MySqlParser.RULE_valuesOrValueList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7266; + _la = this.tokenStream.LA(1); + if (!(_la === 189 || _la === 682)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7267; + this.expressionsWithDefaults(); + this.state = 7272; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7268; + this.match(MySqlParser.COMMA); + this.state = 7269; + this.expressionsWithDefaults(); + } + } + this.state = 7274; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expressionsWithDefaults() { + let localContext = new ExpressionsWithDefaultsContext(this.context, this.state); + this.enterRule(localContext, 740, MySqlParser.RULE_expressionsWithDefaults); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7275; + this.match(MySqlParser.LR_BRACKET); + this.state = 7276; + this.expressionOrDefault(); + this.state = 7281; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7277; + this.match(MySqlParser.COMMA); + this.state = 7278; + this.expressionOrDefault(); + } + } + this.state = 7283; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7284; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expressionOrDefault() { + let localContext = new ExpressionOrDefaultContext(this.context, this.state); + this.enterRule(localContext, 742, MySqlParser.RULE_expressionOrDefault); + try { + this.state = 7288; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1065, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7286; + this.expression(0); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7287; + this.match(MySqlParser.KW_DEFAULT); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + constants() { + let localContext = new ConstantsContext(this.context, this.state); + this.enterRule(localContext, 744, MySqlParser.RULE_constants); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7290; + this.constant(); + this.state = 7295; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7291; + this.match(MySqlParser.COMMA); + this.state = 7292; + this.constant(); + } + } + this.state = 7297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleStrings() { + let localContext = new SimpleStringsContext(this.context, this.state); + this.enterRule(localContext, 746, MySqlParser.RULE_simpleStrings); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7298; + this.match(MySqlParser.STRING_LITERAL); + this.state = 7303; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7299; + this.match(MySqlParser.COMMA); + this.state = 7300; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 7305; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userVariables() { + let localContext = new UserVariablesContext(this.context, this.state); + this.enterRule(localContext, 748, MySqlParser.RULE_userVariables); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7306; + this.match(MySqlParser.LOCAL_ID); + this.state = 7311; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7307; + this.match(MySqlParser.COMMA); + this.state = 7308; + this.match(MySqlParser.LOCAL_ID); + } + } + this.state = 7313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + defaultValue() { + let localContext = new DefaultValueContext(this.context, this.state); + this.enterRule(localContext, 750, MySqlParser.RULE_defaultValue); + try { + this.state = 7340; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1071, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7314; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7315; + this.match(MySqlParser.KW_CAST); + this.state = 7316; + this.match(MySqlParser.LR_BRACKET); + this.state = 7317; + this.expression(0); + this.state = 7318; + this.match(MySqlParser.KW_AS); + this.state = 7319; + this.convertedDataType(); + this.state = 7320; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7323; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1069, this.context)) { + case 1: + { + this.state = 7322; + this.unaryOperator(); + } + break; + } + this.state = 7325; + this.constant(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7326; + this.currentTimestamp(); + this.state = 7330; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1070, this.context)) { + case 1: + { + this.state = 7327; + this.match(MySqlParser.KW_ON); + this.state = 7328; + this.match(MySqlParser.KW_UPDATE); + this.state = 7329; + this.currentTimestamp(); + } + break; + } + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 7332; + this.match(MySqlParser.LR_BRACKET); + this.state = 7333; + this.expression(0); + this.state = 7334; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 7336; + this.match(MySqlParser.LR_BRACKET); + this.state = 7337; + this.fullId(); + this.state = 7338; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + currentTimestamp() { + let localContext = new CurrentTimestampContext(this.context, this.state); + this.enterRule(localContext, 752, MySqlParser.RULE_currentTimestamp); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7356; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_LOCALTIMESTAMP: + { + this.state = 7342; + _la = this.tokenStream.LA(1); + if (!(((((_la - 287)) & ~0x1F) === 0 && ((1 << (_la - 287)) & 131) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7348; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1073, this.context)) { + case 1: + { + this.state = 7343; + this.match(MySqlParser.LR_BRACKET); + this.state = 7345; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 871)) & ~0x1F) === 0 && ((1 << (_la - 871)) & 20495) !== 0)) { + { + this.state = 7344; + this.decimalLiteral(); + } + } + this.state = 7347; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case MySqlParser.KW_NOW: + { + this.state = 7350; + this.match(MySqlParser.KW_NOW); + this.state = 7351; + this.match(MySqlParser.LR_BRACKET); + this.state = 7353; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 871)) & ~0x1F) === 0 && ((1 << (_la - 871)) & 20495) !== 0)) { + { + this.state = 7352; + this.decimalLiteral(); + } + } + this.state = 7355; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ifExists() { + let localContext = new IfExistsContext(this.context, this.state); + this.enterRule(localContext, 754, MySqlParser.RULE_ifExists); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7358; + this.match(MySqlParser.KW_IF); + this.state = 7359; + this.match(MySqlParser.KW_EXISTS); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ifNotExists() { + let localContext = new IfNotExistsContext(this.context, this.state); + this.enterRule(localContext, 756, MySqlParser.RULE_ifNotExists); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7361; + this.match(MySqlParser.KW_IF); + this.state = 7362; + this.match(MySqlParser.KW_NOT); + this.state = 7363; + this.match(MySqlParser.KW_EXISTS); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + orReplace() { + let localContext = new OrReplaceContext(this.context, this.state); + this.enterRule(localContext, 758, MySqlParser.RULE_orReplace); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7365; + this.match(MySqlParser.KW_OR); + this.state = 7366; + this.match(MySqlParser.KW_REPLACE); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionCall() { + let localContext = new FunctionCallContext(this.context, this.state); + this.enterRule(localContext, 760, MySqlParser.RULE_functionCall); + try { + this.state = 7390; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1078, this.context)) { + case 1: + localContext = new SpecificFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7368; + this.specificFunction(); + } + break; + case 2: + localContext = new AggregateFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7369; + this.aggregateWindowedFunction(); + } + break; + case 3: + localContext = new NonAggregateFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 7370; + this.nonAggregateWindowedFunction(); + } + break; + case 4: + localContext = new ScalarFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 7371; + this.scalarFunctionName(); + this.state = 7378; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1076, this.context)) { + case 1: + { + this.state = 7372; + this.match(MySqlParser.LR_BRACKET); + this.state = 7373; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 7374; + this.match(MySqlParser.LR_BRACKET); + this.state = 7375; + this.functionArgs(); + this.state = 7376; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 5: + localContext = new UdfFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 7380; + this.functionName(); + this.state = 7387; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1077, this.context)) { + case 1: + { + this.state = 7381; + this.match(MySqlParser.LR_BRACKET); + this.state = 7382; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 7383; + this.match(MySqlParser.LR_BRACKET); + this.state = 7384; + this.functionArgs(); + this.state = 7385; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 6: + localContext = new PasswordFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 7389; + this.passwordFunctionClause(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + specificFunction() { + let localContext = new SpecificFunctionContext(this.context, this.state); + this.enterRule(localContext, 762, MySqlParser.RULE_specificFunction); + let _la; + try { + this.state = 7571; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1102, this.context)) { + case 1: + localContext = new SimpleFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7392; + _la = this.tokenStream.LA(1); + if (!(_la === 152 || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 262159) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7395; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1079, this.context)) { + case 1: + { + this.state = 7393; + this.match(MySqlParser.LR_BRACKET); + this.state = 7394; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 2: + localContext = new CurrentUserContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7397; + this.currentUserExpression(); + } + break; + case 3: + localContext = new DataTypeFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 7398; + this.match(MySqlParser.KW_CONVERT); + this.state = 7399; + this.match(MySqlParser.LR_BRACKET); + this.state = 7400; + this.expression(0); + this.state = 7401; + localContext._separator = this.match(MySqlParser.COMMA); + this.state = 7402; + this.convertedDataType(); + this.state = 7403; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 4: + localContext = new DataTypeFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 7405; + this.match(MySqlParser.KW_CONVERT); + this.state = 7406; + this.match(MySqlParser.LR_BRACKET); + this.state = 7407; + this.expression(0); + this.state = 7408; + this.match(MySqlParser.KW_USING); + this.state = 7409; + this.charsetName(); + this.state = 7410; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 5: + localContext = new DataTypeFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 7412; + this.match(MySqlParser.KW_CAST); + this.state = 7413; + this.match(MySqlParser.LR_BRACKET); + this.state = 7414; + this.expression(0); + this.state = 7415; + this.match(MySqlParser.KW_AS); + this.state = 7416; + this.convertedDataType(); + this.state = 7417; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 6: + localContext = new ValuesFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 7419; + this.match(MySqlParser.KW_VALUES); + this.state = 7420; + this.match(MySqlParser.LR_BRACKET); + this.state = 7421; + this.columnName(); + this.state = 7422; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 7: + localContext = new CaseFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 7424; + this.match(MySqlParser.KW_CASE); + this.state = 7426; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 7425; + this.caseFuncAlternative(); + } + } + this.state = 7428; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 191); + this.state = 7432; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 7430; + this.match(MySqlParser.KW_ELSE); + this.state = 7431; + localContext._elseArg = this.functionArg(); + } + } + this.state = 7434; + this.match(MySqlParser.KW_END); + } + break; + case 8: + localContext = new CaseExpressionFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 7436; + this.match(MySqlParser.KW_CASE); + this.state = 7437; + this.expression(0); + this.state = 7439; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 7438; + this.caseFuncAlternative(); + } + } + this.state = 7441; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 191); + this.state = 7445; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 7443; + this.match(MySqlParser.KW_ELSE); + this.state = 7444; + localContext._elseArg = this.functionArg(); + } + } + this.state = 7447; + this.match(MySqlParser.KW_END); + } + break; + case 9: + localContext = new CharFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 7449; + this.match(MySqlParser.KW_CHAR); + this.state = 7450; + this.match(MySqlParser.LR_BRACKET); + this.state = 7451; + this.functionArgs(); + this.state = 7454; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 7452; + this.match(MySqlParser.KW_USING); + this.state = 7453; + this.charsetName(); + } + } + this.state = 7456; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 10: + localContext = new PositionFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 7458; + this.match(MySqlParser.KW_POSITION); + this.state = 7459; + this.match(MySqlParser.LR_BRACKET); + this.state = 7462; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1085, this.context)) { + case 1: + { + this.state = 7460; + localContext._positionString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7461; + localContext._positionExpression = this.expression(0); + } + break; + } + this.state = 7464; + this.match(MySqlParser.KW_IN); + this.state = 7467; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1086, this.context)) { + case 1: + { + this.state = 7465; + localContext._inString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7466; + localContext._inExpression = this.expression(0); + } + break; + } + this.state = 7469; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 11: + localContext = new SubstrFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 7471; + _la = this.tokenStream.LA(1); + if (!(_la === 297 || _la === 298)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7472; + this.match(MySqlParser.LR_BRACKET); + this.state = 7475; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1087, this.context)) { + case 1: + { + this.state = 7473; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7474; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7477; + this.match(MySqlParser.KW_FROM); + this.state = 7480; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1088, this.context)) { + case 1: + { + this.state = 7478; + localContext._fromDecimal = this.decimalLiteral(); + } + break; + case 2: + { + this.state = 7479; + localContext._fromExpression = this.expression(0); + } + break; + } + this.state = 7487; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 7482; + this.match(MySqlParser.KW_FOR); + this.state = 7485; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1089, this.context)) { + case 1: + { + this.state = 7483; + localContext._forDecimal = this.decimalLiteral(); + } + break; + case 2: + { + this.state = 7484; + localContext._forExpression = this.expression(0); + } + break; + } + } + } + this.state = 7489; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 12: + localContext = new TrimFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 7491; + this.match(MySqlParser.KW_TRIM); + this.state = 7492; + this.match(MySqlParser.LR_BRACKET); + this.state = 7493; + localContext._positioinForm = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 18 || _la === 96 || _la === 177)) { + localContext._positioinForm = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7496; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1091, this.context)) { + case 1: + { + this.state = 7494; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7495; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7498; + this.match(MySqlParser.KW_FROM); + this.state = 7501; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1092, this.context)) { + case 1: + { + this.state = 7499; + localContext._fromString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7500; + localContext._fromExpression = this.expression(0); + } + break; + } + this.state = 7503; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 13: + localContext = new TrimFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 7505; + this.match(MySqlParser.KW_TRIM); + this.state = 7506; + this.match(MySqlParser.LR_BRACKET); + this.state = 7509; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1093, this.context)) { + case 1: + { + this.state = 7507; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7508; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7511; + this.match(MySqlParser.KW_FROM); + this.state = 7514; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1094, this.context)) { + case 1: + { + this.state = 7512; + localContext._fromString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7513; + localContext._fromExpression = this.expression(0); + } + break; + } + this.state = 7516; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 14: + localContext = new WeightFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 7518; + this.match(MySqlParser.KW_WEIGHT_STRING); + this.state = 7519; + this.match(MySqlParser.LR_BRACKET); + this.state = 7522; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1095, this.context)) { + case 1: + { + this.state = 7520; + this.stringLiteral(); + } + break; + case 2: + { + this.state = 7521; + this.expression(0); + } + break; + } + this.state = 7530; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 7524; + this.match(MySqlParser.KW_AS); + this.state = 7525; + localContext._stringFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 224 || _la === 228)) { + localContext._stringFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7526; + this.match(MySqlParser.LR_BRACKET); + this.state = 7527; + this.decimalLiteral(); + this.state = 7528; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 7533; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 448) { + { + this.state = 7532; + this.levelsInWeightString(); + } + } + this.state = 7535; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 15: + localContext = new ExtractFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 7537; + this.match(MySqlParser.KW_EXTRACT); + this.state = 7538; + this.match(MySqlParser.LR_BRACKET); + this.state = 7539; + this.intervalType(); + this.state = 7540; + this.match(MySqlParser.KW_FROM); + this.state = 7543; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1098, this.context)) { + case 1: + { + this.state = 7541; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7542; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7545; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 16: + localContext = new GetFormatFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 7547; + this.match(MySqlParser.KW_GET_FORMAT); + this.state = 7548; + this.match(MySqlParser.LR_BRACKET); + this.state = 7549; + localContext._datetimeFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 11) !== 0))) { + localContext._datetimeFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7550; + this.match(MySqlParser.COMMA); + this.state = 7551; + this.stringLiteral(); + this.state = 7552; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 17: + localContext = new JsonValueFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 7554; + this.match(MySqlParser.KW_JSON_VALUE); + this.state = 7555; + this.match(MySqlParser.LR_BRACKET); + this.state = 7556; + this.expression(0); + this.state = 7557; + this.match(MySqlParser.COMMA); + this.state = 7558; + this.expression(0); + this.state = 7561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 579) { + { + this.state = 7559; + this.match(MySqlParser.KW_RETURNING); + this.state = 7560; + this.convertedDataType(); + } + } + this.state = 7564; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1100, this.context)) { + case 1: + { + this.state = 7563; + this.jsonOnEmpty(); + } + break; + } + this.state = 7567; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42 || _la === 116 || _la === 382) { + { + this.state = 7566; + this.jsonOnError(); + } + } + this.state = 7569; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + caseFuncAlternative() { + let localContext = new CaseFuncAlternativeContext(this.context, this.state); + this.enterRule(localContext, 764, MySqlParser.RULE_caseFuncAlternative); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7573; + this.match(MySqlParser.KW_WHEN); + this.state = 7574; + localContext._condition = this.functionArg(); + this.state = 7575; + this.match(MySqlParser.KW_THEN); + this.state = 7576; + localContext._consequent = this.functionArg(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + levelsInWeightString() { + let localContext = new LevelsInWeightStringContext(this.context, this.state); + this.enterRule(localContext, 766, MySqlParser.RULE_levelsInWeightString); + let _la; + try { + this.state = 7592; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1104, this.context)) { + case 1: + localContext = new LevelWeightListContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7578; + this.match(MySqlParser.KW_LEVEL); + this.state = 7579; + this.levelInWeightListElement(); + this.state = 7584; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7580; + this.match(MySqlParser.COMMA); + this.state = 7581; + this.levelInWeightListElement(); + } + } + this.state = 7586; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + localContext = new LevelWeightRangeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7587; + this.match(MySqlParser.KW_LEVEL); + this.state = 7588; + localContext._firstLevel = this.decimalLiteral(); + this.state = 7589; + this.match(MySqlParser.MINUS); + this.state = 7590; + localContext._lastLevel = this.decimalLiteral(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + levelInWeightListElement() { + let localContext = new LevelInWeightListElementContext(this.context, this.state); + this.enterRule(localContext, 768, MySqlParser.RULE_levelInWeightListElement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7594; + this.decimalLiteral(); + this.state = 7596; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 14 || _la === 45 || _la === 830) { + { + this.state = 7595; + localContext._orderType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45 || _la === 830)) { + localContext._orderType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + aggregateWindowedFunction() { + let localContext = new AggregateWindowedFunctionContext(this.context, this.state); + this.enterRule(localContext, 770, MySqlParser.RULE_aggregateWindowedFunction); + let _la; + try { + this.state = 7657; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AVG: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_SUM: + this.enterOuterAlt(localContext, 1); + { + this.state = 7598; + _la = this.tokenStream.LA(1); + if (!(((((_la - 258)) & ~0x1F) === 0 && ((1 << (_la - 258)) & 8400897) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7599; + this.match(MySqlParser.LR_BRACKET); + this.state = 7601; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1106, this.context)) { + case 1: + { + this.state = 7600; + localContext._aggregator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._aggregator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 7603; + this.functionArg(); + this.state = 7604; + this.match(MySqlParser.RR_BRACKET); + this.state = 7606; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1107, this.context)) { + case 1: + { + this.state = 7605; + this.overClause(); + } + break; + } + } + break; + case MySqlParser.KW_COUNT: + this.enterOuterAlt(localContext, 2); + { + this.state = 7608; + this.match(MySqlParser.KW_COUNT); + this.state = 7609; + this.match(MySqlParser.LR_BRACKET); + this.state = 7617; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1109, this.context)) { + case 1: + { + this.state = 7610; + localContext._starArg = this.match(MySqlParser.STAR); + } + break; + case 2: + { + this.state = 7612; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1108, this.context)) { + case 1: + { + this.state = 7611; + localContext._aggregator = this.match(MySqlParser.KW_ALL); + } + break; + } + this.state = 7614; + this.functionArg(); + } + break; + case 3: + { + this.state = 7615; + localContext._aggregator = this.match(MySqlParser.KW_DISTINCT); + this.state = 7616; + this.functionArgs(); + } + break; + } + this.state = 7619; + this.match(MySqlParser.RR_BRACKET); + this.state = 7621; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1110, this.context)) { + case 1: + { + this.state = 7620; + this.overClause(); + } + break; + } + } + break; + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + this.enterOuterAlt(localContext, 3); + { + this.state = 7623; + _la = this.tokenStream.LA(1); + if (!(((((_la - 259)) & ~0x1F) === 0 && ((1 << (_la - 259)) & 62652423) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7624; + this.match(MySqlParser.LR_BRACKET); + this.state = 7626; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1111, this.context)) { + case 1: + { + this.state = 7625; + localContext._aggregator = this.match(MySqlParser.KW_ALL); + } + break; + } + this.state = 7628; + this.functionArg(); + this.state = 7629; + this.match(MySqlParser.RR_BRACKET); + this.state = 7631; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1112, this.context)) { + case 1: + { + this.state = 7630; + this.overClause(); + } + break; + } + } + break; + case MySqlParser.KW_GROUP_CONCAT: + this.enterOuterAlt(localContext, 4); + { + this.state = 7633; + this.match(MySqlParser.KW_GROUP_CONCAT); + this.state = 7634; + this.match(MySqlParser.LR_BRACKET); + this.state = 7636; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1113, this.context)) { + case 1: + { + this.state = 7635; + localContext._aggregator = this.match(MySqlParser.KW_DISTINCT); + } + break; + } + this.state = 7638; + this.functionArgs(); + this.state = 7649; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 7639; + this.match(MySqlParser.KW_ORDER); + this.state = 7640; + this.match(MySqlParser.KW_BY); + this.state = 7641; + this.orderByExpression(); + this.state = 7646; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7642; + this.match(MySqlParser.COMMA); + this.state = 7643; + this.orderByExpression(); + } + } + this.state = 7648; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 7653; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 156) { + { + this.state = 7651; + this.match(MySqlParser.KW_SEPARATOR); + this.state = 7652; + localContext._separator = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 7655; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + nonAggregateWindowedFunction() { + let localContext = new NonAggregateWindowedFunctionContext(this.context, this.state); + this.enterRule(localContext, 772, MySqlParser.RULE_nonAggregateWindowedFunction); + let _la; + try { + this.state = 7697; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_LAG: + case MySqlParser.KW_LEAD: + this.enterOuterAlt(localContext, 1); + { + this.state = 7659; + _la = this.tokenStream.LA(1); + if (!(_la === 267 || _la === 269)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7660; + this.match(MySqlParser.LR_BRACKET); + this.state = 7661; + this.expression(0); + this.state = 7664; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1118, this.context)) { + case 1: + { + this.state = 7662; + this.match(MySqlParser.COMMA); + this.state = 7663; + this.decimalLiteral(); + } + break; + } + this.state = 7668; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 7666; + this.match(MySqlParser.COMMA); + this.state = 7667; + this.decimalLiteral(); + } + } + this.state = 7670; + this.match(MySqlParser.RR_BRACKET); + this.state = 7671; + this.overClause(); + } + break; + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_LAST_VALUE: + this.enterOuterAlt(localContext, 2); + { + this.state = 7673; + _la = this.tokenStream.LA(1); + if (!(_la === 265 || _la === 268)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7674; + this.match(MySqlParser.LR_BRACKET); + this.state = 7675; + this.expression(0); + this.state = 7676; + this.match(MySqlParser.RR_BRACKET); + this.state = 7677; + this.overClause(); + } + break; + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + this.enterOuterAlt(localContext, 3); + { + this.state = 7679; + _la = this.tokenStream.LA(1); + if (!(((((_la - 263)) & ~0x1F) === 0 && ((1 << (_la - 263)) & 14339) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7680; + this.match(MySqlParser.LR_BRACKET); + this.state = 7681; + this.match(MySqlParser.RR_BRACKET); + this.state = 7682; + this.overClause(); + } + break; + case MySqlParser.KW_NTH_VALUE: + this.enterOuterAlt(localContext, 4); + { + this.state = 7683; + this.match(MySqlParser.KW_NTH_VALUE); + this.state = 7684; + this.match(MySqlParser.LR_BRACKET); + this.state = 7685; + this.expression(0); + this.state = 7686; + this.match(MySqlParser.COMMA); + this.state = 7687; + this.decimalLiteral(); + this.state = 7688; + this.match(MySqlParser.RR_BRACKET); + this.state = 7689; + this.overClause(); + } + break; + case MySqlParser.KW_NTILE: + this.enterOuterAlt(localContext, 5); + { + this.state = 7691; + this.match(MySqlParser.KW_NTILE); + this.state = 7692; + this.match(MySqlParser.LR_BRACKET); + this.state = 7693; + this.decimalLiteral(); + this.state = 7694; + this.match(MySqlParser.RR_BRACKET); + this.state = 7695; + this.overClause(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + overClause() { + let localContext = new OverClauseContext(this.context, this.state); + this.enterRule(localContext, 774, MySqlParser.RULE_overClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7699; + this.match(MySqlParser.KW_OVER); + this.state = 7705; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LR_BRACKET: + { + this.state = 7700; + this.match(MySqlParser.LR_BRACKET); + this.state = 7701; + this.windowSpec(); + this.state = 7702; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 7704; + this.windowName(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + windowSpec() { + let localContext = new WindowSpecContext(this.context, this.state); + this.enterRule(localContext, 776, MySqlParser.RULE_windowSpec); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7708; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1122, this.context)) { + case 1: + { + this.state = 7707; + this.windowName(); + } + break; + } + this.state = 7711; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 7710; + this.partitionClause(); + } + } + this.state = 7714; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 7713; + this.orderByClause(); + } + } + this.state = 7717; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 134 || _la === 587) { + { + this.state = 7716; + this.frameClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + windowName() { + let localContext = new WindowNameContext(this.context, this.state); + this.enterRule(localContext, 778, MySqlParser.RULE_windowName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7719; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameClause() { + let localContext = new FrameClauseContext(this.context, this.state); + this.enterRule(localContext, 780, MySqlParser.RULE_frameClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7721; + this.frameUnits(); + this.state = 7722; + this.frameExtent(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameUnits() { + let localContext = new FrameUnitsContext(this.context, this.state); + this.enterRule(localContext, 782, MySqlParser.RULE_frameUnits); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7724; + _la = this.tokenStream.LA(1); + if (!(_la === 134 || _la === 587)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameExtent() { + let localContext = new FrameExtentContext(this.context, this.state); + this.enterRule(localContext, 784, MySqlParser.RULE_frameExtent); + try { + this.state = 7728; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1126, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7726; + this.frameRange(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7727; + this.frameBetween(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameBetween() { + let localContext = new FrameBetweenContext(this.context, this.state); + this.enterRule(localContext, 786, MySqlParser.RULE_frameBetween); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7730; + this.match(MySqlParser.KW_BETWEEN); + this.state = 7731; + this.frameRange(); + this.state = 7732; + this.match(MySqlParser.KW_AND); + this.state = 7733; + this.frameRange(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameRange() { + let localContext = new FrameRangeContext(this.context, this.state); + this.enterRule(localContext, 788, MySqlParser.RULE_frameRange); + let _la; + try { + this.state = 7742; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1127, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7735; + this.match(MySqlParser.KW_CURRENT); + this.state = 7736; + this.match(MySqlParser.KW_ROW); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7737; + this.match(MySqlParser.KW_UNBOUNDED); + this.state = 7738; + _la = this.tokenStream.LA(1); + if (!(_la === 405 || _la === 539)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7739; + this.expression(0); + this.state = 7740; + _la = this.tokenStream.LA(1); + if (!(_la === 405 || _la === 539)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionClause() { + let localContext = new PartitionClauseContext(this.context, this.state); + this.enterRule(localContext, 790, MySqlParser.RULE_partitionClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7744; + this.match(MySqlParser.KW_PARTITION); + this.state = 7745; + this.match(MySqlParser.KW_BY); + this.state = 7746; + this.expression(0); + this.state = 7751; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7747; + this.match(MySqlParser.COMMA); + this.state = 7748; + this.expression(0); + } + } + this.state = 7753; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + scalarFunctionName() { + let localContext = new ScalarFunctionNameContext(this.context, this.state); + this.enterRule(localContext, 792, MySqlParser.RULE_scalarFunctionName); + try { + this.state = 7778; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + this.enterOuterAlt(localContext, 1); + { + this.state = 7754; + this.functionNameBase(); + } + break; + case MySqlParser.KW_ASCII: + this.enterOuterAlt(localContext, 2); + { + this.state = 7755; + this.match(MySqlParser.KW_ASCII); + } + break; + case MySqlParser.KW_CURDATE: + this.enterOuterAlt(localContext, 3); + { + this.state = 7756; + this.match(MySqlParser.KW_CURDATE); + } + break; + case MySqlParser.KW_CURRENT_DATE: + this.enterOuterAlt(localContext, 4); + { + this.state = 7757; + this.match(MySqlParser.KW_CURRENT_DATE); + } + break; + case MySqlParser.KW_CURRENT_TIME: + this.enterOuterAlt(localContext, 5); + { + this.state = 7758; + this.match(MySqlParser.KW_CURRENT_TIME); + } + break; + case MySqlParser.KW_CURRENT_TIMESTAMP: + this.enterOuterAlt(localContext, 6); + { + this.state = 7759; + this.match(MySqlParser.KW_CURRENT_TIMESTAMP); + } + break; + case MySqlParser.KW_CURTIME: + this.enterOuterAlt(localContext, 7); + { + this.state = 7760; + this.match(MySqlParser.KW_CURTIME); + } + break; + case MySqlParser.KW_DATE_ADD: + this.enterOuterAlt(localContext, 8); + { + this.state = 7761; + this.match(MySqlParser.KW_DATE_ADD); + } + break; + case MySqlParser.KW_DATE_SUB: + this.enterOuterAlt(localContext, 9); + { + this.state = 7762; + this.match(MySqlParser.KW_DATE_SUB); + } + break; + case MySqlParser.KW_IF: + this.enterOuterAlt(localContext, 10); + { + this.state = 7763; + this.match(MySqlParser.KW_IF); + } + break; + case MySqlParser.KW_INSERT: + this.enterOuterAlt(localContext, 11); + { + this.state = 7764; + this.match(MySqlParser.KW_INSERT); + } + break; + case MySqlParser.KW_LOCALTIME: + this.enterOuterAlt(localContext, 12); + { + this.state = 7765; + this.match(MySqlParser.KW_LOCALTIME); + } + break; + case MySqlParser.KW_LOCALTIMESTAMP: + this.enterOuterAlt(localContext, 13); + { + this.state = 7766; + this.match(MySqlParser.KW_LOCALTIMESTAMP); + } + break; + case MySqlParser.KW_MID: + this.enterOuterAlt(localContext, 14); + { + this.state = 7767; + this.match(MySqlParser.KW_MID); + } + break; + case MySqlParser.KW_NOW: + this.enterOuterAlt(localContext, 15); + { + this.state = 7768; + this.match(MySqlParser.KW_NOW); + } + break; + case MySqlParser.KW_REPEAT: + this.enterOuterAlt(localContext, 16); + { + this.state = 7769; + this.match(MySqlParser.KW_REPEAT); + } + break; + case MySqlParser.KW_REPLACE: + this.enterOuterAlt(localContext, 17); + { + this.state = 7770; + this.match(MySqlParser.KW_REPLACE); + } + break; + case MySqlParser.KW_SUBSTR: + this.enterOuterAlt(localContext, 18); + { + this.state = 7771; + this.match(MySqlParser.KW_SUBSTR); + } + break; + case MySqlParser.KW_SUBSTRING: + this.enterOuterAlt(localContext, 19); + { + this.state = 7772; + this.match(MySqlParser.KW_SUBSTRING); + } + break; + case MySqlParser.KW_SYSDATE: + this.enterOuterAlt(localContext, 20); + { + this.state = 7773; + this.match(MySqlParser.KW_SYSDATE); + } + break; + case MySqlParser.KW_TRIM: + this.enterOuterAlt(localContext, 21); + { + this.state = 7774; + this.match(MySqlParser.KW_TRIM); + } + break; + case MySqlParser.KW_UTC_DATE: + this.enterOuterAlt(localContext, 22); + { + this.state = 7775; + this.match(MySqlParser.KW_UTC_DATE); + } + break; + case MySqlParser.KW_UTC_TIME: + this.enterOuterAlt(localContext, 23); + { + this.state = 7776; + this.match(MySqlParser.KW_UTC_TIME); + } + break; + case MySqlParser.KW_UTC_TIMESTAMP: + this.enterOuterAlt(localContext, 24); + { + this.state = 7777; + this.match(MySqlParser.KW_UTC_TIMESTAMP); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + passwordFunctionClause() { + let localContext = new PasswordFunctionClauseContext(this.context, this.state); + this.enterRule(localContext, 794, MySqlParser.RULE_passwordFunctionClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7780; + _la = this.tokenStream.LA(1); + if (!(_la === 512 || _la === 529)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7781; + this.match(MySqlParser.LR_BRACKET); + this.state = 7782; + this.functionArg(); + this.state = 7783; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionArgs() { + let localContext = new FunctionArgsContext(this.context, this.state); + this.enterRule(localContext, 796, MySqlParser.RULE_functionArgs); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7785; + this.functionArg(); + this.state = 7790; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7786; + this.match(MySqlParser.COMMA); + this.state = 7787; + this.functionArg(); + } + } + this.state = 7792; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionArg() { + let localContext = new FunctionArgContext(this.context, this.state); + this.enterRule(localContext, 798, MySqlParser.RULE_functionArg); + try { + this.state = 7796; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1131, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7793; + this.constant(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7794; + this.functionCall(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7795; + this.expression(0); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expression(_p) { + if (_p === undefined) { + _p = 0; + } + let parentContext = this.context; + let parentState = this.state; + let localContext = new ExpressionContext(this.context, parentState); + let previousContext = localContext; + let _startState = 800; + this.enterRecursionRule(localContext, 800, MySqlParser.RULE_expression, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 7809; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1133, this.context)) { + case 1: + { + localContext = new NotExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7799; + localContext._notOperator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 114 || _la === 860)) { + localContext._notOperator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7800; + this.expression(4); + } + break; + case 2: + { + localContext = new IsExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7801; + this.predicate(0); + this.state = 7802; + this.match(MySqlParser.KW_IS); + this.state = 7804; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7803; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7806; + localContext._testValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 63 || _la === 179 || _la === 674)) { + localContext._testValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 3: + { + localContext = new PredicateExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7808; + this.predicate(0); + } + break; + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 7817; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1134, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + { + localContext = new LogicalExpressionContext(new ExpressionContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expression); + this.state = 7811; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 7812; + this.logicalOperator(); + this.state = 7813; + this.expression(4); + } + } + } + this.state = 7819; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1134, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + predicate(_p) { + if (_p === undefined) { + _p = 0; + } + let parentContext = this.context; + let parentState = this.state; + let localContext = new PredicateContext(this.context, parentState); + let previousContext = localContext; + let _startState = 802; + this.enterRecursionRule(localContext, 802, MySqlParser.RULE_predicate, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + { + localContext = new ExpressionAtomPredicateContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7821; + this.expressionAtom(0); + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 7886; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1143, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 7884; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1142, this.context)) { + case 1: + { + localContext = new BetweenPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7823; + if (!(this.precpred(this.context, 6))) { + throw this.createFailedPredicateException("this.precpred(this.context, 6)"); + } + this.state = 7825; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7824; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7827; + this.match(MySqlParser.KW_BETWEEN); + this.state = 7828; + this.predicate(0); + this.state = 7829; + this.match(MySqlParser.KW_AND); + this.state = 7830; + this.predicate(7); + } + break; + case 2: + { + localContext = new SoundsLikePredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7832; + if (!(this.precpred(this.context, 5))) { + throw this.createFailedPredicateException("this.precpred(this.context, 5)"); + } + this.state = 7833; + this.match(MySqlParser.KW_SOUNDS); + this.state = 7834; + this.match(MySqlParser.KW_LIKE); + this.state = 7835; + this.predicate(6); + } + break; + case 3: + { + localContext = new RegexpPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7836; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 7838; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7837; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7840; + localContext._regex = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 139 || _la === 151)) { + localContext._regex = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7841; + this.predicate(4); + } + break; + case 4: + { + localContext = new InPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7842; + if (!(this.precpred(this.context, 9))) { + throw this.createFailedPredicateException("this.precpred(this.context, 9)"); + } + this.state = 7844; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7843; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7846; + this.match(MySqlParser.KW_IN); + this.state = 7847; + this.match(MySqlParser.LR_BRACKET); + this.state = 7850; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1138, this.context)) { + case 1: + { + this.state = 7848; + this.selectStatement(); + } + break; + case 2: + { + this.state = 7849; + this.expressions(); + } + break; + } + this.state = 7852; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 5: + { + localContext = new IsNullPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7854; + if (!(this.precpred(this.context, 8))) { + throw this.createFailedPredicateException("this.precpred(this.context, 8)"); + } + this.state = 7855; + this.match(MySqlParser.KW_IS); + this.state = 7856; + this.nullNotnull(); + } + break; + case 6: + { + localContext = new BinaryComparisonPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7857; + if (!(this.precpred(this.context, 7))) { + throw this.createFailedPredicateException("this.precpred(this.context, 7)"); + } + this.state = 7858; + this.comparisonOperator(); + this.state = 7865; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1139, this.context)) { + case 1: + { + this.state = 7859; + localContext._quantifier = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 309 || _la === 602)) { + localContext._quantifier = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7860; + this.match(MySqlParser.LR_BRACKET); + this.state = 7861; + localContext._subQuery = this.selectStatement(); + this.state = 7862; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 7864; + localContext._right = this.predicate(0); + } + break; + } + } + break; + case 7: + { + localContext = new LikePredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7867; + if (!(this.precpred(this.context, 4))) { + throw this.createFailedPredicateException("this.precpred(this.context, 4)"); + } + this.state = 7869; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7868; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7871; + this.match(MySqlParser.KW_LIKE); + this.state = 7872; + this.predicate(0); + this.state = 7875; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1141, this.context)) { + case 1: + { + this.state = 7873; + this.match(MySqlParser.KW_ESCAPE); + this.state = 7874; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + } + break; + case 8: + { + localContext = new JsonMemberOfPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7877; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 7878; + this.match(MySqlParser.KW_MEMBER); + this.state = 7879; + this.match(MySqlParser.KW_OF); + this.state = 7880; + this.match(MySqlParser.LR_BRACKET); + this.state = 7881; + this.predicate(0); + this.state = 7882; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + this.state = 7888; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1143, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + expressionAtom(_p) { + if (_p === undefined) { + _p = 0; + } + let parentContext = this.context; + let parentState = this.state; + let localContext = new ExpressionAtomContext(this.context, parentState); + let previousContext = localContext; + let _startState = 804; + this.enterRecursionRule(localContext, 804, MySqlParser.RULE_expressionAtom, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 7937; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1146, this.context)) { + case 1: + { + localContext = new ConstantExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7890; + this.constant(); + } + break; + case 2: + { + localContext = new FunctionCallExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7891; + this.functionCall(); + } + break; + case 3: + { + localContext = new MysqlVariableExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7892; + this.mysqlVariable(); + } + break; + case 4: + { + localContext = new UnaryExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7893; + this.unaryOperator(); + this.state = 7894; + this.expressionAtom(12); + } + break; + case 5: + { + localContext = new BinaryExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7896; + this.match(MySqlParser.KW_BINARY); + this.state = 7897; + this.expressionAtom(11); + } + break; + case 6: + { + localContext = new VariableAssignExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7898; + this.match(MySqlParser.LOCAL_ID); + this.state = 7899; + this.match(MySqlParser.VAR_ASSIGN); + this.state = 7900; + this.expressionAtom(10); + } + break; + case 7: + { + localContext = new NestedExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7901; + this.match(MySqlParser.LR_BRACKET); + this.state = 7902; + this.expression(0); + this.state = 7907; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7903; + this.match(MySqlParser.COMMA); + this.state = 7904; + this.expression(0); + } + } + this.state = 7909; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7910; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 8: + { + localContext = new NestedRowExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7912; + this.match(MySqlParser.KW_ROW); + this.state = 7913; + this.match(MySqlParser.LR_BRACKET); + this.state = 7914; + this.expression(0); + this.state = 7917; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 7915; + this.match(MySqlParser.COMMA); + this.state = 7916; + this.expression(0); + } + } + this.state = 7919; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 868); + this.state = 7921; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 9: + { + localContext = new ExistsExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7923; + this.match(MySqlParser.KW_EXISTS); + this.state = 7924; + this.match(MySqlParser.LR_BRACKET); + this.state = 7925; + this.selectStatement(); + this.state = 7926; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 10: + { + localContext = new SubqueryExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7928; + this.match(MySqlParser.LR_BRACKET); + this.state = 7929; + this.selectStatement(); + this.state = 7930; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 11: + { + localContext = new IntervalExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7932; + this.match(MySqlParser.KW_INTERVAL); + this.state = 7933; + this.expression(0); + this.state = 7934; + this.intervalType(); + } + break; + case 12: + { + localContext = new ColumnNameExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7936; + this.columnName(); + } + break; + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 7956; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1148, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 7954; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1147, this.context)) { + case 1: + { + localContext = new JsonExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + localContext._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7939; + if (!(this.precpred(this.context, 4))) { + throw this.createFailedPredicateException("this.precpred(this.context, 4)"); + } + this.state = 7940; + this.jsonOperator(); + this.state = 7941; + localContext._right = this.expressionAtom(5); + } + break; + case 2: + { + localContext = new BitExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + localContext._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7943; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 7944; + this.bitOperator(); + this.state = 7945; + localContext._right = this.expressionAtom(4); + } + break; + case 3: + { + localContext = new MathExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + localContext._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7947; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 7948; + this.mathOperator(); + this.state = 7949; + localContext._right = this.expressionAtom(3); + } + break; + case 4: + { + localContext = new CollateExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7951; + if (!(this.precpred(this.context, 14))) { + throw this.createFailedPredicateException("this.precpred(this.context, 14)"); + } + this.state = 7952; + this.match(MySqlParser.KW_COLLATE); + this.state = 7953; + this.collationName(); + } + break; + } + } + } + this.state = 7958; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1148, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + unaryOperator() { + let localContext = new UnaryOperatorContext(this.context, this.state); + this.enterRule(localContext, 806, MySqlParser.RULE_unaryOperator); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7959; + _la = this.tokenStream.LA(1); + if (!(_la === 114 || ((((_la - 853)) & ~0x1F) === 0 && ((1 << (_la - 853)) & 387) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + comparisonOperator() { + let localContext = new ComparisonOperatorContext(this.context, this.state); + this.enterRule(localContext, 808, MySqlParser.RULE_comparisonOperator); + try { + this.state = 7969; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1149, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7961; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7962; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7963; + this.match(MySqlParser.EXCLAMATION_SYMBOL); + this.state = 7964; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7965; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7966; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 7967; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7968; + this.comparisonBase(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + comparisonBase() { + let localContext = new ComparisonBaseContext(this.context, this.state); + this.enterRule(localContext, 810, MySqlParser.RULE_comparisonBase); + try { + this.state = 7978; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1150, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7971; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7972; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7973; + this.match(MySqlParser.GREATER_SYMBOL); + this.state = 7974; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7975; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7976; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 7977; + this.match(MySqlParser.LESS_SYMBOL); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + logicalOperator() { + let localContext = new LogicalOperatorContext(this.context, this.state); + this.enterRule(localContext, 812, MySqlParser.RULE_logicalOperator); + try { + this.state = 7987; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AND: + this.enterOuterAlt(localContext, 1); + { + this.state = 7980; + this.match(MySqlParser.KW_AND); + } + break; + case MySqlParser.BIT_AND_OP: + this.enterOuterAlt(localContext, 2); + { + this.state = 7981; + this.match(MySqlParser.BIT_AND_OP); + this.state = 7982; + this.match(MySqlParser.BIT_AND_OP); + } + break; + case MySqlParser.KW_XOR: + this.enterOuterAlt(localContext, 3); + { + this.state = 7983; + this.match(MySqlParser.KW_XOR); + } + break; + case MySqlParser.KW_OR: + this.enterOuterAlt(localContext, 4); + { + this.state = 7984; + this.match(MySqlParser.KW_OR); + } + break; + case MySqlParser.BIT_OR_OP: + this.enterOuterAlt(localContext, 5); + { + this.state = 7985; + this.match(MySqlParser.BIT_OR_OP); + this.state = 7986; + this.match(MySqlParser.BIT_OR_OP); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + bitOperator() { + let localContext = new BitOperatorContext(this.context, this.state); + this.enterRule(localContext, 814, MySqlParser.RULE_bitOperator); + try { + this.state = 7996; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LESS_SYMBOL: + this.enterOuterAlt(localContext, 1); + { + this.state = 7989; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7990; + this.match(MySqlParser.LESS_SYMBOL); + } + break; + case MySqlParser.GREATER_SYMBOL: + this.enterOuterAlt(localContext, 2); + { + this.state = 7991; + this.match(MySqlParser.GREATER_SYMBOL); + this.state = 7992; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case MySqlParser.BIT_AND_OP: + this.enterOuterAlt(localContext, 3); + { + this.state = 7993; + this.match(MySqlParser.BIT_AND_OP); + } + break; + case MySqlParser.BIT_XOR_OP: + this.enterOuterAlt(localContext, 4); + { + this.state = 7994; + this.match(MySqlParser.BIT_XOR_OP); + } + break; + case MySqlParser.BIT_OR_OP: + this.enterOuterAlt(localContext, 5); + { + this.state = 7995; + this.match(MySqlParser.BIT_OR_OP); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + mathOperator() { + let localContext = new MathOperatorContext(this.context, this.state); + this.enterRule(localContext, 816, MySqlParser.RULE_mathOperator); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7998; + _la = this.tokenStream.LA(1); + if (!(((((_la - 850)) & ~0x1F) === 0 && ((1 << (_la - 850)) & 127) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonOperator() { + let localContext = new JsonOperatorContext(this.context, this.state); + this.enterRule(localContext, 818, MySqlParser.RULE_jsonOperator); + try { + this.state = 8005; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1153, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 8000; + this.match(MySqlParser.MINUS); + this.state = 8001; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 8002; + this.match(MySqlParser.MINUS); + this.state = 8003; + this.match(MySqlParser.GREATER_SYMBOL); + this.state = 8004; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + charsetNameBase() { + let localContext = new CharsetNameBaseContext(this.context, this.state); + this.enterRule(localContext, 820, MySqlParser.RULE_charsetNameBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8007; + _la = this.tokenStream.LA(1); + if (!(_la === 228 || ((((_la - 756)) & ~0x1F) === 0 && ((1 << (_la - 756)) & 4294967295) !== 0) || ((((_la - 788)) & ~0x1F) === 0 && ((1 << (_la - 788)) & 511) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionLevelBase() { + let localContext = new TransactionLevelBaseContext(this.context, this.state); + this.enterRule(localContext, 822, MySqlParser.RULE_transactionLevelBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8009; + _la = this.tokenStream.LA(1); + if (!(((((_la - 809)) & ~0x1F) === 0 && ((1 << (_la - 809)) & 15) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilegesBase() { + let localContext = new PrivilegesBaseContext(this.context, this.state); + this.enterRule(localContext, 824, MySqlParser.RULE_privilegesBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8011; + _la = this.tokenStream.LA(1); + if (!(((((_la - 717)) & ~0x1F) === 0 && ((1 << (_la - 717)) & 68026371) !== 0) || ((((_la - 749)) & ~0x1F) === 0 && ((1 << (_la - 749)) & 11) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intervalTypeBase() { + let localContext = new IntervalTypeBaseContext(this.context, this.state); + this.enterRule(localContext, 826, MySqlParser.RULE_intervalTypeBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8013; + _la = this.tokenStream.LA(1); + if (!(((((_la - 696)) & ~0x1F) === 0 && ((1 << (_la - 696)) & 255) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dataTypeBase() { + let localContext = new DataTypeBaseContext(this.context, this.state); + this.enterRule(localContext, 828, MySqlParser.RULE_dataTypeBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8015; + _la = this.tokenStream.LA(1); + if (!(((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 1179679) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + keywordsCanBeId() { + let localContext = new KeywordsCanBeIdContext(this.context, this.state); + this.enterRule(localContext, 830, MySqlParser.RULE_keywordsCanBeId); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8017; + _la = this.tokenStream.LA(1); + if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014211) !== 0) || _la === 74 || _la === 95 || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 16673) !== 0) || _la === 160 || _la === 170 || ((((_la - 241)) & ~0x1F) === 0 && ((1 << (_la - 241)) & 1648345089) !== 0) || ((((_la - 277)) & ~0x1F) === 0 && ((1 << (_la - 277)) & 4160749823) !== 0) || ((((_la - 309)) & ~0x1F) === 0 && ((1 << (_la - 309)) & 4292870141) !== 0) || ((((_la - 341)) & ~0x1F) === 0 && ((1 << (_la - 341)) & 4294967287) !== 0) || ((((_la - 373)) & ~0x1F) === 0 && ((1 << (_la - 373)) & 4024434671) !== 0) || ((((_la - 406)) & ~0x1F) === 0 && ((1 << (_la - 406)) & 3747609503) !== 0) || ((((_la - 438)) & ~0x1F) === 0 && ((1 << (_la - 438)) & 4227727359) !== 0) || ((((_la - 470)) & ~0x1F) === 0 && ((1 << (_la - 470)) & 3758096239) !== 0) || ((((_la - 502)) & ~0x1F) === 0 && ((1 << (_la - 502)) & 2678062559) !== 0) || ((((_la - 534)) & ~0x1F) === 0 && ((1 << (_la - 534)) & 2682256863) !== 0) || ((((_la - 566)) & ~0x1F) === 0 && ((1 << (_la - 566)) & 4294957695) !== 0) || ((((_la - 598)) & ~0x1F) === 0 && ((1 << (_la - 598)) & 255) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 2128608253) !== 0) || ((((_la - 704)) & ~0x1F) === 0 && ((1 << (_la - 704)) & 1053007341) !== 0) || ((((_la - 737)) & ~0x1F) === 0 && ((1 << (_la - 737)) & 478907) !== 0) || ((((_la - 802)) & ~0x1F) === 0 && ((1 << (_la - 802)) & 3230662657) !== 0) || _la === 838)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionNameBase() { + let localContext = new FunctionNameBaseContext(this.context, this.state); + this.enterRule(localContext, 832, MySqlParser.RULE_functionNameBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8019; + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 98 || _la === 150 || _la === 152 || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 23) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 16375299) !== 0) || _la === 296 || _la === 435 || ((((_la - 686)) & ~0x1F) === 0 && ((1 << (_la - 686)) & 261121) !== 0) || _la === 746 || ((((_la - 813)) & ~0x1F) === 0 && ((1 << (_la - 813)) & 145190393) !== 0) || _la === 856)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + sempred(localContext, ruleIndex, predIndex) { + switch (ruleIndex) { + case 104: + return this.queryExpressionBody_sempred(localContext, predIndex); + case 105: + return this.queryItem_sempred(localContext, predIndex); + case 329: + return this.columnName_sempred(localContext, predIndex); + case 400: + return this.expression_sempred(localContext, predIndex); + case 401: + return this.predicate_sempred(localContext, predIndex); + case 402: + return this.expressionAtom_sempred(localContext, predIndex); + } + return true; + } + queryExpressionBody_sempred(localContext, predIndex) { + switch (predIndex) { + case 0: + return this.precpred(this.context, 2); + case 1: + return this.precpred(this.context, 1); + } + return true; + } + queryItem_sempred(localContext, predIndex) { + switch (predIndex) { + case 2: + return this.precpred(this.context, 1); + } + return true; + } + columnName_sempred(localContext, predIndex) { + switch (predIndex) { + case 3: + return this.shouldMatchEmpty(); + } + return true; + } + expression_sempred(localContext, predIndex) { + switch (predIndex) { + case 4: + return this.precpred(this.context, 3); + } + return true; + } + predicate_sempred(localContext, predIndex) { + switch (predIndex) { + case 5: + return this.precpred(this.context, 6); + case 6: + return this.precpred(this.context, 5); + case 7: + return this.precpred(this.context, 3); + case 8: + return this.precpred(this.context, 9); + case 9: + return this.precpred(this.context, 8); + case 10: + return this.precpred(this.context, 7); + case 11: + return this.precpred(this.context, 4); + case 12: + return this.precpred(this.context, 2); + } + return true; + } + expressionAtom_sempred(localContext, predIndex) { + switch (predIndex) { + case 13: + return this.precpred(this.context, 4); + case 14: + return this.precpred(this.context, 3); + case 15: + return this.precpred(this.context, 2); + case 16: + return this.precpred(this.context, 14); + } + return true; + } + static get _ATN() { + if (!MySqlParser.__ATN) { + MySqlParser.__ATN = new antlr.ATNDeserializer().deserialize(MySqlParser._serializedATN); + } + return MySqlParser.__ATN; + } + get vocabulary() { + return MySqlParser.vocabulary; + } +} + +export { MySqlParser }; \ No newline at end of file From 9a287d1bde2ba84be3cfacc6dddcb96858acff70 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 6 Dec 2024 11:25:29 +0100 Subject: [PATCH 05/32] update linting --- src/ast/nodes/MemberExpression.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index 20ea90685cd..91e694e2518 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -108,7 +108,7 @@ export default class MemberExpression declare protected assignmentInteraction: NodeInteractionAssigned; declare private accessInteraction: NodeInteractionAccessed; private expressionsToBeDeoptimized: DeoptimizableEntity[] = []; - private declare dynamicPropertyKey: ObjectPathKey | null; + declare private dynamicPropertyKey: ObjectPathKey | null; get computed(): boolean { return isFlagSet(this.flags, Flag.computed); From eb2993494f2fe5ad6a6a5a675bc2532238932830 Mon Sep 17 00:00:00 2001 From: TrickyPi <530257315@qq.com> Date: Sun, 8 Dec 2024 13:58:56 +0800 Subject: [PATCH 06/32] reduce the count of includePath for ClassBody --- src/ast/nodes/ClassBody.ts | 1 + .../object-tree-shaking-issue-5734/_config.js | 3 + .../_expected.js | 45571 ++++++++++++++++ .../object-tree-shaking-issue-5734/main.js | 1 + .../object-tree-shaking-issue-5734/module.js | 0 .../object-tree-shaking-issue-5734/_config.js | 4 - .../object-tree-shaking-issue-5734/main.js | 2 - 7 files changed, 45576 insertions(+), 6 deletions(-) create mode 100644 test/form/samples/object-tree-shaking-issue-5734/_config.js create mode 100644 test/form/samples/object-tree-shaking-issue-5734/_expected.js create mode 100644 test/form/samples/object-tree-shaking-issue-5734/main.js rename test/{function => form}/samples/object-tree-shaking-issue-5734/module.js (100%) delete mode 100644 test/function/samples/object-tree-shaking-issue-5734/_config.js delete mode 100644 test/function/samples/object-tree-shaking-issue-5734/main.js diff --git a/src/ast/nodes/ClassBody.ts b/src/ast/nodes/ClassBody.ts index 53590a4d4cb..ee9c85e04a0 100644 --- a/src/ast/nodes/ClassBody.ts +++ b/src/ast/nodes/ClassBody.ts @@ -24,6 +24,7 @@ export default class ClassBody extends NodeBase { context: InclusionContext, includeChildrenRecursively: IncludeChildren ): void { + if (this.included) return; this.included = true; this.scope.context.includeVariableInModule(this.scope.thisVariable, UNKNOWN_PATH); for (const definition of this.body) { diff --git a/test/form/samples/object-tree-shaking-issue-5734/_config.js b/test/form/samples/object-tree-shaking-issue-5734/_config.js new file mode 100644 index 00000000000..c6e2b401e07 --- /dev/null +++ b/test/form/samples/object-tree-shaking-issue-5734/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'do not throw error Maximum call stack size exceeded' +}); diff --git a/test/form/samples/object-tree-shaking-issue-5734/_expected.js b/test/form/samples/object-tree-shaking-issue-5734/_expected.js new file mode 100644 index 00000000000..48fb9b81a4a --- /dev/null +++ b/test/form/samples/object-tree-shaking-issue-5734/_expected.js @@ -0,0 +1,45571 @@ +class MySqlParser extends SQLParserBase { + get grammarFileName() { return "MySqlParser.g4"; } + get literalNames() { return MySqlParser.literalNames; } + get symbolicNames() { return MySqlParser.symbolicNames; } + get ruleNames() { return MySqlParser.ruleNames; } + get serializedATN() { return MySqlParser._serializedATN; } + createFailedPredicateException(predicate, message) { + return new antlr.FailedPredicateException(this, predicate, message); + } + constructor(input) { + super(input); + this.interpreter = new antlr.ParserATNSimulator(this, MySqlParser._ATN, MySqlParser.decisionsToDFA, new antlr.PredictionContextCache()); + } + program() { + let localContext = new ProgramContext(this.context, this.state); + this.enterRule(localContext, 0, MySqlParser.RULE_program); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 837; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 169870592) !== 0) || ((((_la - 34)) & ~0x1F) === 0 && ((1 << (_la - 34)) & 268573697) !== 0) || ((((_la - 72)) & ~0x1F) === 0 && ((1 << (_la - 72)) & 2151694339) !== 0) || ((((_la - 104)) & ~0x1F) === 0 && ((1 << (_la - 104)) & 536936449) !== 0) || ((((_la - 140)) & ~0x1F) === 0 && ((1 << (_la - 140)) & 442923) !== 0) || ((((_la - 173)) & ~0x1F) === 0 && ((1 << (_la - 173)) & 2184193) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 16781443) !== 0) || _la === 362 || _la === 371 || ((((_la - 404)) & ~0x1F) === 0 && ((1 << (_la - 404)) & 270573569) !== 0) || _la === 540 || _la === 562 || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 16643) !== 0) || ((((_la - 640)) & ~0x1F) === 0 && ((1 << (_la - 640)) & 268435521) !== 0) || _la === 673 || _la === 694 || _la === 713 || _la === 717 || _la === 749 || _la === 866 || _la === 869) { + { + { + this.state = 834; + this.singleStatement(); + } + } + this.state = 839; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 840; + this.match(MySqlParser.EOF); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + singleStatement() { + let localContext = new SingleStatementContext(this.context, this.state); + this.enterRule(localContext, 2, MySqlParser.RULE_singleStatement); + try { + this.state = 847; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + this.enterOuterAlt(localContext, 1); + { + this.state = 842; + this.sqlStatement(); + this.state = 844; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1, this.context)) { + case 1: + { + this.state = 843; + this.match(MySqlParser.SEMI); + } + break; + } + } + break; + case MySqlParser.SEMI: + this.enterOuterAlt(localContext, 2); + { + this.state = 846; + this.emptyStatement_(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + sqlStatement() { + let localContext = new SqlStatementContext(this.context, this.state); + this.enterRule(localContext, 4, MySqlParser.RULE_sqlStatement); + try { + this.state = 856; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 3, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 849; + this.ddlStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 850; + this.dmlStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 851; + this.transactionStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 852; + this.replicationStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 853; + this.preparedStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 854; + this.administrationStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 855; + this.utilityStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + emptyStatement_() { + let localContext = new EmptyStatement_Context(this.context, this.state); + this.enterRule(localContext, 6, MySqlParser.RULE_emptyStatement_); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 858; + this.match(MySqlParser.SEMI); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ddlStatement() { + let localContext = new DdlStatementContext(this.context, this.state); + this.enterRule(localContext, 8, MySqlParser.RULE_ddlStatement); + try { + this.state = 899; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 4, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 860; + this.createDatabase(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 861; + this.createEvent(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 862; + this.createIndex(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 863; + this.createLogfileGroup(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 864; + this.createProcedure(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 865; + this.createFunction(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 866; + this.createServer(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 867; + this.createTable(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 868; + this.createTablespaceInnodb(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 869; + this.createTablespaceNdb(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 870; + this.createTrigger(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 871; + this.createView(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 872; + this.createRole(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 873; + this.alterDatabase(); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 874; + this.alterEvent(); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 875; + this.alterFunction(); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 876; + this.alterInstance(); + } + break; + case 18: + this.enterOuterAlt(localContext, 18); + { + this.state = 877; + this.alterLogfileGroup(); + } + break; + case 19: + this.enterOuterAlt(localContext, 19); + { + this.state = 878; + this.alterProcedure(); + } + break; + case 20: + this.enterOuterAlt(localContext, 20); + { + this.state = 879; + this.alterServer(); + } + break; + case 21: + this.enterOuterAlt(localContext, 21); + { + this.state = 880; + this.alterTable(); + } + break; + case 22: + this.enterOuterAlt(localContext, 22); + { + this.state = 881; + this.alterTablespace(); + } + break; + case 23: + this.enterOuterAlt(localContext, 23); + { + this.state = 882; + this.alterView(); + } + break; + case 24: + this.enterOuterAlt(localContext, 24); + { + this.state = 883; + this.dropDatabase(); + } + break; + case 25: + this.enterOuterAlt(localContext, 25); + { + this.state = 884; + this.dropEvent(); + } + break; + case 26: + this.enterOuterAlt(localContext, 26); + { + this.state = 885; + this.dropIndex(); + } + break; + case 27: + this.enterOuterAlt(localContext, 27); + { + this.state = 886; + this.dropLogfileGroup(); + } + break; + case 28: + this.enterOuterAlt(localContext, 28); + { + this.state = 887; + this.dropProcedure(); + } + break; + case 29: + this.enterOuterAlt(localContext, 29); + { + this.state = 888; + this.dropFunction(); + } + break; + case 30: + this.enterOuterAlt(localContext, 30); + { + this.state = 889; + this.dropServer(); + } + break; + case 31: + this.enterOuterAlt(localContext, 31); + { + this.state = 890; + this.dropSpatial(); + } + break; + case 32: + this.enterOuterAlt(localContext, 32); + { + this.state = 891; + this.dropTable(); + } + break; + case 33: + this.enterOuterAlt(localContext, 33); + { + this.state = 892; + this.dropTablespace(); + } + break; + case 34: + this.enterOuterAlt(localContext, 34); + { + this.state = 893; + this.dropTrigger(); + } + break; + case 35: + this.enterOuterAlt(localContext, 35); + { + this.state = 894; + this.dropView(); + } + break; + case 36: + this.enterOuterAlt(localContext, 36); + { + this.state = 895; + this.dropRole(); + } + break; + case 37: + this.enterOuterAlt(localContext, 37); + { + this.state = 896; + this.setRole(); + } + break; + case 38: + this.enterOuterAlt(localContext, 38); + { + this.state = 897; + this.renameTable(); + } + break; + case 39: + this.enterOuterAlt(localContext, 39); + { + this.state = 898; + this.truncateTable(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dmlStatement() { + let localContext = new DmlStatementContext(this.context, this.state); + this.enterRule(localContext, 10, MySqlParser.RULE_dmlStatement); + try { + this.state = 918; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 5, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 901; + this.selectStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 902; + this.setOperations(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 903; + this.insertStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 904; + this.updateStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 905; + this.deleteStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 906; + this.replaceStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 907; + this.callStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 908; + this.interSectStatement(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 909; + this.loadDataStatement(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 910; + this.loadXmlStatement(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 911; + this.parenthesizedQuery(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 912; + this.doStatement(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 913; + this.handlerStatement(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 914; + this.importTableStatement(); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 915; + this.valuesStatement(); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 916; + this.withStatement(); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 917; + this.tableStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionStatement() { + let localContext = new TransactionStatementContext(this.context, this.state); + this.enterRule(localContext, 12, MySqlParser.RULE_transactionStatement); + try { + this.state = 929; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 6, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 920; + this.startTransaction(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 921; + this.beginWork(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 922; + this.commitWork(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 923; + this.rollbackWork(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 924; + this.savepointStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 925; + this.rollbackStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 926; + this.releaseStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 927; + this.lockTables(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 928; + this.unlockTables(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replicationStatement() { + let localContext = new ReplicationStatementContext(this.context, this.state); + this.enterRule(localContext, 14, MySqlParser.RULE_replicationStatement); + try { + this.state = 945; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 7, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 931; + this.changeMaster(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 932; + this.changeReplicationFilter(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 933; + this.changeReplicationSource(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 934; + this.purgeBinaryLogs(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 935; + this.startSlaveOrReplica(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 936; + this.stopSlaveOrReplica(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 937; + this.startGroupReplication(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 938; + this.stopGroupReplication(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 939; + this.xaStartTransaction(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 940; + this.xaEndTransaction(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 941; + this.xaPrepareStatement(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 942; + this.xaCommitWork(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 943; + this.xaRollbackWork(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 944; + this.xaRecoverWork(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + preparedStatement() { + let localContext = new PreparedStatementContext(this.context, this.state); + this.enterRule(localContext, 16, MySqlParser.RULE_preparedStatement); + try { + this.state = 950; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PREPARE: + this.enterOuterAlt(localContext, 1); + { + this.state = 947; + this.prepareStatement(); + } + break; + case MySqlParser.KW_EXECUTE: + this.enterOuterAlt(localContext, 2); + { + this.state = 948; + this.executeStatement(); + } + break; + case MySqlParser.KW_DROP: + case MySqlParser.KW_DEALLOCATE: + this.enterOuterAlt(localContext, 3); + { + this.state = 949; + this.deallocatePrepare(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + compoundStatement() { + let localContext = new CompoundStatementContext(this.context, this.state); + this.enterRule(localContext, 18, MySqlParser.RULE_compoundStatement); + try { + this.state = 962; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 952; + this.blockStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 953; + this.caseStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 954; + this.ifStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 955; + this.leaveStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 956; + this.loopStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 957; + this.repeatStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 958; + this.whileStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 959; + this.iterateStatement(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 960; + this.returnStatement(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 961; + this.cursorStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + administrationStatement() { + let localContext = new AdministrationStatementContext(this.context, this.state); + this.enterRule(localContext, 20, MySqlParser.RULE_administrationStatement); + try { + this.state = 997; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 10, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 964; + this.alterUser(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 965; + this.createUser(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 966; + this.dropUser(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 967; + this.grantStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 968; + this.grantProxy(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 969; + this.renameUser(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 970; + this.revokeStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 971; + this.alterResourceGroup(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 972; + this.createResourceGroup(); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 973; + this.dropResourceGroup(); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 974; + this.setResourceGroup(); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 975; + this.analyzeTable(); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 976; + this.checkTable(); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 977; + this.checksumTable(); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 978; + this.optimizeTable(); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 979; + this.repairTable(); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 980; + this.installComponent(); + } + break; + case 18: + this.enterOuterAlt(localContext, 18); + { + this.state = 981; + this.uninstallComponent(); + } + break; + case 19: + this.enterOuterAlt(localContext, 19); + { + this.state = 982; + this.installPlugin(); + } + break; + case 20: + this.enterOuterAlt(localContext, 20); + { + this.state = 983; + this.uninstallPlugin(); + } + break; + case 21: + this.enterOuterAlt(localContext, 21); + { + this.state = 984; + this.cloneStatement(); + } + break; + case 22: + this.enterOuterAlt(localContext, 22); + { + this.state = 985; + this.setStatement(); + } + break; + case 23: + this.enterOuterAlt(localContext, 23); + { + this.state = 986; + this.showStatement(); + } + break; + case 24: + this.enterOuterAlt(localContext, 24); + { + this.state = 987; + this.binlogStatement(); + } + break; + case 25: + this.enterOuterAlt(localContext, 25); + { + this.state = 988; + this.cacheIndexStatement(); + } + break; + case 26: + this.enterOuterAlt(localContext, 26); + { + this.state = 989; + this.flushStatement(); + } + break; + case 27: + this.enterOuterAlt(localContext, 27); + { + this.state = 990; + this.killStatement(); + } + break; + case 28: + this.enterOuterAlt(localContext, 28); + { + this.state = 991; + this.loadIndexIntoCache(); + } + break; + case 29: + this.enterOuterAlt(localContext, 29); + { + this.state = 992; + this.resetStatement(); + } + break; + case 30: + this.enterOuterAlt(localContext, 30); + { + this.state = 993; + this.resetPersist(); + } + break; + case 31: + this.enterOuterAlt(localContext, 31); + { + this.state = 994; + this.resetAllChannel(); + } + break; + case 32: + this.enterOuterAlt(localContext, 32); + { + this.state = 995; + this.reStartStatement(); + } + break; + case 33: + this.enterOuterAlt(localContext, 33); + { + this.state = 996; + this.shutdownStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + utilityStatement() { + let localContext = new UtilityStatementContext(this.context, this.state); + this.enterRule(localContext, 22, MySqlParser.RULE_utilityStatement); + try { + this.state = 1007; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 11, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 999; + this.fullDescribeStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1000; + this.simpleDescribeStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1001; + this.analyzeDescribeStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1002; + this.helpStatement(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 1003; + this.useStatement(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 1004; + this.signalStatement(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 1005; + this.resignalStatement(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 1006; + this.diagnosticsStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDatabase() { + let localContext = new CreateDatabaseContext(this.context, this.state); + this.enterRule(localContext, 24, MySqlParser.RULE_createDatabase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1009; + this.match(MySqlParser.KW_CREATE); + this.state = 1010; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1012; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 12, this.context)) { + case 1: + { + this.state = 1011; + this.ifNotExists(); + } + break; + } + this.state = 1014; + this.databaseNameCreate(); + this.state = 1018; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 135 || _la === 224 || _la === 376 || _la === 823) { + { + { + this.state = 1015; + this.createDatabaseOption(); + } + } + this.state = 1020; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createEvent() { + let localContext = new CreateEventContext(this.context, this.state); + this.enterRule(localContext, 26, MySqlParser.RULE_createEvent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1021; + this.match(MySqlParser.KW_CREATE); + this.state = 1023; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1022; + this.ownerStatement(); + } + } + this.state = 1025; + this.match(MySqlParser.KW_EVENT); + this.state = 1027; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 15, this.context)) { + case 1: + { + this.state = 1026; + this.ifNotExists(); + } + break; + } + this.state = 1029; + localContext._event_name = this.fullId(); + this.state = 1030; + this.match(MySqlParser.KW_ON); + this.state = 1031; + this.match(MySqlParser.KW_SCHEDULE); + this.state = 1032; + this.scheduleExpression(); + this.state = 1039; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 119) { + { + this.state = 1033; + this.match(MySqlParser.KW_ON); + this.state = 1034; + this.match(MySqlParser.KW_COMPLETION); + this.state = 1036; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 1035; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 1038; + this.match(MySqlParser.KW_PRESERVE); + } + } + this.state = 1042; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 1041; + this.enableType(); + } + } + this.state = 1046; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 1044; + this.match(MySqlParser.KW_COMMENT); + this.state = 1045; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1048; + this.match(MySqlParser.KW_DO); + this.state = 1049; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createIndex() { + let localContext = new CreateIndexContext(this.context, this.state); + this.enterRule(localContext, 28, MySqlParser.RULE_createIndex); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 1051; + this.match(MySqlParser.KW_CREATE); + this.state = 1053; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 508 || _la === 514) { + { + this.state = 1052; + localContext._intimeAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 508 || _la === 514)) { + localContext._intimeAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1056; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 69 || _la === 161 || _la === 182) { + { + this.state = 1055; + localContext._indexCategory = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 69 || _la === 161 || _la === 182)) { + localContext._indexCategory = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1058; + this.match(MySqlParser.KW_INDEX); + this.state = 1059; + this.indexNameCreate(); + this.state = 1061; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1060; + this.indexType(); + } + } + this.state = 1063; + this.match(MySqlParser.KW_ON); + this.state = 1064; + this.tableName(); + this.state = 1065; + this.indexColumnNames(); + this.state = 1069; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 23, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1066; + this.indexOption(); + } + } + } + this.state = 1071; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 23, this.context); + } + this.state = 1084; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 27, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + this.state = 1082; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALGORITHM: + { + this.state = 1072; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 1074; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1073; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1076; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 357 || _la === 430)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_LOCK: + { + this.state = 1077; + this.match(MySqlParser.KW_LOCK); + this.state = 1079; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1078; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1081; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 389 || _la === 505 || _la === 595)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 1086; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 27, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createLogfileGroup() { + let localContext = new CreateLogfileGroupContext(this.context, this.state); + this.enterRule(localContext, 30, MySqlParser.RULE_createLogfileGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1087; + this.match(MySqlParser.KW_CREATE); + this.state = 1088; + this.match(MySqlParser.KW_LOGFILE); + this.state = 1089; + this.match(MySqlParser.KW_GROUP); + this.state = 1090; + localContext._logfileGroupName = this.uid(); + this.state = 1091; + this.match(MySqlParser.KW_ADD); + this.state = 1092; + this.match(MySqlParser.KW_UNDOFILE); + this.state = 1093; + localContext._undoFile = this.match(MySqlParser.STRING_LITERAL); + this.state = 1099; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 1094; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 1096; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1095; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1098; + localContext._initSize = this.fileSizeLiteral(); + } + } + this.state = 1106; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 672) { + { + this.state = 1101; + this.match(MySqlParser.KW_UNDO_BUFFER_SIZE); + this.state = 1103; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1102; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1105; + localContext._undoSize = this.fileSizeLiteral(); + } + } + this.state = 1113; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 553) { + { + this.state = 1108; + this.match(MySqlParser.KW_REDO_BUFFER_SIZE); + this.state = 1110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1109; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1112; + localContext._redoSize = this.fileSizeLiteral(); + } + } + this.state = 1120; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 504) { + { + this.state = 1115; + this.match(MySqlParser.KW_NODEGROUP); + this.state = 1117; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1116; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1119; + localContext._nodegroup = this.uid(); + } + } + this.state = 1123; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 1122; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 1130; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 1125; + this.match(MySqlParser.KW_COMMENT); + this.state = 1127; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1126; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1129; + localContext._comment = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1132; + this.match(MySqlParser.KW_ENGINE); + this.state = 1134; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1133; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1136; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createProcedure() { + let localContext = new CreateProcedureContext(this.context, this.state); + this.enterRule(localContext, 32, MySqlParser.RULE_createProcedure); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 1138; + this.match(MySqlParser.KW_CREATE); + this.state = 1140; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1139; + this.ownerStatement(); + } + } + this.state = 1142; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 1144; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 41, this.context)) { + case 1: + { + this.state = 1143; + this.ifNotExists(); + } + break; + } + this.state = 1146; + localContext._sp_name = this.fullId(); + this.state = 1147; + this.match(MySqlParser.LR_BRACKET); + this.state = 1149; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18880593) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100680481) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1148; + this.procedureParameter(); + } + } + this.state = 1155; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1151; + this.match(MySqlParser.COMMA); + this.state = 1152; + this.procedureParameter(); + } + } + this.state = 1157; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1158; + this.match(MySqlParser.RR_BRACKET); + this.state = 1162; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 44, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1159; + this.routineOption(); + } + } + } + this.state = 1164; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 44, this.context); + } + this.state = 1165; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createRole() { + let localContext = new CreateRoleContext(this.context, this.state); + this.enterRule(localContext, 34, MySqlParser.RULE_createRole); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1167; + this.match(MySqlParser.KW_CREATE); + this.state = 1168; + this.match(MySqlParser.KW_ROLE); + this.state = 1170; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 45, this.context)) { + case 1: + { + this.state = 1169; + this.ifNotExists(); + } + break; + } + this.state = 1172; + this.userOrRoleNames(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createServer() { + let localContext = new CreateServerContext(this.context, this.state); + this.enterRule(localContext, 36, MySqlParser.RULE_createServer); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1174; + this.match(MySqlParser.KW_CREATE); + this.state = 1175; + this.match(MySqlParser.KW_SERVER); + this.state = 1176; + localContext._servername = this.uid(); + this.state = 1177; + this.match(MySqlParser.KW_FOREIGN); + this.state = 1178; + this.match(MySqlParser.KW_DATA); + this.state = 1179; + this.match(MySqlParser.KW_WRAPPER); + this.state = 1180; + localContext._wrapperName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 494 || _la === 882)) { + localContext._wrapperName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1181; + this.match(MySqlParser.KW_OPTIONS); + this.state = 1182; + this.match(MySqlParser.LR_BRACKET); + this.state = 1183; + this.serverOption(); + this.state = 1188; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1184; + this.match(MySqlParser.COMMA); + this.state = 1185; + this.serverOption(); + } + } + this.state = 1190; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1191; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTable() { + let localContext = new CreateTableContext(this.context, this.state); + this.enterRule(localContext, 38, MySqlParser.RULE_createTable); + let _la; + try { + let alternative; + this.state = 1271; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 65, this.context)) { + case 1: + localContext = new QueryCreateTableContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1193; + this.match(MySqlParser.KW_CREATE); + this.state = 1195; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 1194; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 1197; + this.match(MySqlParser.KW_TABLE); + this.state = 1199; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 48, this.context)) { + case 1: + { + this.state = 1198; + this.ifNotExists(); + } + break; + } + this.state = 1201; + localContext._tb = this.tableNameCreate(); + this.state = 1203; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 49, this.context)) { + case 1: + { + this.state = 1202; + localContext._col = this.createDefinitions(); + } + break; + } + this.state = 1215; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 82 || _la === 181 || _la === 224 || ((((_la - 314)) & ~0x1F) === 0 && ((1 << (_la - 314)) & 67141639) !== 0) || ((((_la - 346)) & ~0x1F) === 0 && ((1 << (_la - 346)) & 3221766153) !== 0) || _la === 380 || _la === 431 || _la === 443 || _la === 480 || _la === 490 || ((((_la - 520)) & ~0x1F) === 0 && ((1 << (_la - 520)) & 541) !== 0) || _la === 588 || ((((_la - 640)) & ~0x1F) === 0 && ((1 << (_la - 640)) & 34341021) !== 0) || ((((_la - 823)) & ~0x1F) === 0 && ((1 << (_la - 823)) & 1029) !== 0) || _la === 882) { + { + this.state = 1205; + this.tableOption(); + this.state = 1212; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 82 || _la === 181 || _la === 224 || ((((_la - 314)) & ~0x1F) === 0 && ((1 << (_la - 314)) & 67141639) !== 0) || ((((_la - 346)) & ~0x1F) === 0 && ((1 << (_la - 346)) & 3221766153) !== 0) || _la === 380 || _la === 431 || _la === 443 || _la === 480 || _la === 490 || ((((_la - 520)) & ~0x1F) === 0 && ((1 << (_la - 520)) & 541) !== 0) || _la === 588 || ((((_la - 640)) & ~0x1F) === 0 && ((1 << (_la - 640)) & 34341021) !== 0) || ((((_la - 823)) & ~0x1F) === 0 && ((1 << (_la - 823)) & 1029) !== 0) || _la === 868 || _la === 882) { + { + { + this.state = 1207; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 1206; + this.match(MySqlParser.COMMA); + } + } + this.state = 1209; + this.tableOption(); + } + } + this.state = 1214; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 1218; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 1217; + this.partitionDefinitions(); + } + } + this.state = 1221; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79 || _la === 143) { + { + this.state = 1220; + _la = this.tokenStream.LA(1); + if (!(_la === 79 || _la === 143)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1224; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 1223; + this.match(MySqlParser.KW_AS); + } + } + this.state = 1226; + this.selectStatement(); + } + break; + case 2: + localContext = new CopyCreateTableContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1228; + this.match(MySqlParser.KW_CREATE); + this.state = 1230; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 1229; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 1232; + this.match(MySqlParser.KW_TABLE); + this.state = 1234; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 57, this.context)) { + case 1: + { + this.state = 1233; + this.ifNotExists(); + } + break; + } + this.state = 1236; + this.tableNameCreate(); + this.state = 1244; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_LIKE: + { + this.state = 1237; + this.match(MySqlParser.KW_LIKE); + this.state = 1238; + this.tableName(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 1239; + this.match(MySqlParser.LR_BRACKET); + this.state = 1240; + this.match(MySqlParser.KW_LIKE); + this.state = 1241; + this.tableName(); + this.state = 1242; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 3: + localContext = new ColumnCreateTableContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1246; + this.match(MySqlParser.KW_CREATE); + this.state = 1248; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 1247; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 1250; + this.match(MySqlParser.KW_TABLE); + this.state = 1252; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 60, this.context)) { + case 1: + { + this.state = 1251; + this.ifNotExists(); + } + break; + } + this.state = 1254; + this.tableNameCreate(); + this.state = 1255; + this.createDefinitions(); + this.state = 1266; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 63, this.context)) { + case 1: + { + this.state = 1256; + this.tableOption(); + this.state = 1263; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 62, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1258; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 1257; + this.match(MySqlParser.COMMA); + } + } + this.state = 1260; + this.tableOption(); + } + } + } + this.state = 1265; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 62, this.context); + } + } + break; + } + this.state = 1269; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 1268; + this.partitionDefinitions(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTablespaceInnodb() { + let localContext = new CreateTablespaceInnodbContext(this.context, this.state); + this.enterRule(localContext, 40, MySqlParser.RULE_createTablespaceInnodb); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1273; + this.match(MySqlParser.KW_CREATE); + this.state = 1275; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 1274; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 1277; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 1278; + this.tablespaceNameCreate(); + this.state = 1282; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 6) { + { + this.state = 1279; + this.match(MySqlParser.KW_ADD); + this.state = 1280; + this.match(MySqlParser.KW_DATAFILE); + this.state = 1281; + localContext._datafile = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1289; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 314) { + { + this.state = 1284; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 1286; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1285; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1288; + localContext._autoextendSize = this.fileSizeLiteral(); + } + } + this.state = 1294; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 399) { + { + this.state = 1291; + this.match(MySqlParser.KW_FILE_BLOCK_SIZE); + this.state = 1292; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 1293; + localContext._fileBlockSize = this.fileSizeLiteral(); + } + } + this.state = 1301; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 380) { + { + this.state = 1296; + this.match(MySqlParser.KW_ENGINE); + this.state = 1298; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1297; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1300; + this.engineName(); + } + } + this.state = 1308; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 825) { + { + this.state = 1303; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 1305; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1304; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1307; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTablespaceNdb() { + let localContext = new CreateTablespaceNdbContext(this.context, this.state); + this.enterRule(localContext, 42, MySqlParser.RULE_createTablespaceNdb); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1310; + this.match(MySqlParser.KW_CREATE); + this.state = 1312; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 1311; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 1314; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 1315; + this.tablespaceNameCreate(); + this.state = 1316; + this.match(MySqlParser.KW_ADD); + this.state = 1317; + this.match(MySqlParser.KW_DATAFILE); + this.state = 1318; + localContext._datafile = this.match(MySqlParser.STRING_LITERAL); + this.state = 1319; + this.match(MySqlParser.KW_USE); + this.state = 1320; + this.match(MySqlParser.KW_LOGFILE); + this.state = 1321; + this.match(MySqlParser.KW_GROUP); + this.state = 1322; + localContext._logfileGroupName = this.uid(); + this.state = 1328; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 393) { + { + this.state = 1323; + this.match(MySqlParser.KW_EXTENT_SIZE); + this.state = 1325; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1324; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1327; + localContext._extentSize = this.fileSizeLiteral(); + } + } + this.state = 1335; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 1330; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 1332; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1331; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1334; + localContext._initialSize = this.fileSizeLiteral(); + } + } + this.state = 1342; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 314) { + { + this.state = 1337; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 1339; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1338; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1341; + localContext._autoextendSize = this.fileSizeLiteral(); + } + } + this.state = 1349; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 481) { + { + this.state = 1344; + this.match(MySqlParser.KW_MAX_SIZE); + this.state = 1346; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1345; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1348; + localContext._maxSize = this.fileSizeLiteral(); + } + } + this.state = 1356; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 504) { + { + this.state = 1351; + this.match(MySqlParser.KW_NODEGROUP); + this.state = 1353; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1352; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1355; + localContext._nodegroup = this.uid(); + } + } + this.state = 1359; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 1358; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 1366; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 1361; + this.match(MySqlParser.KW_COMMENT); + this.state = 1363; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1362; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1365; + localContext._comment = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 1368; + this.match(MySqlParser.KW_ENGINE); + this.state = 1370; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1369; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1372; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createTrigger() { + let localContext = new CreateTriggerContext(this.context, this.state); + this.enterRule(localContext, 44, MySqlParser.RULE_createTrigger); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1374; + this.match(MySqlParser.KW_CREATE); + this.state = 1376; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1375; + this.ownerStatement(); + } + } + this.state = 1378; + this.match(MySqlParser.KW_TRIGGER); + this.state = 1380; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 91, this.context)) { + case 1: + { + this.state = 1379; + this.ifNotExists(); + } + break; + } + this.state = 1382; + localContext._trigger_name = this.fullId(); + this.state = 1383; + localContext._triggerTime = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 16 || _la === 306)) { + localContext._triggerTime = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1384; + localContext._triggerEvent = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 44 || _la === 86 || _la === 185)) { + localContext._triggerEvent = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1385; + this.match(MySqlParser.KW_ON); + this.state = 1386; + this.tableName(); + this.state = 1387; + this.match(MySqlParser.KW_FOR); + this.state = 1388; + this.match(MySqlParser.KW_EACH); + this.state = 1389; + this.match(MySqlParser.KW_ROW); + this.state = 1392; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 92, this.context)) { + case 1: + { + this.state = 1390; + localContext._triggerPlace = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 406 || _la === 538)) { + localContext._triggerPlace = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1391; + localContext._other_trigger_name = this.fullId(); + } + break; + } + this.state = 1394; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + withClause() { + let localContext = new WithClauseContext(this.context, this.state); + this.enterRule(localContext, 46, MySqlParser.RULE_withClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1396; + this.match(MySqlParser.KW_WITH); + this.state = 1398; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 93, this.context)) { + case 1: + { + this.state = 1397; + this.match(MySqlParser.KW_RECURSIVE); + } + break; + } + this.state = 1400; + this.commonTableExpressions(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + commonTableExpressions() { + let localContext = new CommonTableExpressionsContext(this.context, this.state); + this.enterRule(localContext, 48, MySqlParser.RULE_commonTableExpressions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1402; + localContext._cteName = this.uid(); + this.state = 1414; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 1403; + this.match(MySqlParser.LR_BRACKET); + this.state = 1404; + localContext._cteColumnName = this.uid(); + this.state = 1409; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1405; + this.match(MySqlParser.COMMA); + this.state = 1406; + localContext._cteColumnName = this.uid(); + } + } + this.state = 1411; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1412; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 1416; + this.match(MySqlParser.KW_AS); + this.state = 1417; + this.match(MySqlParser.LR_BRACKET); + this.state = 1418; + this.dmlStatement(); + this.state = 1419; + this.match(MySqlParser.RR_BRACKET); + this.state = 1422; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 96, this.context)) { + case 1: + { + this.state = 1420; + this.match(MySqlParser.COMMA); + this.state = 1421; + this.commonTableExpressions(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createView() { + let localContext = new CreateViewContext(this.context, this.state); + this.enterRule(localContext, 50, MySqlParser.RULE_createView); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1424; + this.match(MySqlParser.KW_CREATE); + this.state = 1426; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 124) { + { + this.state = 1425; + this.orReplace(); + } + } + this.state = 1431; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 1428; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 1429; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 1430; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 486 || _la === 661 || _la === 670)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1434; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 1433; + this.ownerStatement(); + } + } + this.state = 1439; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 162) { + { + this.state = 1436; + this.match(MySqlParser.KW_SQL); + this.state = 1437; + this.match(MySqlParser.KW_SECURITY); + this.state = 1438; + localContext._secContext = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 364 || _la === 436)) { + localContext._secContext = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1441; + this.match(MySqlParser.KW_VIEW); + this.state = 1442; + this.viewNameCreate(); + this.state = 1454; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 1443; + this.match(MySqlParser.LR_BRACKET); + this.state = 1444; + this.columnNameCreate(); + this.state = 1449; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1445; + this.match(MySqlParser.COMMA); + this.state = 1446; + this.columnNameCreate(); + } + } + this.state = 1451; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1452; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 1456; + this.match(MySqlParser.KW_AS); + this.state = 1476; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 107, this.context)) { + case 1: + { + this.state = 1457; + this.match(MySqlParser.LR_BRACKET); + this.state = 1459; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 1458; + this.withClause(); + } + } + this.state = 1461; + this.selectStatement(); + this.state = 1462; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 1465; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 1464; + this.withClause(); + } + } + this.state = 1467; + this.selectStatement(); + this.state = 1474; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 106, this.context)) { + case 1: + { + this.state = 1468; + this.match(MySqlParser.KW_WITH); + this.state = 1470; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 325 || _la === 450) { + { + this.state = 1469; + localContext._checkOption = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 325 || _la === 450)) { + localContext._checkOption = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1472; + this.match(MySqlParser.KW_CHECK); + this.state = 1473; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDatabaseOption() { + let localContext = new CreateDatabaseOptionContext(this.context, this.state); + this.enterRule(localContext, 52, MySqlParser.RULE_createDatabaseOption); + let _la; + try { + this.state = 1511; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 116, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1479; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1478; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1481; + this.charSet(); + this.state = 1483; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1482; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1487; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 1485; + this.charsetName(); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 1486; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1490; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1489; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1492; + this.match(MySqlParser.KW_COLLATE); + this.state = 1494; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1493; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1496; + this.collationName(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1498; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1497; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1500; + this.match(MySqlParser.KW_ENCRYPTION); + this.state = 1502; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1501; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1504; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1505; + this.match(MySqlParser.KW_READ); + this.state = 1506; + this.match(MySqlParser.KW_ONLY); + this.state = 1508; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1507; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1510; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + charSet() { + let localContext = new CharSetContext(this.context, this.state); + this.enterRule(localContext, 54, MySqlParser.RULE_charSet); + try { + this.state = 1518; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CHARACTER: + this.enterOuterAlt(localContext, 1); + { + this.state = 1513; + this.match(MySqlParser.KW_CHARACTER); + this.state = 1514; + this.match(MySqlParser.KW_SET); + } + break; + case MySqlParser.KW_CHARSET: + this.enterOuterAlt(localContext, 2); + { + this.state = 1515; + this.match(MySqlParser.KW_CHARSET); + } + break; + case MySqlParser.KW_CHAR: + this.enterOuterAlt(localContext, 3); + { + this.state = 1516; + this.match(MySqlParser.KW_CHAR); + this.state = 1517; + this.match(MySqlParser.KW_SET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + currentUserExpression() { + let localContext = new CurrentUserExpressionContext(this.context, this.state); + this.enterRule(localContext, 56, MySqlParser.RULE_currentUserExpression); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1520; + _la = this.tokenStream.LA(1); + if (!(_la === 37 || _la === 678)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1523; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 118, this.context)) { + case 1: + { + this.state = 1521; + this.match(MySqlParser.LR_BRACKET); + this.state = 1522; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ownerStatement() { + let localContext = new OwnerStatementContext(this.context, this.state); + this.enterRule(localContext, 58, MySqlParser.RULE_ownerStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1525; + this.match(MySqlParser.KW_DEFINER); + this.state = 1526; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 1529; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 119, this.context)) { + case 1: + { + this.state = 1527; + this.userName(); + } + break; + case 2: + { + this.state = 1528; + this.currentUserExpression(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + scheduleExpression() { + let localContext = new ScheduleExpressionContext(this.context, this.state); + this.enterRule(localContext, 60, MySqlParser.RULE_scheduleExpression); + let _la; + try { + this.state = 1565; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AT: + localContext = new PreciseScheduleContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1531; + this.match(MySqlParser.KW_AT); + this.state = 1532; + this.timestampValue(); + this.state = 1536; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 853) { + { + { + this.state = 1533; + this.intervalExpr(); + } + } + this.state = 1538; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case MySqlParser.KW_EVERY: + localContext = new IntervalScheduleContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1539; + this.match(MySqlParser.KW_EVERY); + this.state = 1542; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 121, this.context)) { + case 1: + { + this.state = 1540; + this.decimalLiteral(); + } + break; + case 2: + { + this.state = 1541; + this.expression(0); + } + break; + } + this.state = 1544; + this.intervalType(); + this.state = 1553; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 641) { + { + this.state = 1545; + this.match(MySqlParser.KW_STARTS); + this.state = 1546; + localContext._startTimestamp = this.timestampValue(); + this.state = 1550; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 853) { + { + { + this.state = 1547; + localContext._intervalExpr = this.intervalExpr(); + localContext._startIntervals.push(localContext._intervalExpr); + } + } + this.state = 1552; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 1563; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 379) { + { + this.state = 1555; + this.match(MySqlParser.KW_ENDS); + this.state = 1556; + localContext._endTimestamp = this.timestampValue(); + this.state = 1560; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 853) { + { + { + this.state = 1557; + localContext._intervalExpr = this.intervalExpr(); + localContext._endIntervals.push(localContext._intervalExpr); + } + } + this.state = 1562; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + timestampValue() { + let localContext = new TimestampValueContext(this.context, this.state); + this.enterRule(localContext, 62, MySqlParser.RULE_timestampValue); + try { + this.state = 1571; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 127, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1567; + this.match(MySqlParser.KW_CURRENT_TIMESTAMP); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1568; + this.stringLiteral(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1569; + this.decimalLiteral(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1570; + this.expression(0); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intervalExpr() { + let localContext = new IntervalExprContext(this.context, this.state); + this.enterRule(localContext, 64, MySqlParser.RULE_intervalExpr); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1573; + this.match(MySqlParser.PLUS); + this.state = 1574; + this.match(MySqlParser.KW_INTERVAL); + this.state = 1577; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 128, this.context)) { + case 1: + { + this.state = 1575; + this.decimalLiteral(); + } + break; + case 2: + { + this.state = 1576; + this.expression(0); + } + break; + } + this.state = 1579; + this.intervalType(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intervalType() { + let localContext = new IntervalTypeContext(this.context, this.state); + this.enterRule(localContext, 66, MySqlParser.RULE_intervalType); + try { + this.state = 1594; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + this.enterOuterAlt(localContext, 1); + { + this.state = 1581; + this.intervalTypeBase(); + } + break; + case MySqlParser.KW_YEAR: + this.enterOuterAlt(localContext, 2); + { + this.state = 1582; + this.match(MySqlParser.KW_YEAR); + } + break; + case MySqlParser.KW_YEAR_MONTH: + this.enterOuterAlt(localContext, 3); + { + this.state = 1583; + this.match(MySqlParser.KW_YEAR_MONTH); + } + break; + case MySqlParser.KW_DAY_HOUR: + this.enterOuterAlt(localContext, 4); + { + this.state = 1584; + this.match(MySqlParser.KW_DAY_HOUR); + } + break; + case MySqlParser.KW_DAY_MINUTE: + this.enterOuterAlt(localContext, 5); + { + this.state = 1585; + this.match(MySqlParser.KW_DAY_MINUTE); + } + break; + case MySqlParser.KW_DAY_SECOND: + this.enterOuterAlt(localContext, 6); + { + this.state = 1586; + this.match(MySqlParser.KW_DAY_SECOND); + } + break; + case MySqlParser.KW_HOUR_MINUTE: + this.enterOuterAlt(localContext, 7); + { + this.state = 1587; + this.match(MySqlParser.KW_HOUR_MINUTE); + } + break; + case MySqlParser.KW_HOUR_SECOND: + this.enterOuterAlt(localContext, 8); + { + this.state = 1588; + this.match(MySqlParser.KW_HOUR_SECOND); + } + break; + case MySqlParser.KW_MINUTE_SECOND: + this.enterOuterAlt(localContext, 9); + { + this.state = 1589; + this.match(MySqlParser.KW_MINUTE_SECOND); + } + break; + case MySqlParser.KW_SECOND_MICROSECOND: + this.enterOuterAlt(localContext, 10); + { + this.state = 1590; + this.match(MySqlParser.KW_SECOND_MICROSECOND); + } + break; + case MySqlParser.KW_MINUTE_MICROSECOND: + this.enterOuterAlt(localContext, 11); + { + this.state = 1591; + this.match(MySqlParser.KW_MINUTE_MICROSECOND); + } + break; + case MySqlParser.KW_HOUR_MICROSECOND: + this.enterOuterAlt(localContext, 12); + { + this.state = 1592; + this.match(MySqlParser.KW_HOUR_MICROSECOND); + } + break; + case MySqlParser.KW_DAY_MICROSECOND: + this.enterOuterAlt(localContext, 13); + { + this.state = 1593; + this.match(MySqlParser.KW_DAY_MICROSECOND); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + enableType() { + let localContext = new EnableTypeContext(this.context, this.state); + this.enterRule(localContext, 68, MySqlParser.RULE_enableType); + try { + this.state = 1601; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 130, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1596; + this.match(MySqlParser.KW_ENABLE); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1597; + this.match(MySqlParser.KW_DISABLE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1598; + this.match(MySqlParser.KW_DISABLE); + this.state = 1599; + this.match(MySqlParser.KW_ON); + this.state = 1600; + this.match(MySqlParser.KW_SLAVE); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexType() { + let localContext = new IndexTypeContext(this.context, this.state); + this.enterRule(localContext, 70, MySqlParser.RULE_indexType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1603; + this.match(MySqlParser.KW_USING); + this.state = 1604; + _la = this.tokenStream.LA(1); + if (!(_la === 323 || _la === 418)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexOption() { + let localContext = new IndexOptionContext(this.context, this.state); + this.enterRule(localContext, 72, MySqlParser.RULE_indexOption); + let _la; + try { + this.state = 1628; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_KEY_BLOCK_SIZE: + this.enterOuterAlt(localContext, 1); + { + this.state = 1606; + this.match(MySqlParser.KW_KEY_BLOCK_SIZE); + this.state = 1608; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1607; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1610; + this.fileSizeLiteral(); + } + break; + case MySqlParser.KW_USING: + this.enterOuterAlt(localContext, 2); + { + this.state = 1611; + this.indexType(); + } + break; + case MySqlParser.KW_WITH: + this.enterOuterAlt(localContext, 3); + { + this.state = 1612; + this.match(MySqlParser.KW_WITH); + this.state = 1613; + this.match(MySqlParser.KW_PARSER); + this.state = 1614; + localContext._parserName = this.uid(); + } + break; + case MySqlParser.KW_COMMENT: + this.enterOuterAlt(localContext, 4); + { + this.state = 1615; + this.match(MySqlParser.KW_COMMENT); + this.state = 1616; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_VISIBLE: + this.enterOuterAlt(localContext, 5); + { + this.state = 1617; + _la = this.tokenStream.LA(1); + if (!(_la === 435 || _la === 686)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ENGINE_ATTRIBUTE: + this.enterOuterAlt(localContext, 6); + { + this.state = 1618; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 1620; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1619; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1622; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + this.enterOuterAlt(localContext, 7); + { + this.state = 1623; + this.match(MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE); + this.state = 1625; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1624; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1627; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + procedureParameter() { + let localContext = new ProcedureParameterContext(this.context, this.state); + this.enterRule(localContext, 74, MySqlParser.RULE_procedureParameter); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1631; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 80 || _la === 85 || _la === 126) { + { + this.state = 1630; + localContext._direction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 80 || _la === 85 || _la === 126)) { + localContext._direction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1633; + localContext._paramName = this.uid(); + this.state = 1634; + this.dataType(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + routineOption() { + let localContext = new RoutineOptionContext(this.context, this.state); + this.enterRule(localContext, 76, MySqlParser.RULE_routineOption); + let _la; + try { + this.state = 1659; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_COMMENT: + localContext = new RoutineCommentContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1636; + this.match(MySqlParser.KW_COMMENT); + this.state = 1637; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_LANGUAGE: + localContext = new RoutineLanguageContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1638; + this.match(MySqlParser.KW_LANGUAGE); + this.state = 1639; + this.match(MySqlParser.KW_SQL); + } + break; + case MySqlParser.KW_DETERMINISTIC: + case MySqlParser.KW_NOT: + localContext = new RoutineBehaviorContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1641; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 1640; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 1643; + this.match(MySqlParser.KW_DETERMINISTIC); + } + break; + case MySqlParser.KW_MODIFIES: + case MySqlParser.KW_READS: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_NO: + localContext = new RoutineDataContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 1654; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CONTAINS: + { + this.state = 1644; + this.match(MySqlParser.KW_CONTAINS); + this.state = 1645; + this.match(MySqlParser.KW_SQL); + } + break; + case MySqlParser.KW_NO: + { + this.state = 1646; + this.match(MySqlParser.KW_NO); + this.state = 1647; + this.match(MySqlParser.KW_SQL); + } + break; + case MySqlParser.KW_READS: + { + this.state = 1648; + this.match(MySqlParser.KW_READS); + this.state = 1649; + this.match(MySqlParser.KW_SQL); + this.state = 1650; + this.match(MySqlParser.KW_DATA); + } + break; + case MySqlParser.KW_MODIFIES: + { + this.state = 1651; + this.match(MySqlParser.KW_MODIFIES); + this.state = 1652; + this.match(MySqlParser.KW_SQL); + this.state = 1653; + this.match(MySqlParser.KW_DATA); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_SQL: + localContext = new RoutineSecurityContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 1656; + this.match(MySqlParser.KW_SQL); + this.state = 1657; + this.match(MySqlParser.KW_SECURITY); + this.state = 1658; + localContext._context = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 364 || _la === 436)) { + localContext._context = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + serverOption() { + let localContext = new ServerOptionContext(this.context, this.state); + this.enterRule(localContext, 78, MySqlParser.RULE_serverOption); + try { + this.state = 1675; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_HOST: + this.enterOuterAlt(localContext, 1); + { + this.state = 1661; + this.match(MySqlParser.KW_HOST); + this.state = 1662; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_DATABASE: + this.enterOuterAlt(localContext, 2); + { + this.state = 1663; + this.match(MySqlParser.KW_DATABASE); + this.state = 1664; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_USER: + this.enterOuterAlt(localContext, 3); + { + this.state = 1665; + this.match(MySqlParser.KW_USER); + this.state = 1666; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PASSWORD: + this.enterOuterAlt(localContext, 4); + { + this.state = 1667; + this.match(MySqlParser.KW_PASSWORD); + this.state = 1668; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_SOCKET: + this.enterOuterAlt(localContext, 5); + { + this.state = 1669; + this.match(MySqlParser.KW_SOCKET); + this.state = 1670; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_OWNER: + this.enterOuterAlt(localContext, 6); + { + this.state = 1671; + this.match(MySqlParser.KW_OWNER); + this.state = 1672; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PORT: + this.enterOuterAlt(localContext, 7); + { + this.state = 1673; + this.match(MySqlParser.KW_PORT); + this.state = 1674; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDefinitions() { + let localContext = new CreateDefinitionsContext(this.context, this.state); + this.enterRule(localContext, 80, MySqlParser.RULE_createDefinitions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1677; + this.match(MySqlParser.LR_BRACKET); + this.state = 1678; + this.createDefinition(); + this.state = 1683; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 1679; + this.match(MySqlParser.COMMA); + this.state = 1680; + this.createDefinition(); + } + } + this.state = 1685; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 1686; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createDefinition() { + let localContext = new CreateDefinitionContext(this.context, this.state); + this.enterRule(localContext, 82, MySqlParser.RULE_createDefinition); + let _la; + try { + this.state = 1771; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 157, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1688; + this.columnNameCreate(); + this.state = 1689; + this.columnDefinition(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1691; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1693; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1692; + this.indexName(); + } + } + this.state = 1696; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1695; + this.indexType(); + } + } + this.state = 1698; + this.indexColumnNames(); + this.state = 1702; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1699; + this.indexOption(); + } + } + this.state = 1704; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1705; + _la = this.tokenStream.LA(1); + if (!(_la === 69 || _la === 161)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1707; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 1706; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1710; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1709; + this.indexName(); + } + } + this.state = 1712; + this.indexColumnNames(); + this.state = 1716; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1713; + this.indexOption(); + } + } + this.state = 1718; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1720; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1719; + this.constraintSymbol(); + } + } + this.state = 1722; + this.match(MySqlParser.KW_PRIMARY); + this.state = 1723; + this.match(MySqlParser.KW_KEY); + this.state = 1725; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1724; + this.indexType(); + } + } + this.state = 1727; + this.indexColumnNames(); + this.state = 1731; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1728; + this.indexOption(); + } + } + this.state = 1733; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 1735; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1734; + this.constraintSymbol(); + } + } + this.state = 1737; + this.match(MySqlParser.KW_UNIQUE); + this.state = 1739; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 1738; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1742; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1741; + this.indexName(); + } + } + this.state = 1745; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 1744; + this.indexType(); + } + } + this.state = 1747; + this.indexColumnNames(); + this.state = 1751; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 188 || _la === 194 || _la === 340 || _la === 435 || _la === 443 || _la === 686 || _la === 825 || _la === 833) { + { + { + this.state = 1748; + this.indexOption(); + } + } + this.state = 1753; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 1755; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1754; + this.constraintSymbol(); + } + } + this.state = 1757; + this.match(MySqlParser.KW_FOREIGN); + this.state = 1758; + this.match(MySqlParser.KW_KEY); + this.state = 1760; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 1759; + this.indexName(); + } + } + this.state = 1762; + this.indexColumnNames(); + this.state = 1763; + this.referenceDefinition(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 1765; + this.match(MySqlParser.KW_CHECK); + this.state = 1766; + this.match(MySqlParser.LR_BRACKET); + this.state = 1767; + this.expression(0); + this.state = 1768; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 1770; + this.checkConstraintDefinition(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checkConstraintDefinition() { + let localContext = new CheckConstraintDefinitionContext(this.context, this.state); + this.enterRule(localContext, 84, MySqlParser.RULE_checkConstraintDefinition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1774; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 1773; + this.constraintSymbol(); + } + } + this.state = 1776; + this.match(MySqlParser.KW_CHECK); + this.state = 1777; + this.match(MySqlParser.LR_BRACKET); + this.state = 1778; + this.expression(0); + this.state = 1779; + this.match(MySqlParser.RR_BRACKET); + this.state = 1784; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 160, this.context)) { + case 1: + { + this.state = 1781; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 1780; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 1783; + this.match(MySqlParser.KW_ENFORCED); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + constraintSymbol() { + let localContext = new ConstraintSymbolContext(this.context, this.state); + this.enterRule(localContext, 86, MySqlParser.RULE_constraintSymbol); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1786; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 1788; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 161, this.context)) { + case 1: + { + this.state = 1787; + localContext._symbol_ = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnDefinition() { + let localContext = new ColumnDefinitionContext(this.context, this.state); + this.enterRule(localContext, 88, MySqlParser.RULE_columnDefinition); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 1790; + this.dataType(); + this.state = 1794; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 162, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 1791; + this.columnConstraint(); + } + } + } + this.state = 1796; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 162, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnConstraint() { + let localContext = new ColumnConstraintContext(this.context, this.state); + this.enterRule(localContext, 90, MySqlParser.RULE_columnConstraint); + let _la; + try { + this.state = 1840; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NOT: + case MySqlParser.KW_NULL_LITERAL: + case MySqlParser.NULL_SPEC_LITERAL: + localContext = new NullColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1797; + this.nullNotnull(); + } + break; + case MySqlParser.KW_DEFAULT: + localContext = new DefaultColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1798; + this.match(MySqlParser.KW_DEFAULT); + this.state = 1799; + this.defaultValue(); + } + break; + case MySqlParser.KW_VISIBLE: + localContext = new VisibilityColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1800; + this.match(MySqlParser.KW_VISIBLE); + } + break; + case MySqlParser.KW_INVISIBLE: + localContext = new InvisibilityColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 1801; + this.match(MySqlParser.KW_INVISIBLE); + } + break; + case MySqlParser.KW_ON: + case MySqlParser.KW_AUTO_INCREMENT: + localContext = new AutoIncrementColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 1806; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AUTO_INCREMENT: + { + this.state = 1802; + this.match(MySqlParser.KW_AUTO_INCREMENT); + } + break; + case MySqlParser.KW_ON: + { + this.state = 1803; + this.match(MySqlParser.KW_ON); + this.state = 1804; + this.match(MySqlParser.KW_UPDATE); + this.state = 1805; + this.currentTimestamp(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_KEY: + case MySqlParser.KW_PRIMARY: + localContext = new PrimaryKeyColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 1809; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 131) { + { + this.state = 1808; + this.match(MySqlParser.KW_PRIMARY); + } + } + this.state = 1811; + this.match(MySqlParser.KW_KEY); + } + break; + case MySqlParser.KW_UNIQUE: + localContext = new UniqueKeyColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 1812; + this.match(MySqlParser.KW_UNIQUE); + this.state = 1814; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 165, this.context)) { + case 1: + { + this.state = 1813; + this.match(MySqlParser.KW_KEY); + } + break; + } + } + break; + case MySqlParser.KW_COMMENT: + localContext = new CommentColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 1816; + this.match(MySqlParser.KW_COMMENT); + this.state = 1817; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_COLUMN_FORMAT: + localContext = new FormatColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 1818; + this.match(MySqlParser.KW_COLUMN_FORMAT); + this.state = 1819; + localContext._colformat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 374 || _la === 403)) { + localContext._colformat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_STORAGE: + localContext = new StorageColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 1820; + this.match(MySqlParser.KW_STORAGE); + this.state = 1821; + localContext._storageval = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 370 || _la === 802)) { + localContext._storageval = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_REFERENCES: + localContext = new ReferenceColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 1822; + this.referenceDefinition(); + } + break; + case MySqlParser.KW_COLLATE: + localContext = new CollateColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 1823; + this.match(MySqlParser.KW_COLLATE); + this.state = 1824; + this.collationName(); + } + break; + case MySqlParser.KW_AS: + case MySqlParser.KW_GENERATED: + localContext = new GeneratedColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 1827; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 71) { + { + this.state = 1825; + this.match(MySqlParser.KW_GENERATED); + this.state = 1826; + this.match(MySqlParser.KW_ALWAYS); + } + } + this.state = 1829; + this.match(MySqlParser.KW_AS); + this.state = 1830; + this.match(MySqlParser.LR_BRACKET); + this.state = 1831; + this.expression(0); + this.state = 1832; + this.match(MySqlParser.RR_BRACKET); + this.state = 1834; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 648 || _la === 685) { + { + this.state = 1833; + _la = this.tokenStream.LA(1); + if (!(_la === 648 || _la === 685)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + break; + case MySqlParser.KW_SERIAL: + localContext = new SerialDefaultColumnConstraintContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 1836; + this.match(MySqlParser.KW_SERIAL); + this.state = 1837; + this.match(MySqlParser.KW_DEFAULT); + this.state = 1838; + this.match(MySqlParser.KW_VALUE); + } + break; + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CONSTRAINT: + localContext = new CheckExprContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 1839; + this.checkConstraintDefinition(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + referenceDefinition() { + let localContext = new ReferenceDefinitionContext(this.context, this.state); + this.enterRule(localContext, 92, MySqlParser.RULE_referenceDefinition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 1842; + this.match(MySqlParser.KW_REFERENCES); + this.state = 1843; + this.tableName(); + this.state = 1845; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 169, this.context)) { + case 1: + { + this.state = 1844; + this.indexColumnNames(); + } + break; + } + this.state = 1849; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 110) { + { + this.state = 1847; + this.match(MySqlParser.KW_MATCH); + this.state = 1848; + localContext._matchType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 408 || _la === 526 || _la === 597)) { + localContext._matchType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 1852; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 171, this.context)) { + case 1: + { + this.state = 1851; + this.referenceAction(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + referenceAction() { + let localContext = new ReferenceActionContext(this.context, this.state); + this.enterRule(localContext, 94, MySqlParser.RULE_referenceAction); + try { + this.state = 1870; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 174, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1854; + this.match(MySqlParser.KW_ON); + this.state = 1855; + this.match(MySqlParser.KW_DELETE); + this.state = 1856; + localContext._onDelete = this.referenceControlType(); + this.state = 1860; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 172, this.context)) { + case 1: + { + this.state = 1857; + this.match(MySqlParser.KW_ON); + this.state = 1858; + this.match(MySqlParser.KW_UPDATE); + this.state = 1859; + localContext._onUpdate = this.referenceControlType(); + } + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1862; + this.match(MySqlParser.KW_ON); + this.state = 1863; + this.match(MySqlParser.KW_UPDATE); + this.state = 1864; + localContext._onUpdate = this.referenceControlType(); + this.state = 1868; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 173, this.context)) { + case 1: + { + this.state = 1865; + this.match(MySqlParser.KW_ON); + this.state = 1866; + this.match(MySqlParser.KW_DELETE); + this.state = 1867; + localContext._onDelete = this.referenceControlType(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + referenceControlType() { + let localContext = new ReferenceControlTypeContext(this.context, this.state); + this.enterRule(localContext, 96, MySqlParser.RULE_referenceControlType); + try { + this.state = 1880; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 175, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 1872; + this.match(MySqlParser.KW_RESTRICT); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 1873; + this.match(MySqlParser.KW_CASCADE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 1874; + this.match(MySqlParser.KW_SET); + this.state = 1875; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 1876; + this.match(MySqlParser.KW_NO); + this.state = 1877; + this.match(MySqlParser.KW_ACTION); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 1878; + this.match(MySqlParser.KW_SET); + this.state = 1879; + this.match(MySqlParser.KW_DEFAULT); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableOption() { + let localContext = new TableOptionContext(this.context, this.state); + this.enterRule(localContext, 98, MySqlParser.RULE_tableOption); + let _la; + try { + this.state = 2067; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 213, this.context)) { + case 1: + localContext = new TableOptionEngineContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 1882; + this.match(MySqlParser.KW_ENGINE); + this.state = 1884; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1883; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1887; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 177, this.context)) { + case 1: + { + this.state = 1886; + this.engineName(); + } + break; + } + } + break; + case 2: + localContext = new TableOptionEngineAttributeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 1889; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 1891; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1890; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1893; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 3: + localContext = new TableOptionAutoextendSizeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 1894; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 1896; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1895; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1898; + this.decimalLiteral(); + } + break; + case 4: + localContext = new TableOptionAutoIncrementContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 1899; + this.match(MySqlParser.KW_AUTO_INCREMENT); + this.state = 1901; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1900; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1903; + this.decimalLiteral(); + } + break; + case 5: + localContext = new TableOptionAverageContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 1904; + this.match(MySqlParser.KW_AVG_ROW_LENGTH); + this.state = 1906; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1905; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1908; + this.decimalLiteral(); + } + break; + case 6: + localContext = new TableOptionCharsetContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 1910; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1909; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1912; + this.charSet(); + this.state = 1914; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1913; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1918; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 1916; + this.charsetName(); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 1917; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 7: + localContext = new TableOptionChecksumContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 1920; + _la = this.tokenStream.LA(1); + if (!(_la === 329 || _la === 522)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1922; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1921; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1924; + localContext._boolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 8: + localContext = new TableOptionCollateContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 1926; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 1925; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 1928; + this.match(MySqlParser.KW_COLLATE); + this.state = 1930; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1929; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1932; + this.collationName(); + } + break; + case 9: + localContext = new TableOptionCommentContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 1933; + this.match(MySqlParser.KW_COMMENT); + this.state = 1935; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1934; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1937; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 10: + localContext = new TableOptionCompressionContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 1938; + this.match(MySqlParser.KW_COMPRESSION); + this.state = 1940; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1939; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1942; + _la = this.tokenStream.LA(1); + if (!(_la === 882 || _la === 889)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 11: + localContext = new TableOptionConnectionContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 1943; + this.match(MySqlParser.KW_CONNECTION); + this.state = 1945; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1944; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1947; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 12: + localContext = new TableOptionDataDirectoryContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 1948; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 360)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1949; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 1951; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1950; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1953; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 13: + localContext = new TableOptionDelayContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 1954; + this.match(MySqlParser.KW_DELAY_KEY_WRITE); + this.state = 1956; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1955; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1958; + localContext._boolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 14: + localContext = new TableOptionEncryptionContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 1959; + this.match(MySqlParser.KW_ENCRYPTION); + this.state = 1961; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1960; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1963; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 15: + localContext = new TableOptionPageCompressedContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 1964; + _la = this.tokenStream.LA(1); + if (!(_la === 523 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1966; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1965; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1968; + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 16: + localContext = new TableOptionPageCompressionLevelContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 1969; + _la = this.tokenStream.LA(1); + if (!(_la === 524 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 1971; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1970; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1973; + this.decimalLiteral(); + } + break; + case 17: + localContext = new TableOptionEncryptionKeyIdContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 1974; + this.match(MySqlParser.KW_ENCRYPTION_KEY_ID); + this.state = 1976; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1975; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1978; + this.decimalLiteral(); + } + break; + case 18: + localContext = new TableOptionIndexDirectoryContext(localContext); + this.enterOuterAlt(localContext, 18); + { + this.state = 1979; + this.match(MySqlParser.KW_INDEX); + this.state = 1980; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 1982; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1981; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1984; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 19: + localContext = new TableOptionInsertMethodContext(localContext); + this.enterOuterAlt(localContext, 19); + { + this.state = 1985; + this.match(MySqlParser.KW_INSERT_METHOD); + this.state = 1987; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1986; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1989; + localContext._insertMethod = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 402 || _la === 445 || _la === 502)) { + localContext._insertMethod = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 20: + localContext = new TableOptionKeyBlockSizeContext(localContext); + this.enterOuterAlt(localContext, 20); + { + this.state = 1990; + this.match(MySqlParser.KW_KEY_BLOCK_SIZE); + this.state = 1992; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1991; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1994; + this.fileSizeLiteral(); + } + break; + case 21: + localContext = new TableOptionMaxRowsContext(localContext); + this.enterOuterAlt(localContext, 21); + { + this.state = 1995; + this.match(MySqlParser.KW_MAX_ROWS); + this.state = 1997; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 1996; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 1999; + this.decimalLiteral(); + } + break; + case 22: + localContext = new TableOptionMinRowsContext(localContext); + this.enterOuterAlt(localContext, 22); + { + this.state = 2000; + this.match(MySqlParser.KW_MIN_ROWS); + this.state = 2002; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2001; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2004; + this.decimalLiteral(); + } + break; + case 23: + localContext = new TableOptionPackKeysContext(localContext); + this.enterOuterAlt(localContext, 23); + { + this.state = 2005; + this.match(MySqlParser.KW_PACK_KEYS); + this.state = 2007; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2006; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2009; + localContext._extBoolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + localContext._extBoolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 24: + localContext = new TableOptionPasswordContext(localContext); + this.enterOuterAlt(localContext, 24); + { + this.state = 2010; + this.match(MySqlParser.KW_PASSWORD); + this.state = 2012; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2011; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2014; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 25: + localContext = new TableOptionRowFormatContext(localContext); + this.enterOuterAlt(localContext, 25); + { + this.state = 2015; + this.match(MySqlParser.KW_ROW_FORMAT); + this.state = 2017; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2016; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2019; + localContext._rowFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 342 || _la === 345 || _la === 374 || _la === 403 || _la === 554 || _la === 889)) { + localContext._rowFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 26: + localContext = new TableOptionStartTransactionContext(localContext); + this.enterOuterAlt(localContext, 26); + { + this.state = 2020; + this.match(MySqlParser.KW_START); + this.state = 2021; + this.match(MySqlParser.KW_TRANSACTION); + } + break; + case 27: + localContext = new TableOptionSecondaryEngineAttributeContext(localContext); + this.enterOuterAlt(localContext, 27); + { + this.state = 2022; + this.match(MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE); + this.state = 2024; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2023; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2026; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 28: + localContext = new TableOptionRecalculationContext(localContext); + this.enterOuterAlt(localContext, 28); + { + this.state = 2027; + this.match(MySqlParser.KW_STATS_AUTO_RECALC); + this.state = 2029; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2028; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2031; + localContext._extBoolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + localContext._extBoolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 29: + localContext = new TableOptionPersistentContext(localContext); + this.enterOuterAlt(localContext, 29); + { + this.state = 2032; + this.match(MySqlParser.KW_STATS_PERSISTENT); + this.state = 2034; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2033; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2036; + localContext._extBoolValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 871 || _la === 872)) { + localContext._extBoolValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 30: + localContext = new TableOptionSamplePageContext(localContext); + this.enterOuterAlt(localContext, 30); + { + this.state = 2037; + this.match(MySqlParser.KW_STATS_SAMPLE_PAGES); + this.state = 2039; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2038; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2043; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 2041; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 2042; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 31: + localContext = new TableOptionTablespaceContext(localContext); + this.enterOuterAlt(localContext, 31); + { + this.state = 2045; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 2046; + this.tablespaceName(); + this.state = 2048; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 210, this.context)) { + case 1: + { + this.state = 2047; + this.tablespaceStorage(); + } + break; + } + } + break; + case 32: + localContext = new TableOptionTableTypeContext(localContext); + this.enterOuterAlt(localContext, 32); + { + this.state = 2050; + this.match(MySqlParser.KW_TABLE_TYPE); + this.state = 2051; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2052; + this.tableType(); + } + break; + case 33: + localContext = new TableOptionTablespaceContext(localContext); + this.enterOuterAlt(localContext, 33); + { + this.state = 2053; + this.tablespaceStorage(); + } + break; + case 34: + localContext = new TableOptionTransactionalContext(localContext); + this.enterOuterAlt(localContext, 34); + { + this.state = 2054; + this.match(MySqlParser.KW_TRANSACTIONAL); + this.state = 2056; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2055; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2058; + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 35: + localContext = new TableOptionUnionContext(localContext); + this.enterOuterAlt(localContext, 35); + { + this.state = 2059; + this.match(MySqlParser.KW_UNION); + this.state = 2061; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2060; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2063; + this.match(MySqlParser.LR_BRACKET); + this.state = 2064; + this.tableNames(); + this.state = 2065; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableType() { + let localContext = new TableTypeContext(this.context, this.state); + this.enterRule(localContext, 100, MySqlParser.RULE_tableType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2069; + _la = this.tokenStream.LA(1); + if (!(_la === 494 || _la === 506)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablespaceStorage() { + let localContext = new TablespaceStorageContext(this.context, this.state); + this.enterRule(localContext, 102, MySqlParser.RULE_tablespaceStorage); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2071; + this.match(MySqlParser.KW_STORAGE); + this.state = 2072; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 370 || _la === 802)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinitions() { + let localContext = new PartitionDefinitionsContext(this.context, this.state); + this.enterRule(localContext, 104, MySqlParser.RULE_partitionDefinitions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2074; + this.match(MySqlParser.KW_PARTITION); + this.state = 2075; + this.match(MySqlParser.KW_BY); + this.state = 2076; + this.partitionFunctionDefinition(); + this.state = 2079; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 528) { + { + this.state = 2077; + this.match(MySqlParser.KW_PARTITIONS); + this.state = 2078; + localContext._count = this.decimalLiteral(); + } + } + this.state = 2088; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 652) { + { + this.state = 2081; + this.match(MySqlParser.KW_SUBPARTITION); + this.state = 2082; + this.match(MySqlParser.KW_BY); + this.state = 2083; + this.subpartitionFunctionDefinition(); + this.state = 2086; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 653) { + { + this.state = 2084; + this.match(MySqlParser.KW_SUBPARTITIONS); + this.state = 2085; + localContext._subCount = this.decimalLiteral(); + } + } + } + } + this.state = 2101; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 218, this.context)) { + case 1: + { + this.state = 2090; + this.match(MySqlParser.LR_BRACKET); + this.state = 2091; + this.partitionDefinition(); + this.state = 2096; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2092; + this.match(MySqlParser.COMMA); + this.state = 2093; + this.partitionDefinition(); + } + } + this.state = 2098; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2099; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionFunctionDefinition() { + let localContext = new PartitionFunctionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 106, MySqlParser.RULE_partitionFunctionDefinition); + let _la; + try { + this.state = 2149; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 225, this.context)) { + case 1: + localContext = new PartitionFunctionHashContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2104; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2103; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2106; + this.match(MySqlParser.KW_HASH); + this.state = 2107; + this.match(MySqlParser.LR_BRACKET); + this.state = 2108; + this.expression(0); + this.state = 2109; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + localContext = new PartitionFunctionKeyContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2112; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2111; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2114; + this.match(MySqlParser.KW_KEY); + this.state = 2118; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 2115; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2116; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2117; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 872 || _la === 873)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2120; + this.match(MySqlParser.LR_BRACKET); + this.state = 2122; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 222, this.context)) { + case 1: + { + this.state = 2121; + this.columnNames(); + } + break; + } + this.state = 2124; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 3: + localContext = new PartitionFunctionRangeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2125; + this.match(MySqlParser.KW_RANGE); + this.state = 2135; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LR_BRACKET: + { + this.state = 2126; + this.match(MySqlParser.LR_BRACKET); + this.state = 2127; + this.expression(0); + this.state = 2128; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_COLUMNS: + { + this.state = 2130; + this.match(MySqlParser.KW_COLUMNS); + this.state = 2131; + this.match(MySqlParser.LR_BRACKET); + this.state = 2132; + this.columnNames(); + this.state = 2133; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 4: + localContext = new PartitionFunctionListContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2137; + this.match(MySqlParser.KW_LIST); + this.state = 2147; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LR_BRACKET: + { + this.state = 2138; + this.match(MySqlParser.LR_BRACKET); + this.state = 2139; + this.expression(0); + this.state = 2140; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_COLUMNS: + { + this.state = 2142; + this.match(MySqlParser.KW_COLUMNS); + this.state = 2143; + this.match(MySqlParser.LR_BRACKET); + this.state = 2144; + this.columnNames(); + this.state = 2145; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + subpartitionFunctionDefinition() { + let localContext = new SubpartitionFunctionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 108, MySqlParser.RULE_subpartitionFunctionDefinition); + let _la; + try { + this.state = 2172; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 229, this.context)) { + case 1: + localContext = new SubPartitionFunctionHashContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2152; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2151; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2154; + this.match(MySqlParser.KW_HASH); + this.state = 2155; + this.match(MySqlParser.LR_BRACKET); + this.state = 2156; + this.expression(0); + this.state = 2157; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + localContext = new SubPartitionFunctionKeyContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2160; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 101) { + { + this.state = 2159; + this.match(MySqlParser.KW_LINEAR); + } + } + this.state = 2162; + this.match(MySqlParser.KW_KEY); + this.state = 2166; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 2163; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2164; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2165; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 872 || _la === 873)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2168; + this.match(MySqlParser.LR_BRACKET); + this.state = 2169; + this.columnNames(); + this.state = 2170; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinition() { + let localContext = new PartitionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 110, MySqlParser.RULE_partitionDefinition); + let _la; + try { + this.state = 2320; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 248, this.context)) { + case 1: + localContext = new PartitionComparisonContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2174; + this.match(MySqlParser.KW_PARTITION); + this.state = 2175; + this.partitionName(); + this.state = 2176; + this.match(MySqlParser.KW_VALUES); + this.state = 2177; + this.match(MySqlParser.KW_LESS); + this.state = 2178; + this.match(MySqlParser.KW_THAN); + this.state = 2179; + this.match(MySqlParser.LR_BRACKET); + this.state = 2180; + this.partitionDefinerAtom(); + this.state = 2185; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2181; + this.match(MySqlParser.COMMA); + this.state = 2182; + this.partitionDefinerAtom(); + } + } + this.state = 2187; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2188; + this.match(MySqlParser.RR_BRACKET); + this.state = 2192; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2189; + this.partitionOption(); + } + } + this.state = 2194; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2206; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2195; + this.match(MySqlParser.LR_BRACKET); + this.state = 2196; + this.subpartitionDefinition(); + this.state = 2201; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2197; + this.match(MySqlParser.COMMA); + this.state = 2198; + this.subpartitionDefinition(); + } + } + this.state = 2203; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2204; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 2: + localContext = new PartitionComparisonContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2208; + this.match(MySqlParser.KW_PARTITION); + this.state = 2209; + this.partitionName(); + this.state = 2210; + this.match(MySqlParser.KW_VALUES); + this.state = 2211; + this.match(MySqlParser.KW_LESS); + this.state = 2212; + this.match(MySqlParser.KW_THAN); + this.state = 2213; + this.partitionDefinerAtom(); + this.state = 2217; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2214; + this.partitionOption(); + } + } + this.state = 2219; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2231; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2220; + this.match(MySqlParser.LR_BRACKET); + this.state = 2221; + this.subpartitionDefinition(); + this.state = 2226; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2222; + this.match(MySqlParser.COMMA); + this.state = 2223; + this.subpartitionDefinition(); + } + } + this.state = 2228; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2229; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 3: + localContext = new PartitionListAtomContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2233; + this.match(MySqlParser.KW_PARTITION); + this.state = 2234; + this.partitionName(); + this.state = 2235; + this.match(MySqlParser.KW_VALUES); + this.state = 2236; + this.match(MySqlParser.KW_IN); + this.state = 2237; + this.match(MySqlParser.LR_BRACKET); + this.state = 2238; + this.partitionDefinerAtom(); + this.state = 2243; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2239; + this.match(MySqlParser.COMMA); + this.state = 2240; + this.partitionDefinerAtom(); + } + } + this.state = 2245; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2246; + this.match(MySqlParser.RR_BRACKET); + this.state = 2250; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2247; + this.partitionOption(); + } + } + this.state = 2252; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2264; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2253; + this.match(MySqlParser.LR_BRACKET); + this.state = 2254; + this.subpartitionDefinition(); + this.state = 2259; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2255; + this.match(MySqlParser.COMMA); + this.state = 2256; + this.subpartitionDefinition(); + } + } + this.state = 2261; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2262; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 4: + localContext = new PartitionListVectorContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2266; + this.match(MySqlParser.KW_PARTITION); + this.state = 2267; + this.partitionName(); + this.state = 2268; + this.match(MySqlParser.KW_VALUES); + this.state = 2269; + this.match(MySqlParser.KW_IN); + this.state = 2270; + this.match(MySqlParser.LR_BRACKET); + this.state = 2271; + this.partitionDefinerVector(); + this.state = 2276; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2272; + this.match(MySqlParser.COMMA); + this.state = 2273; + this.partitionDefinerVector(); + } + } + this.state = 2278; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2279; + this.match(MySqlParser.RR_BRACKET); + this.state = 2283; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2280; + this.partitionOption(); + } + } + this.state = 2285; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2286; + this.match(MySqlParser.LR_BRACKET); + this.state = 2287; + this.subpartitionDefinition(); + this.state = 2292; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2288; + this.match(MySqlParser.COMMA); + this.state = 2289; + this.subpartitionDefinition(); + } + } + this.state = 2294; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2295; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + case 5: + localContext = new PartitionSimpleContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2299; + this.match(MySqlParser.KW_PARTITION); + this.state = 2300; + this.partitionName(); + this.state = 2304; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2301; + this.partitionOption(); + } + } + this.state = 2306; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2318; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2307; + this.match(MySqlParser.LR_BRACKET); + this.state = 2308; + this.subpartitionDefinition(); + this.state = 2313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2309; + this.match(MySqlParser.COMMA); + this.state = 2310; + this.subpartitionDefinition(); + } + } + this.state = 2315; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2316; + this.match(MySqlParser.RR_BRACKET); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinerAtom() { + let localContext = new PartitionDefinerAtomContext(this.context, this.state); + this.enterRule(localContext, 112, MySqlParser.RULE_partitionDefinerAtom); + try { + this.state = 2325; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 249, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 2322; + this.constant(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 2323; + this.expression(0); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 2324; + this.match(MySqlParser.KW_MAXVALUE); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionDefinerVector() { + let localContext = new PartitionDefinerVectorContext(this.context, this.state); + this.enterRule(localContext, 114, MySqlParser.RULE_partitionDefinerVector); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2327; + this.match(MySqlParser.LR_BRACKET); + this.state = 2328; + this.partitionDefinerAtom(); + this.state = 2331; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 2329; + this.match(MySqlParser.COMMA); + this.state = 2330; + this.partitionDefinerAtom(); + } + } + this.state = 2333; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 868); + this.state = 2335; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + subpartitionDefinition() { + let localContext = new SubpartitionDefinitionContext(this.context, this.state); + this.enterRule(localContext, 116, MySqlParser.RULE_subpartitionDefinition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2337; + this.match(MySqlParser.KW_SUBPARTITION); + this.state = 2338; + localContext._logicalName = this.uid(); + this.state = 2342; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 42 || _la === 82 || _la === 340 || _la === 360 || _la === 380 || ((((_la - 480)) & ~0x1F) === 0 && ((1 << (_la - 480)) & 16778241) !== 0) || _la === 647 || _la === 658) { + { + { + this.state = 2339; + this.partitionOption(); + } + } + this.state = 2344; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionOption() { + let localContext = new PartitionOptionContext(this.context, this.state); + this.enterRule(localContext, 118, MySqlParser.RULE_partitionOption); + let _la; + try { + this.state = 2393; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_STORAGE: + localContext = new PartitionOptionEngineContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2346; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 2345; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 2349; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 647) { + { + this.state = 2348; + this.match(MySqlParser.KW_STORAGE); + } + } + this.state = 2351; + this.match(MySqlParser.KW_ENGINE); + this.state = 2353; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2352; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2355; + this.engineName(); + } + break; + case MySqlParser.KW_COMMENT: + localContext = new PartitionOptionCommentContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2356; + this.match(MySqlParser.KW_COMMENT); + this.state = 2358; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2357; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2360; + localContext._comment = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_DATA: + localContext = new PartitionOptionDataDirectoryContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2361; + this.match(MySqlParser.KW_DATA); + this.state = 2362; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 2364; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2363; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2366; + localContext._dataDirectory = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_INDEX: + localContext = new PartitionOptionIndexDirectoryContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2367; + this.match(MySqlParser.KW_INDEX); + this.state = 2368; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 2370; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2369; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2372; + localContext._indexDirectory = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_MAX_ROWS: + localContext = new PartitionOptionMaxRowsContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2373; + this.match(MySqlParser.KW_MAX_ROWS); + this.state = 2375; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2374; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2377; + localContext._maxRows = this.decimalLiteral(); + } + break; + case MySqlParser.KW_MIN_ROWS: + localContext = new PartitionOptionMinRowsContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 2378; + this.match(MySqlParser.KW_MIN_ROWS); + this.state = 2380; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2379; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2382; + localContext._minRows = this.decimalLiteral(); + } + break; + case MySqlParser.KW_TABLESPACE: + localContext = new PartitionOptionTablespaceContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 2383; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 2385; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2384; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2387; + this.tablespaceName(); + } + break; + case MySqlParser.KW_NODEGROUP: + localContext = new PartitionOptionNodeGroupContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 2388; + this.match(MySqlParser.KW_NODEGROUP); + this.state = 2390; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2389; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2392; + localContext._nodegroup = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterDatabase() { + let localContext = new AlterDatabaseContext(this.context, this.state); + this.enterRule(localContext, 120, MySqlParser.RULE_alterDatabase); + let _la; + try { + this.state = 2413; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 265, this.context)) { + case 1: + localContext = new AlterSimpleDatabaseContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2395; + this.match(MySqlParser.KW_ALTER); + this.state = 2396; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2398; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 263, this.context)) { + case 1: + { + this.state = 2397; + this.databaseName(); + } + break; + } + this.state = 2401; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 2400; + this.createDatabaseOption(); + } + } + this.state = 2403; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (((((_la - 26)) & ~0x1F) === 0 && ((1 << (_la - 26)) & 65541) !== 0) || _la === 135 || _la === 224 || _la === 376 || _la === 823); + } + break; + case 2: + localContext = new AlterUpgradeNameContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2405; + this.match(MySqlParser.KW_ALTER); + this.state = 2406; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2407; + this.databaseName(); + this.state = 2408; + this.match(MySqlParser.KW_UPGRADE); + this.state = 2409; + this.match(MySqlParser.KW_DATA); + this.state = 2410; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 2411; + this.match(MySqlParser.KW_NAME); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterEvent() { + let localContext = new AlterEventContext(this.context, this.state); + this.enterRule(localContext, 122, MySqlParser.RULE_alterEvent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2415; + this.match(MySqlParser.KW_ALTER); + this.state = 2417; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 2416; + this.ownerStatement(); + } + } + this.state = 2419; + this.match(MySqlParser.KW_EVENT); + this.state = 2420; + localContext._event_name = this.fullId(); + this.state = 2424; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 267, this.context)) { + case 1: + { + this.state = 2421; + this.match(MySqlParser.KW_ON); + this.state = 2422; + this.match(MySqlParser.KW_SCHEDULE); + this.state = 2423; + this.scheduleExpression(); + } + break; + } + this.state = 2432; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 119) { + { + this.state = 2426; + this.match(MySqlParser.KW_ON); + this.state = 2427; + this.match(MySqlParser.KW_COMPLETION); + this.state = 2429; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 2428; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 2431; + this.match(MySqlParser.KW_PRESERVE); + } + } + this.state = 2437; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 270, this.context)) { + case 1: + { + this.state = 2434; + this.match(MySqlParser.KW_RENAME); + this.state = 2435; + this.match(MySqlParser.KW_TO); + this.state = 2436; + localContext._new_event_name = this.fullId(); + } + break; + } + this.state = 2440; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 2439; + this.enableType(); + } + } + this.state = 2444; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 340) { + { + this.state = 2442; + this.match(MySqlParser.KW_COMMENT); + this.state = 2443; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 2448; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 273, this.context)) { + case 1: + { + this.state = 2446; + this.match(MySqlParser.KW_DO); + this.state = 2447; + this.routineBody(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterFunction() { + let localContext = new AlterFunctionContext(this.context, this.state); + this.enterRule(localContext, 124, MySqlParser.RULE_alterFunction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2450; + this.match(MySqlParser.KW_ALTER); + this.state = 2451; + this.match(MySqlParser.KW_FUNCTION); + this.state = 2452; + this.functionName(); + this.state = 2456; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 47 || ((((_la - 112)) & ~0x1F) === 0 && ((1 << (_la - 112)) & 16777221) !== 0) || _la === 162 || _la === 340 || _la === 354 || _la === 444 || _la === 502) { + { + { + this.state = 2453; + this.routineOption(); + } + } + this.state = 2458; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterInstance() { + let localContext = new AlterInstanceContext(this.context, this.state); + this.enterRule(localContext, 126, MySqlParser.RULE_alterInstance); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2459; + this.match(MySqlParser.KW_ALTER); + this.state = 2460; + this.match(MySqlParser.KW_INSTANCE); + this.state = 2461; + this.match(MySqlParser.KW_ROTATE); + this.state = 2462; + this.match(MySqlParser.KW_INNODB); + this.state = 2463; + this.match(MySqlParser.KW_MASTER); + this.state = 2464; + this.match(MySqlParser.KW_KEY); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterLogfileGroup() { + let localContext = new AlterLogfileGroupContext(this.context, this.state); + this.enterRule(localContext, 128, MySqlParser.RULE_alterLogfileGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2466; + this.match(MySqlParser.KW_ALTER); + this.state = 2467; + this.match(MySqlParser.KW_LOGFILE); + this.state = 2468; + this.match(MySqlParser.KW_GROUP); + this.state = 2469; + localContext._logfileGroupName = this.uid(); + this.state = 2470; + this.match(MySqlParser.KW_ADD); + this.state = 2471; + this.match(MySqlParser.KW_UNDOFILE); + this.state = 2472; + this.match(MySqlParser.STRING_LITERAL); + this.state = 2478; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 2473; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 2475; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2474; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2477; + this.fileSizeLiteral(); + } + } + this.state = 2481; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 2480; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 2483; + this.match(MySqlParser.KW_ENGINE); + this.state = 2485; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2484; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2487; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterProcedure() { + let localContext = new AlterProcedureContext(this.context, this.state); + this.enterRule(localContext, 130, MySqlParser.RULE_alterProcedure); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2489; + this.match(MySqlParser.KW_ALTER); + this.state = 2490; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 2491; + localContext._proc_name = this.fullId(); + this.state = 2495; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 47 || ((((_la - 112)) & ~0x1F) === 0 && ((1 << (_la - 112)) & 16777221) !== 0) || _la === 162 || _la === 340 || _la === 354 || _la === 444 || _la === 502) { + { + { + this.state = 2492; + this.routineOption(); + } + } + this.state = 2497; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterServer() { + let localContext = new AlterServerContext(this.context, this.state); + this.enterRule(localContext, 132, MySqlParser.RULE_alterServer); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2498; + this.match(MySqlParser.KW_ALTER); + this.state = 2499; + this.match(MySqlParser.KW_SERVER); + this.state = 2500; + localContext._serverName = this.uid(); + this.state = 2501; + this.match(MySqlParser.KW_OPTIONS); + this.state = 2502; + this.match(MySqlParser.LR_BRACKET); + this.state = 2503; + this.serverOption(); + this.state = 2508; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2504; + this.match(MySqlParser.COMMA); + this.state = 2505; + this.serverOption(); + } + } + this.state = 2510; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2511; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterTable() { + let localContext = new AlterTableContext(this.context, this.state); + this.enterRule(localContext, 134, MySqlParser.RULE_alterTable); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 2513; + this.match(MySqlParser.KW_ALTER); + this.state = 2514; + this.match(MySqlParser.KW_TABLE); + this.state = 2515; + this.tableName(); + this.state = 2524; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 282, this.context)) { + case 1: + { + this.state = 2516; + this.alterOption(); + this.state = 2521; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2517; + this.match(MySqlParser.COMMA); + this.state = 2518; + this.alterOption(); + } + } + this.state = 2523; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + this.state = 2533; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 284, this.context)) { + case 1: + { + this.state = 2526; + this.alterPartitionSpecification(); + this.state = 2530; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 283, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2527; + this.alterPartitionSpecification(); + } + } + } + this.state = 2532; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 283, this.context); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterTablespace() { + let localContext = new AlterTablespaceContext(this.context, this.state); + this.enterRule(localContext, 136, MySqlParser.RULE_alterTablespace); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2535; + this.match(MySqlParser.KW_ALTER); + this.state = 2537; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 2536; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 2539; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 2540; + this.tablespaceName(); + this.state = 2541; + _la = this.tokenStream.LA(1); + if (!(_la === 6 || _la === 51)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2542; + this.match(MySqlParser.KW_DATAFILE); + this.state = 2543; + this.match(MySqlParser.STRING_LITERAL); + this.state = 2549; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 428) { + { + this.state = 2544; + this.match(MySqlParser.KW_INITIAL_SIZE); + this.state = 2546; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2545; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2548; + this.fileSizeLiteral(); + } + } + this.state = 2552; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 687) { + { + this.state = 2551; + this.match(MySqlParser.KW_WAIT); + } + } + this.state = 2557; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 289, this.context)) { + case 1: + { + this.state = 2554; + this.match(MySqlParser.KW_RENAME); + this.state = 2555; + this.match(MySqlParser.KW_TO); + this.state = 2556; + this.tablespaceNameCreate(); + } + break; + } + this.state = 2564; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 314) { + { + this.state = 2559; + this.match(MySqlParser.KW_AUTOEXTEND_SIZE); + this.state = 2561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2560; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2563; + this.fileSizeLiteral(); + } + } + this.state = 2568; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 292, this.context)) { + case 1: + { + this.state = 2566; + this.match(MySqlParser.KW_SET); + this.state = 2567; + _la = this.tokenStream.LA(1); + if (!(_la === 5 || _la === 81)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 2575; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 376) { + { + this.state = 2570; + this.match(MySqlParser.KW_ENCRYPTION); + this.state = 2572; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2571; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2574; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 2582; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 380) { + { + this.state = 2577; + this.match(MySqlParser.KW_ENGINE); + this.state = 2579; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2578; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2581; + this.engineName(); + } + } + this.state = 2589; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 825) { + { + this.state = 2584; + this.match(MySqlParser.KW_ENGINE_ATTRIBUTE); + this.state = 2586; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2585; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2588; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterView() { + let localContext = new AlterViewContext(this.context, this.state); + this.enterRule(localContext, 138, MySqlParser.RULE_alterView); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2591; + this.match(MySqlParser.KW_ALTER); + this.state = 2595; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 308) { + { + this.state = 2592; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2593; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2594; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 486 || _la === 661 || _la === 670)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2598; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 364) { + { + this.state = 2597; + this.ownerStatement(); + } + } + this.state = 2603; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 162) { + { + this.state = 2600; + this.match(MySqlParser.KW_SQL); + this.state = 2601; + this.match(MySqlParser.KW_SECURITY); + this.state = 2602; + localContext._secContext = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 364 || _la === 436)) { + localContext._secContext = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2605; + this.match(MySqlParser.KW_VIEW); + this.state = 2606; + this.viewName(); + this.state = 2611; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 2607; + this.match(MySqlParser.LR_BRACKET); + this.state = 2608; + this.columnNames(); + this.state = 2609; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 2613; + this.match(MySqlParser.KW_AS); + this.state = 2614; + this.selectStatement(); + this.state = 2621; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 304, this.context)) { + case 1: + { + this.state = 2615; + this.match(MySqlParser.KW_WITH); + this.state = 2617; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 325 || _la === 450) { + { + this.state = 2616; + localContext._checkOpt = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 325 || _la === 450)) { + localContext._checkOpt = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2619; + this.match(MySqlParser.KW_CHECK); + this.state = 2620; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterOption() { + let localContext = new AlterOptionContext(this.context, this.state); + this.enterRule(localContext, 140, MySqlParser.RULE_alterOption); + let _la; + try { + let alternative; + this.state = 2887; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 348, this.context)) { + case 1: + localContext = new AlterByTableOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2623; + this.tableOption(); + this.state = 2630; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 306, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2625; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 2624; + this.match(MySqlParser.COMMA); + } + } + this.state = 2627; + this.tableOption(); + } + } + } + this.state = 2632; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 306, this.context); + } + } + break; + case 2: + localContext = new AlterByAddColumnContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2633; + this.match(MySqlParser.KW_ADD); + this.state = 2635; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 307, this.context)) { + case 1: + { + this.state = 2634; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2637; + this.columnName(); + this.state = 2638; + this.columnDefinition(); + this.state = 2642; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FIRST: + { + this.state = 2639; + this.match(MySqlParser.KW_FIRST); + } + break; + case MySqlParser.KW_AFTER: + { + this.state = 2640; + this.match(MySqlParser.KW_AFTER); + this.state = 2641; + this.columnName(); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ADD: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DO: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 3: + localContext = new AlterByAddColumnsContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2644; + this.match(MySqlParser.KW_ADD); + this.state = 2646; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 29) { + { + this.state = 2645; + this.match(MySqlParser.KW_COLUMN); + } + } + this.state = 2648; + this.match(MySqlParser.LR_BRACKET); + this.state = 2649; + this.columnName(); + this.state = 2650; + this.columnDefinition(); + this.state = 2657; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2651; + this.match(MySqlParser.COMMA); + this.state = 2652; + this.columnName(); + this.state = 2653; + this.columnDefinition(); + } + } + this.state = 2659; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2660; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 4: + localContext = new AlterByAddIndexContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2662; + this.match(MySqlParser.KW_ADD); + this.state = 2663; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2665; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2664; + this.indexName(); + } + } + this.state = 2668; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 2667; + this.indexType(); + } + } + this.state = 2670; + this.indexColumnNames(); + this.state = 2674; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 313, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2671; + this.indexOption(); + } + } + } + this.state = 2676; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 313, this.context); + } + } + break; + case 5: + localContext = new AlterByAddSpecialIndexContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2677; + this.match(MySqlParser.KW_ADD); + this.state = 2678; + _la = this.tokenStream.LA(1); + if (!(_la === 69 || _la === 161)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2680; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 2679; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2683; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2682; + this.indexName(); + } + } + this.state = 2685; + this.indexColumnNames(); + this.state = 2689; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 316, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2686; + this.indexOption(); + } + } + } + this.state = 2691; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 316, this.context); + } + } + break; + case 6: + localContext = new AlterByAddPrimaryKeyContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 2692; + this.match(MySqlParser.KW_ADD); + this.state = 2697; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 2693; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 2695; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 317, this.context)) { + case 1: + { + this.state = 2694; + localContext._symbol_ = this.uid(); + } + break; + } + } + } + this.state = 2699; + this.match(MySqlParser.KW_PRIMARY); + this.state = 2700; + this.match(MySqlParser.KW_KEY); + this.state = 2702; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 2701; + this.indexType(); + } + } + this.state = 2704; + this.indexColumnNames(); + this.state = 2708; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 320, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2705; + this.indexOption(); + } + } + } + this.state = 2710; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 320, this.context); + } + } + break; + case 7: + localContext = new AlterByAddUniqueKeyContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 2711; + this.match(MySqlParser.KW_ADD); + this.state = 2716; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 2712; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 2714; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2713; + localContext._symbol_ = this.uid(); + } + } + } + } + this.state = 2718; + this.match(MySqlParser.KW_UNIQUE); + this.state = 2720; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 2719; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2723; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2722; + this.indexName(); + } + } + this.state = 2726; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 2725; + this.indexType(); + } + } + this.state = 2728; + this.indexColumnNames(); + this.state = 2732; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 326, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 2729; + this.indexOption(); + } + } + } + this.state = 2734; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 326, this.context); + } + } + break; + case 8: + localContext = new AlterByAddForeignKeyContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 2735; + this.match(MySqlParser.KW_ADD); + this.state = 2740; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 31) { + { + this.state = 2736; + this.match(MySqlParser.KW_CONSTRAINT); + this.state = 2738; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2737; + localContext._symbol_ = this.uid(); + } + } + } + } + this.state = 2742; + this.match(MySqlParser.KW_FOREIGN); + this.state = 2743; + this.match(MySqlParser.KW_KEY); + this.state = 2745; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 2744; + this.indexName(); + } + } + this.state = 2747; + this.indexColumnNames(); + this.state = 2748; + this.referenceDefinition(); + } + break; + case 9: + localContext = new AlterByAddCheckTableConstraintContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 2750; + this.match(MySqlParser.KW_ADD); + this.state = 2752; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 330, this.context)) { + case 1: + { + this.state = 2751; + this.checkConstraintDefinition(); + } + break; + } + } + break; + case 10: + localContext = new AlterByDropConstraintCheckContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 2754; + this.match(MySqlParser.KW_DROP); + this.state = 2755; + _la = this.tokenStream.LA(1); + if (!(_la === 27 || _la === 31)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2756; + localContext._symbol_ = this.uid(); + } + break; + case 11: + localContext = new AlterByAlterCheckTableConstraintContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 2757; + this.match(MySqlParser.KW_ALTER); + this.state = 2758; + _la = this.tokenStream.LA(1); + if (!(_la === 27 || _la === 31)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2759; + localContext._symbol_ = this.uid(); + this.state = 2761; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 2760; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 2764; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 57) { + { + this.state = 2763; + this.match(MySqlParser.KW_ENFORCED); + } + } + } + break; + case 12: + localContext = new AlterBySetAlgorithmContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 2766; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 2768; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2767; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2770; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 357 || _la === 430 || _la === 434)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 13: + localContext = new AlterByAlterColumnDefaultContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 2771; + this.match(MySqlParser.KW_ALTER); + this.state = 2773; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 334, this.context)) { + case 1: + { + this.state = 2772; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2775; + this.columnName(); + this.state = 2783; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 335, this.context)) { + case 1: + { + this.state = 2776; + this.match(MySqlParser.KW_SET); + this.state = 2777; + this.match(MySqlParser.KW_DEFAULT); + this.state = 2778; + this.defaultValue(); + } + break; + case 2: + { + this.state = 2779; + this.match(MySqlParser.KW_SET); + this.state = 2780; + _la = this.tokenStream.LA(1); + if (!(_la === 435 || _la === 686)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 3: + { + this.state = 2781; + this.match(MySqlParser.KW_DROP); + this.state = 2782; + this.match(MySqlParser.KW_DEFAULT); + } + break; + } + } + break; + case 14: + localContext = new AlterByAlterIndexVisibilityContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 2785; + this.match(MySqlParser.KW_ALTER); + this.state = 2786; + this.match(MySqlParser.KW_INDEX); + this.state = 2787; + this.indexName(); + this.state = 2788; + _la = this.tokenStream.LA(1); + if (!(_la === 435 || _la === 686)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 15: + localContext = new AlterByChangeColumnContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 2790; + this.match(MySqlParser.KW_CHANGE); + this.state = 2792; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 336, this.context)) { + case 1: + { + this.state = 2791; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2794; + localContext._oldColumn = this.columnName(); + this.state = 2795; + localContext._newColumn = this.columnNameCreate(); + this.state = 2796; + this.columnDefinition(); + this.state = 2800; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FIRST: + { + this.state = 2797; + this.match(MySqlParser.KW_FIRST); + } + break; + case MySqlParser.KW_AFTER: + { + this.state = 2798; + this.match(MySqlParser.KW_AFTER); + this.state = 2799; + this.columnName(); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ADD: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DO: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 16: + localContext = new AlterByDefaultCharsetContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 2803; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 2802; + this.match(MySqlParser.KW_DEFAULT); + } + } + this.state = 2805; + this.match(MySqlParser.KW_CHARACTER); + this.state = 2806; + this.match(MySqlParser.KW_SET); + this.state = 2807; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 2808; + this.charsetName(); + this.state = 2814; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 28) { + { + this.state = 2809; + this.match(MySqlParser.KW_COLLATE); + this.state = 2811; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2810; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2813; + this.collationName(); + } + } + } + break; + case 17: + localContext = new AlterByConvertCharsetContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 2816; + this.match(MySqlParser.KW_CONVERT); + this.state = 2817; + this.match(MySqlParser.KW_TO); + this.state = 2821; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CHARSET: + { + this.state = 2818; + this.match(MySqlParser.KW_CHARSET); + } + break; + case MySqlParser.KW_CHARACTER: + { + this.state = 2819; + this.match(MySqlParser.KW_CHARACTER); + this.state = 2820; + this.match(MySqlParser.KW_SET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 2823; + this.charsetName(); + this.state = 2826; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 28) { + { + this.state = 2824; + this.match(MySqlParser.KW_COLLATE); + this.state = 2825; + this.collationName(); + } + } + } + break; + case 18: + localContext = new AlterKeysContext(localContext); + this.enterOuterAlt(localContext, 18); + { + this.state = 2828; + _la = this.tokenStream.LA(1); + if (!(_la === 368 || _la === 375)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2829; + this.match(MySqlParser.KW_KEYS); + } + break; + case 19: + localContext = new AlterTablespaceOptionContext(localContext); + this.enterOuterAlt(localContext, 19); + { + this.state = 2830; + _la = this.tokenStream.LA(1); + if (!(_la === 369 || _la === 425)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2831; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case 20: + localContext = new AlterByDropColumnContext(localContext); + this.enterOuterAlt(localContext, 20); + { + this.state = 2832; + this.match(MySqlParser.KW_DROP); + this.state = 2834; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 343, this.context)) { + case 1: + { + this.state = 2833; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2836; + this.columnName(); + } + break; + case 21: + localContext = new AlterByDropIndexContext(localContext); + this.enterOuterAlt(localContext, 21); + { + this.state = 2837; + this.match(MySqlParser.KW_DROP); + this.state = 2838; + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2839; + this.indexName(); + } + break; + case 22: + localContext = new AlterByDropPrimaryKeyContext(localContext); + this.enterOuterAlt(localContext, 22); + { + this.state = 2840; + this.match(MySqlParser.KW_DROP); + this.state = 2841; + this.match(MySqlParser.KW_PRIMARY); + this.state = 2842; + this.match(MySqlParser.KW_KEY); + } + break; + case 23: + localContext = new AlterByDropForeignKeyContext(localContext); + this.enterOuterAlt(localContext, 23); + { + this.state = 2843; + this.match(MySqlParser.KW_DROP); + this.state = 2844; + this.match(MySqlParser.KW_FOREIGN); + this.state = 2845; + this.match(MySqlParser.KW_KEY); + this.state = 2846; + localContext._fk_symbol = this.uid(); + } + break; + case 24: + localContext = new AlterByForceContext(localContext); + this.enterOuterAlt(localContext, 24); + { + this.state = 2847; + this.match(MySqlParser.KW_FORCE); + } + break; + case 25: + localContext = new AlterByLockContext(localContext); + this.enterOuterAlt(localContext, 25); + { + this.state = 2848; + this.match(MySqlParser.KW_LOCK); + this.state = 2850; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 2849; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 2852; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 389 || _la === 505 || _la === 595)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 26: + localContext = new AlterByModifyColumnContext(localContext); + this.enterOuterAlt(localContext, 26); + { + this.state = 2853; + this.match(MySqlParser.KW_MODIFY); + this.state = 2855; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 345, this.context)) { + case 1: + { + this.state = 2854; + this.match(MySqlParser.KW_COLUMN); + } + break; + } + this.state = 2857; + this.columnName(); + this.state = 2858; + this.columnDefinition(); + this.state = 2862; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FIRST: + { + this.state = 2859; + this.match(MySqlParser.KW_FIRST); + } + break; + case MySqlParser.KW_AFTER: + { + this.state = 2860; + this.match(MySqlParser.KW_AFTER); + this.state = 2861; + this.columnName(); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ADD: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DO: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 27: + localContext = new AlterByOrderContext(localContext); + this.enterOuterAlt(localContext, 27); + { + this.state = 2864; + this.match(MySqlParser.KW_ORDER); + this.state = 2865; + this.match(MySqlParser.KW_BY); + this.state = 2866; + this.columnNames(); + } + break; + case 28: + localContext = new AlterByRenameColumnContext(localContext); + this.enterOuterAlt(localContext, 28); + { + this.state = 2867; + this.match(MySqlParser.KW_RENAME); + this.state = 2868; + this.match(MySqlParser.KW_COLUMN); + this.state = 2869; + localContext._olcdColumn = this.columnName(); + this.state = 2870; + this.match(MySqlParser.KW_TO); + this.state = 2871; + localContext._newColumn = this.columnNameCreate(); + } + break; + case 29: + localContext = new AlterByRenameIndexContext(localContext); + this.enterOuterAlt(localContext, 29); + { + this.state = 2873; + this.match(MySqlParser.KW_RENAME); + this.state = 2874; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2875; + this.indexName(); + this.state = 2876; + this.match(MySqlParser.KW_TO); + this.state = 2877; + this.indexNameCreate(); + } + break; + case 30: + localContext = new AlterByRenameContext(localContext); + this.enterOuterAlt(localContext, 30); + { + this.state = 2879; + this.match(MySqlParser.KW_RENAME); + this.state = 2881; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13 || _la === 176) { + { + this.state = 2880; + localContext._renameFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 13 || _la === 176)) { + localContext._renameFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 2883; + this.tableNameCreate(); + } + break; + case 31: + localContext = new AlterByValidateContext(localContext); + this.enterOuterAlt(localContext, 31); + { + this.state = 2884; + _la = this.tokenStream.LA(1); + if (!(_la === 194 || _la === 690)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2885; + this.match(MySqlParser.KW_VALIDATION); + } + break; + case 32: + localContext = new AlterPartitionContext(localContext); + this.enterOuterAlt(localContext, 32); + { + this.state = 2886; + this.alterPartitionSpecification(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterPartitionSpecification() { + let localContext = new AlterPartitionSpecificationContext(this.context, this.state); + this.enterRule(localContext, 142, MySqlParser.RULE_alterPartitionSpecification); + let _la; + try { + this.state = 2987; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ADD: + localContext = new AlterByAddPartitionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 2889; + this.match(MySqlParser.KW_ADD); + this.state = 2890; + this.match(MySqlParser.KW_PARTITION); + this.state = 2891; + this.match(MySqlParser.LR_BRACKET); + this.state = 2892; + this.partitionDefinition(); + this.state = 2897; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2893; + this.match(MySqlParser.COMMA); + this.state = 2894; + this.partitionDefinition(); + } + } + this.state = 2899; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2900; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_DROP: + localContext = new AlterByDropPartitionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 2902; + this.match(MySqlParser.KW_DROP); + this.state = 2903; + this.match(MySqlParser.KW_PARTITION); + this.state = 2904; + this.partitionNames(); + } + break; + case MySqlParser.KW_DISCARD: + localContext = new AlterByDiscardPartitionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 2905; + this.match(MySqlParser.KW_DISCARD); + this.state = 2906; + this.match(MySqlParser.KW_PARTITION); + this.state = 2909; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2907; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2908; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 2911; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case MySqlParser.KW_IMPORT: + localContext = new AlterByImportPartitionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 2912; + this.match(MySqlParser.KW_IMPORT); + this.state = 2913; + this.match(MySqlParser.KW_PARTITION); + this.state = 2916; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2914; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2915; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 2918; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case MySqlParser.KW_TRUNCATE: + localContext = new AlterByTruncatePartitionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 2919; + this.match(MySqlParser.KW_TRUNCATE); + this.state = 2920; + this.match(MySqlParser.KW_PARTITION); + this.state = 2923; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2921; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2922; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_COALESCE: + localContext = new AlterByCoalescePartitionContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 2925; + this.match(MySqlParser.KW_COALESCE); + this.state = 2926; + this.match(MySqlParser.KW_PARTITION); + this.state = 2927; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_REORGANIZE: + localContext = new AlterByReorganizePartitionContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 2928; + this.match(MySqlParser.KW_REORGANIZE); + this.state = 2929; + this.match(MySqlParser.KW_PARTITION); + this.state = 2930; + this.partitionNames(); + this.state = 2931; + this.match(MySqlParser.KW_INTO); + this.state = 2932; + this.match(MySqlParser.LR_BRACKET); + this.state = 2933; + this.partitionDefinition(); + this.state = 2938; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 2934; + this.match(MySqlParser.COMMA); + this.state = 2935; + this.partitionDefinition(); + } + } + this.state = 2940; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 2941; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_EXCHANGE: + localContext = new AlterByExchangePartitionContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 2943; + this.match(MySqlParser.KW_EXCHANGE); + this.state = 2944; + this.match(MySqlParser.KW_PARTITION); + this.state = 2945; + this.partitionName(); + this.state = 2946; + this.match(MySqlParser.KW_WITH); + this.state = 2947; + this.match(MySqlParser.KW_TABLE); + this.state = 2948; + this.tableName(); + this.state = 2951; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 354, this.context)) { + case 1: + { + this.state = 2949; + localContext._validationFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 194 || _la === 690)) { + localContext._validationFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2950; + this.match(MySqlParser.KW_VALIDATION); + } + break; + } + } + break; + case MySqlParser.KW_ANALYZE: + localContext = new AlterByAnalyzePartitionContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 2953; + this.match(MySqlParser.KW_ANALYZE); + this.state = 2954; + this.match(MySqlParser.KW_PARTITION); + this.state = 2957; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2955; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2956; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_CHECK: + localContext = new AlterByCheckPartitionContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 2959; + this.match(MySqlParser.KW_CHECK); + this.state = 2960; + this.match(MySqlParser.KW_PARTITION); + this.state = 2963; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2961; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2962; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_OPTIMIZE: + localContext = new AlterByOptimizePartitionContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 2965; + this.match(MySqlParser.KW_OPTIMIZE); + this.state = 2966; + this.match(MySqlParser.KW_PARTITION); + this.state = 2969; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2967; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2968; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_REBUILD: + localContext = new AlterByRebuildPartitionContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 2971; + this.match(MySqlParser.KW_REBUILD); + this.state = 2972; + this.match(MySqlParser.KW_PARTITION); + this.state = 2975; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2973; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2974; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_REPAIR: + localContext = new AlterByRepairPartitionContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 2977; + this.match(MySqlParser.KW_REPAIR); + this.state = 2978; + this.match(MySqlParser.KW_PARTITION); + this.state = 2981; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 2979; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 2980; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_REMOVE: + localContext = new AlterByRemovePartitioningContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 2983; + this.match(MySqlParser.KW_REMOVE); + this.state = 2984; + this.match(MySqlParser.KW_PARTITIONING); + } + break; + case MySqlParser.KW_UPGRADE: + localContext = new AlterByUpgradePartitioningContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 2985; + this.match(MySqlParser.KW_UPGRADE); + this.state = 2986; + this.match(MySqlParser.KW_PARTITIONING); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropDatabase() { + let localContext = new DropDatabaseContext(this.context, this.state); + this.enterRule(localContext, 144, MySqlParser.RULE_dropDatabase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2989; + this.match(MySqlParser.KW_DROP); + this.state = 2990; + localContext._dbFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + localContext._dbFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 2992; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 361, this.context)) { + case 1: + { + this.state = 2991; + this.ifExists(); + } + break; + } + this.state = 2994; + this.databaseName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropEvent() { + let localContext = new DropEventContext(this.context, this.state); + this.enterRule(localContext, 146, MySqlParser.RULE_dropEvent); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 2996; + this.match(MySqlParser.KW_DROP); + this.state = 2997; + this.match(MySqlParser.KW_EVENT); + this.state = 2999; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 362, this.context)) { + case 1: + { + this.state = 2998; + this.ifExists(); + } + break; + } + this.state = 3001; + localContext._event_name = this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropIndex() { + let localContext = new DropIndexContext(this.context, this.state); + this.enterRule(localContext, 148, MySqlParser.RULE_dropIndex); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3003; + this.match(MySqlParser.KW_DROP); + this.state = 3004; + this.match(MySqlParser.KW_INDEX); + this.state = 3006; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 363, this.context)) { + case 1: + { + this.state = 3005; + localContext._intimeAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 508 || _la === 514)) { + localContext._intimeAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 3008; + this.indexName(); + this.state = 3009; + this.match(MySqlParser.KW_ON); + this.state = 3010; + this.tableName(); + this.state = 3023; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 367, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + this.state = 3021; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALGORITHM: + { + this.state = 3011; + this.match(MySqlParser.KW_ALGORITHM); + this.state = 3013; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3012; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3015; + localContext._algType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 357 || _la === 430)) { + localContext._algType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_LOCK: + { + this.state = 3016; + this.match(MySqlParser.KW_LOCK); + this.state = 3018; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3017; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3020; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 389 || _la === 505 || _la === 595)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 3025; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 367, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropLogfileGroup() { + let localContext = new DropLogfileGroupContext(this.context, this.state); + this.enterRule(localContext, 150, MySqlParser.RULE_dropLogfileGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3026; + this.match(MySqlParser.KW_DROP); + this.state = 3027; + this.match(MySqlParser.KW_LOGFILE); + this.state = 3028; + this.match(MySqlParser.KW_GROUP); + this.state = 3029; + localContext._logfileGroupName = this.uid(); + this.state = 3030; + this.match(MySqlParser.KW_ENGINE); + this.state = 3032; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3031; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3034; + this.engineName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropProcedure() { + let localContext = new DropProcedureContext(this.context, this.state); + this.enterRule(localContext, 152, MySqlParser.RULE_dropProcedure); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3036; + this.match(MySqlParser.KW_DROP); + this.state = 3037; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 3039; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 369, this.context)) { + case 1: + { + this.state = 3038; + this.ifExists(); + } + break; + } + this.state = 3041; + localContext._sp_name = this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropFunction() { + let localContext = new DropFunctionContext(this.context, this.state); + this.enterRule(localContext, 154, MySqlParser.RULE_dropFunction); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3043; + this.match(MySqlParser.KW_DROP); + this.state = 3044; + this.match(MySqlParser.KW_FUNCTION); + this.state = 3046; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 370, this.context)) { + case 1: + { + this.state = 3045; + this.ifExists(); + } + break; + } + this.state = 3048; + this.functionName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropServer() { + let localContext = new DropServerContext(this.context, this.state); + this.enterRule(localContext, 156, MySqlParser.RULE_dropServer); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3050; + this.match(MySqlParser.KW_DROP); + this.state = 3051; + this.match(MySqlParser.KW_SERVER); + this.state = 3053; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 371, this.context)) { + case 1: + { + this.state = 3052; + this.ifExists(); + } + break; + } + this.state = 3055; + localContext._serverName = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropSpatial() { + let localContext = new DropSpatialContext(this.context, this.state); + this.enterRule(localContext, 158, MySqlParser.RULE_dropSpatial); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3057; + this.match(MySqlParser.KW_DROP); + this.state = 3058; + this.match(MySqlParser.KW_SPATIAL); + this.state = 3059; + this.match(MySqlParser.KW_REFERENCE); + this.state = 3060; + this.match(MySqlParser.KW_SYSTEM); + this.state = 3062; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 3061; + this.ifExists(); + } + } + this.state = 3064; + this.match(MySqlParser.DECIMAL_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropTable() { + let localContext = new DropTableContext(this.context, this.state); + this.enterRule(localContext, 160, MySqlParser.RULE_dropTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3066; + this.match(MySqlParser.KW_DROP); + this.state = 3068; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 660) { + { + this.state = 3067; + this.match(MySqlParser.KW_TEMPORARY); + } + } + this.state = 3070; + this.match(MySqlParser.KW_TABLE); + this.state = 3072; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 374, this.context)) { + case 1: + { + this.state = 3071; + this.ifExists(); + } + break; + } + this.state = 3074; + this.tableNames(); + this.state = 3076; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 22 || _la === 146) { + { + this.state = 3075; + localContext._dropType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 22 || _la === 146)) { + localContext._dropType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropTablespace() { + let localContext = new DropTablespaceContext(this.context, this.state); + this.enterRule(localContext, 162, MySqlParser.RULE_dropTablespace); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3078; + this.match(MySqlParser.KW_DROP); + this.state = 3080; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 180) { + { + this.state = 3079; + this.match(MySqlParser.KW_UNDO); + } + } + this.state = 3082; + this.match(MySqlParser.KW_TABLESPACE); + this.state = 3083; + this.tablespaceName(); + this.state = 3089; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 380) { + { + this.state = 3084; + this.match(MySqlParser.KW_ENGINE); + this.state = 3086; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 3085; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 3088; + this.engineName(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropTrigger() { + let localContext = new DropTriggerContext(this.context, this.state); + this.enterRule(localContext, 164, MySqlParser.RULE_dropTrigger); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3091; + this.match(MySqlParser.KW_DROP); + this.state = 3092; + this.match(MySqlParser.KW_TRIGGER); + this.state = 3094; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 379, this.context)) { + case 1: + { + this.state = 3093; + this.ifExists(); + } + break; + } + this.state = 3096; + localContext._trigger_name = this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropView() { + let localContext = new DropViewContext(this.context, this.state); + this.enterRule(localContext, 166, MySqlParser.RULE_dropView); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3098; + this.match(MySqlParser.KW_DROP); + this.state = 3099; + this.match(MySqlParser.KW_VIEW); + this.state = 3101; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 380, this.context)) { + case 1: + { + this.state = 3100; + this.ifExists(); + } + break; + } + this.state = 3103; + this.viewName(); + this.state = 3108; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3104; + this.match(MySqlParser.COMMA); + this.state = 3105; + this.viewName(); + } + } + this.state = 3110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3112; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 22 || _la === 146) { + { + this.state = 3111; + localContext._dropType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 22 || _la === 146)) { + localContext._dropType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropRole() { + let localContext = new DropRoleContext(this.context, this.state); + this.enterRule(localContext, 168, MySqlParser.RULE_dropRole); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3114; + this.match(MySqlParser.KW_DROP); + this.state = 3115; + this.match(MySqlParser.KW_ROLE); + this.state = 3117; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 383, this.context)) { + case 1: + { + this.state = 3116; + this.ifExists(); + } + break; + } + this.state = 3119; + this.userOrRoleNames(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setRole() { + let localContext = new SetRoleContext(this.context, this.state); + this.enterRule(localContext, 170, MySqlParser.RULE_setRole); + let _la; + try { + this.state = 3141; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 386, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3121; + this.match(MySqlParser.KW_SET); + this.state = 3122; + this.match(MySqlParser.KW_DEFAULT); + this.state = 3123; + this.match(MySqlParser.KW_ROLE); + this.state = 3127; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 384, this.context)) { + case 1: + { + this.state = 3124; + this.match(MySqlParser.KW_NONE); + } + break; + case 2: + { + this.state = 3125; + this.match(MySqlParser.KW_ALL); + } + break; + case 3: + { + this.state = 3126; + this.userOrRoleNames(); + } + break; + } + this.state = 3129; + this.match(MySqlParser.KW_TO); + { + this.state = 3130; + this.userOrRoleName(); + } + this.state = 3135; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3131; + this.match(MySqlParser.COMMA); + { + this.state = 3132; + this.userOrRoleName(); + } + } + } + this.state = 3137; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3138; + this.match(MySqlParser.KW_SET); + this.state = 3139; + this.match(MySqlParser.KW_ROLE); + this.state = 3140; + this.roleOption(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameTable() { + let localContext = new RenameTableContext(this.context, this.state); + this.enterRule(localContext, 172, MySqlParser.RULE_renameTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3143; + this.match(MySqlParser.KW_RENAME); + this.state = 3144; + this.match(MySqlParser.KW_TABLE); + this.state = 3145; + this.renameTableClause(); + this.state = 3150; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3146; + this.match(MySqlParser.COMMA); + this.state = 3147; + this.renameTableClause(); + } + } + this.state = 3152; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameTableClause() { + let localContext = new RenameTableClauseContext(this.context, this.state); + this.enterRule(localContext, 174, MySqlParser.RULE_renameTableClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3153; + this.tableName(); + this.state = 3154; + this.match(MySqlParser.KW_TO); + this.state = 3155; + this.tableNameCreate(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + truncateTable() { + let localContext = new TruncateTableContext(this.context, this.state); + this.enterRule(localContext, 176, MySqlParser.RULE_truncateTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3157; + this.match(MySqlParser.KW_TRUNCATE); + this.state = 3159; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 173) { + { + this.state = 3158; + this.match(MySqlParser.KW_TABLE); + } + } + this.state = 3161; + this.tableName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + callStatement() { + let localContext = new CallStatementContext(this.context, this.state); + this.enterRule(localContext, 178, MySqlParser.RULE_callStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3163; + this.match(MySqlParser.KW_CALL); + this.state = 3164; + localContext._sp_name = this.fullId(); + this.state = 3171; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 390, this.context)) { + case 1: + { + this.state = 3165; + this.match(MySqlParser.LR_BRACKET); + this.state = 3168; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 389, this.context)) { + case 1: + { + this.state = 3166; + this.constants(); + } + break; + case 2: + { + this.state = 3167; + this.expressions(); + } + break; + } + this.state = 3170; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + deleteStatement() { + let localContext = new DeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 180, MySqlParser.RULE_deleteStatement); + try { + this.state = 3175; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 391, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3173; + this.singleDeleteStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3174; + this.multipleDeleteStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + doStatement() { + let localContext = new DoStatementContext(this.context, this.state); + this.enterRule(localContext, 182, MySqlParser.RULE_doStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3177; + this.match(MySqlParser.KW_DO); + this.state = 3178; + this.expressions(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerStatement() { + let localContext = new HandlerStatementContext(this.context, this.state); + this.enterRule(localContext, 184, MySqlParser.RULE_handlerStatement); + try { + this.state = 3184; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 392, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3180; + this.handlerOpenStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3181; + this.handlerReadIndexStatement(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 3182; + this.handlerReadStatement(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 3183; + this.handlerCloseStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + insertStatement() { + let localContext = new InsertStatementContext(this.context, this.state); + this.enterRule(localContext, 186, MySqlParser.RULE_insertStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3186; + this.match(MySqlParser.KW_INSERT); + this.state = 3188; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 43 || _la === 76 || _la === 107) { + { + this.state = 3187; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 43 || _la === 76 || _la === 107)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3191; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3190; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3194; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3193; + this.match(MySqlParser.KW_INTO); + } + } + this.state = 3196; + this.tableName(); + this.state = 3203; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3197; + this.match(MySqlParser.KW_PARTITION); + this.state = 3198; + this.match(MySqlParser.LR_BRACKET); + this.state = 3200; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 3199; + this.partitionNames(); + } + } + this.state = 3202; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3216; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 401, this.context)) { + case 1: + { + this.state = 3206; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 398, this.context)) { + case 1: + { + this.state = 3205; + this.fullColumnNames(); + } + break; + } + this.state = 3210; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 399, this.context)) { + case 1: + { + this.state = 3208; + this.valuesOrValueList(); + } + break; + case 2: + { + this.state = 3209; + this.selectOrTableOrValues(); + } + break; + } + this.state = 3213; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 400, this.context)) { + case 1: + { + this.state = 3212; + this.asRowAlias(); + } + break; + } + } + break; + case 2: + { + this.state = 3215; + this.setAssignmentList(); + } + break; + } + this.state = 3219; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3218; + this.asRowAlias(); + } + } + this.state = 3233; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 119) { + { + this.state = 3221; + this.match(MySqlParser.KW_ON); + this.state = 3222; + this.match(MySqlParser.KW_DUPLICATE); + this.state = 3223; + this.match(MySqlParser.KW_KEY); + this.state = 3224; + this.match(MySqlParser.KW_UPDATE); + this.state = 3225; + localContext._duplicatedFirst = this.updatedElement(); + this.state = 3230; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3226; + this.match(MySqlParser.COMMA); + this.state = 3227; + localContext._updatedElement = this.updatedElement(); + localContext._duplicatedElements.push(localContext._updatedElement); + } + } + this.state = 3232; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + asRowAlias() { + let localContext = new AsRowAliasContext(this.context, this.state); + this.enterRule(localContext, 188, MySqlParser.RULE_asRowAlias); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3235; + this.match(MySqlParser.KW_AS); + this.state = 3236; + localContext._rowAlias = this.uid(); + this.state = 3238; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 405, this.context)) { + case 1: + { + this.state = 3237; + this.fullColumnNames(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectOrTableOrValues() { + let localContext = new SelectOrTableOrValuesContext(this.context, this.state); + this.enterRule(localContext, 190, MySqlParser.RULE_selectOrTableOrValues); + try { + this.state = 3244; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.LR_BRACKET: + this.enterOuterAlt(localContext, 1); + { + this.state = 3240; + this.selectStatement(); + } + break; + case MySqlParser.KW_TABLE: + this.enterOuterAlt(localContext, 2); + { + this.state = 3241; + this.match(MySqlParser.KW_TABLE); + this.state = 3242; + this.tableName(); + } + break; + case MySqlParser.KW_VALUES: + this.enterOuterAlt(localContext, 3); + { + this.state = 3243; + this.rowValuesList(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + interSectStatement() { + let localContext = new InterSectStatementContext(this.context, this.state); + this.enterRule(localContext, 192, MySqlParser.RULE_interSectStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3246; + this.interSectQuery(); + this.state = 3252; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 3247; + this.match(MySqlParser.KW_INTERSECT); + this.state = 3249; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3248; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3251; + this.interSectQuery(); + } + } + this.state = 3254; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 828); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + interSectQuery() { + let localContext = new InterSectQueryContext(this.context, this.state); + this.enterRule(localContext, 194, MySqlParser.RULE_interSectQuery); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3257; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 3256; + this.match(MySqlParser.LR_BRACKET); + } + } + this.state = 3259; + this.querySpecification(); + this.state = 3261; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 410, this.context)) { + case 1: + { + this.state = 3260; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadDataStatement() { + let localContext = new LoadDataStatementContext(this.context, this.state); + this.enterRule(localContext, 196, MySqlParser.RULE_loadDataStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3263; + this.match(MySqlParser.KW_LOAD); + this.state = 3264; + this.match(MySqlParser.KW_DATA); + this.state = 3266; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107 || _la === 347) { + { + this.state = 3265; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 107 || _la === 347)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3269; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 450) { + { + this.state = 3268; + this.match(MySqlParser.KW_LOCAL); + } + } + this.state = 3271; + this.match(MySqlParser.KW_INFILE); + this.state = 3272; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + this.state = 3274; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79 || _la === 143) { + { + this.state = 3273; + localContext._violation = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 79 || _la === 143)) { + localContext._violation = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3276; + this.match(MySqlParser.KW_INTO); + this.state = 3277; + this.match(MySqlParser.KW_TABLE); + this.state = 3278; + this.tableName(); + this.state = 3284; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3279; + this.match(MySqlParser.KW_PARTITION); + this.state = 3280; + this.match(MySqlParser.LR_BRACKET); + this.state = 3281; + this.partitionNames(); + this.state = 3282; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3289; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26) { + { + this.state = 3286; + this.match(MySqlParser.KW_CHARACTER); + this.state = 3287; + this.match(MySqlParser.KW_SET); + this.state = 3288; + localContext._charset = this.charsetName(); + } + } + this.state = 3297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 337 || _la === 398) { + { + this.state = 3291; + localContext._fieldsFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 337 || _la === 398)) { + localContext._fieldsFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3293; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 3292; + this.selectFieldsInto(); + } + } + this.state = 3295; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 56 || _la === 58 || _la === 123 || _la === 174); + } + } + this.state = 3305; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 102) { + { + this.state = 3299; + this.match(MySqlParser.KW_LINES); + this.state = 3301; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 3300; + this.selectLinesInto(); + } + } + this.state = 3303; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 171 || _la === 174); + } + } + this.state = 3311; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3307; + this.match(MySqlParser.KW_IGNORE); + this.state = 3308; + this.decimalLiteral(); + this.state = 3309; + localContext._linesFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 102 || _la === 587)) { + localContext._linesFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3324; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 422, this.context)) { + case 1: + { + this.state = 3313; + this.match(MySqlParser.LR_BRACKET); + this.state = 3314; + this.assignmentField(); + this.state = 3319; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3315; + this.match(MySqlParser.COMMA); + this.state = 3316; + this.assignmentField(); + } + } + this.state = 3321; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3322; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3335; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 424, this.context)) { + case 1: + { + this.state = 3326; + this.match(MySqlParser.KW_SET); + this.state = 3327; + this.updatedElement(); + this.state = 3332; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3328; + this.match(MySqlParser.COMMA); + this.state = 3329; + this.updatedElement(); + } + } + this.state = 3334; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadXmlStatement() { + let localContext = new LoadXmlStatementContext(this.context, this.state); + this.enterRule(localContext, 198, MySqlParser.RULE_loadXmlStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3337; + this.match(MySqlParser.KW_LOAD); + this.state = 3338; + this.match(MySqlParser.KW_XML); + this.state = 3340; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107 || _la === 347) { + { + this.state = 3339; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 107 || _la === 347)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3343; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 450) { + { + this.state = 3342; + this.match(MySqlParser.KW_LOCAL); + } + } + this.state = 3345; + this.match(MySqlParser.KW_INFILE); + this.state = 3346; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + this.state = 3348; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79 || _la === 143) { + { + this.state = 3347; + localContext._violation = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 79 || _la === 143)) { + localContext._violation = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3350; + this.match(MySqlParser.KW_INTO); + this.state = 3351; + this.match(MySqlParser.KW_TABLE); + this.state = 3352; + this.tableName(); + this.state = 3356; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26) { + { + this.state = 3353; + this.match(MySqlParser.KW_CHARACTER); + this.state = 3354; + this.match(MySqlParser.KW_SET); + this.state = 3355; + localContext._charset = this.charsetName(); + } + } + this.state = 3368; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 587) { + { + this.state = 3358; + this.match(MySqlParser.KW_ROWS); + this.state = 3359; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 3360; + this.match(MySqlParser.KW_BY); + this.state = 3362; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 859) { + { + this.state = 3361; + this.match(MySqlParser.LESS_SYMBOL); + } + } + this.state = 3364; + localContext._tag = this.match(MySqlParser.STRING_LITERAL); + this.state = 3366; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 858) { + { + this.state = 3365; + this.match(MySqlParser.GREATER_SYMBOL); + } + } + } + } + this.state = 3374; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3370; + this.match(MySqlParser.KW_IGNORE); + this.state = 3371; + this.decimalLiteral(); + this.state = 3372; + localContext._linesFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 102 || _la === 587)) { + localContext._linesFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3387; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 434, this.context)) { + case 1: + { + this.state = 3376; + this.match(MySqlParser.LR_BRACKET); + this.state = 3377; + this.assignmentField(); + this.state = 3382; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3378; + this.match(MySqlParser.COMMA); + this.state = 3379; + this.assignmentField(); + } + } + this.state = 3384; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3385; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3398; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 436, this.context)) { + case 1: + { + this.state = 3389; + this.match(MySqlParser.KW_SET); + this.state = 3390; + this.updatedElement(); + this.state = 3395; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3391; + this.match(MySqlParser.COMMA); + this.state = 3392; + this.updatedElement(); + } + } + this.state = 3397; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + parenthesizedQuery() { + let localContext = new ParenthesizedQueryContext(this.context, this.state); + this.enterRule(localContext, 200, MySqlParser.RULE_parenthesizedQuery); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3400; + this.match(MySqlParser.LR_BRACKET); + this.state = 3401; + this.parenthesizedQueryExpression(); + this.state = 3403; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3402; + this.orderByClause(); + } + } + this.state = 3406; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3405; + this.limitClause(); + } + } + this.state = 3408; + this.match(MySqlParser.RR_BRACKET); + this.state = 3410; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3409; + this.orderByClause(); + } + } + this.state = 3413; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3412; + this.limitClause(); + } + } + this.state = 3416; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3415; + this.intoClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replaceStatement() { + let localContext = new ReplaceStatementContext(this.context, this.state); + this.enterRule(localContext, 202, MySqlParser.RULE_replaceStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3418; + this.match(MySqlParser.KW_REPLACE); + this.state = 3420; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 43 || _la === 107) { + { + this.state = 3419; + localContext._priority = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 43 || _la === 107)) { + localContext._priority = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3423; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3422; + this.match(MySqlParser.KW_INTO); + } + } + this.state = 3425; + this.tableName(); + this.state = 3431; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3426; + this.match(MySqlParser.KW_PARTITION); + this.state = 3427; + this.match(MySqlParser.LR_BRACKET); + this.state = 3428; + this.partitionNames(); + this.state = 3429; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3441; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_VALUE: + case MySqlParser.LR_BRACKET: + { + this.state = 3437; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 445, this.context)) { + case 1: + { + this.state = 3433; + this.match(MySqlParser.LR_BRACKET); + this.state = 3434; + this.columnNames(); + this.state = 3435; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3439; + this.replaceStatementValuesOrSelectOrTable(); + } + break; + case MySqlParser.KW_SET: + { + this.state = 3440; + this.setAssignmentList(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectStatement() { + let localContext = new SelectStatementContext(this.context, this.state); + this.enterRule(localContext, 204, MySqlParser.RULE_selectStatement); + let _la; + try { + let alternative; + this.state = 3502; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + localContext = new UnionAndLateralSelectContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3443; + this.querySpecification(); + this.state = 3447; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 447, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3444; + this.unionStatement(); + } + } + } + this.state = 3449; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 447, this.context); + } + this.state = 3458; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 450, this.context)) { + case 1: + { + this.state = 3450; + this.match(MySqlParser.KW_UNION); + this.state = 3452; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3451; + localContext._unionType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._unionType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3456; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + { + this.state = 3454; + this.querySpecification(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 3455; + this.queryExpression(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + } + this.state = 3464; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 451, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3460; + this.match(MySqlParser.COMMA); + this.state = 3461; + this.lateralStatement(); + } + } + } + this.state = 3466; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 451, this.context); + } + this.state = 3468; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 452, this.context)) { + case 1: + { + this.state = 3467; + this.orderByClause(); + } + break; + } + this.state = 3471; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 453, this.context)) { + case 1: + { + this.state = 3470; + this.limitClause(); + } + break; + } + this.state = 3474; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 454, this.context)) { + case 1: + { + this.state = 3473; + this.lockClause(); + } + break; + } + this.state = 3477; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 455, this.context)) { + case 1: + { + this.state = 3476; + this.intoClause(); + } + break; + } + } + break; + case MySqlParser.LR_BRACKET: + localContext = new SelectExpressionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3479; + this.queryExpression(); + this.state = 3483; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 456, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3480; + this.unionStatement(); + } + } + } + this.state = 3485; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 456, this.context); + } + this.state = 3491; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 458, this.context)) { + case 1: + { + this.state = 3486; + this.match(MySqlParser.KW_UNION); + this.state = 3488; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3487; + localContext._unionType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._unionType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3490; + this.queryExpression(); + } + break; + } + this.state = 3494; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 459, this.context)) { + case 1: + { + this.state = 3493; + this.orderByClause(); + } + break; + } + this.state = 3497; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 460, this.context)) { + case 1: + { + this.state = 3496; + this.limitClause(); + } + break; + } + this.state = 3500; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 461, this.context)) { + case 1: + { + this.state = 3499; + this.lockClause(); + } + break; + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setOperations() { + let localContext = new SetOperationsContext(this.context, this.state); + this.enterRule(localContext, 206, MySqlParser.RULE_setOperations); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3505; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 3504; + this.withClause(); + } + } + this.state = 3507; + this.queryExpressionBody(0); + this.state = 3509; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3508; + this.orderByClause(); + } + } + this.state = 3512; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3511; + this.limitClause(); + } + } + this.state = 3515; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3514; + this.intoClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + queryExpressionBody(_p) { + let parentContext = this.context; + let parentState = this.state; + let localContext = new QueryExpressionBodyContext(this.context, parentState); + let previousContext = localContext; + let _startState = 208; + this.enterRecursionRule(localContext, 208, MySqlParser.RULE_queryExpressionBody, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + { + this.state = 3518; + this.queryItem(0); + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 3534; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 470, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 3532; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 469, this.context)) { + case 1: + { + localContext = new QueryExpressionBodyContext(parentContext, parentState); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_queryExpressionBody); + this.state = 3520; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 3521; + this.match(MySqlParser.KW_UNION); + this.state = 3523; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3522; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3525; + this.queryItem(0); + } + break; + case 2: + { + localContext = new QueryExpressionBodyContext(parentContext, parentState); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_queryExpressionBody); + this.state = 3526; + if (!(this.precpred(this.context, 1))) { + throw this.createFailedPredicateException("this.precpred(this.context, 1)"); + } + this.state = 3527; + this.match(MySqlParser.KW_EXCEPT); + this.state = 3529; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3528; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3531; + this.queryItem(0); + } + break; + } + } + } + this.state = 3536; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 470, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + queryItem(_p) { + let parentContext = this.context; + let parentState = this.state; + let localContext = new QueryItemContext(this.context, parentState); + let previousContext = localContext; + let _startState = 210; + this.enterRecursionRule(localContext, 210, MySqlParser.RULE_queryItem, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + { + this.state = 3538; + this.queryPrimary(); + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 3548; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 472, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + { + localContext = new QueryItemContext(parentContext, parentState); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_queryItem); + this.state = 3540; + if (!(this.precpred(this.context, 1))) { + throw this.createFailedPredicateException("this.precpred(this.context, 1)"); + } + this.state = 3541; + this.match(MySqlParser.KW_INTERSECT); + this.state = 3543; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 3542; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3545; + this.queryPrimary(); + } + } + } + this.state = 3550; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 472, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + queryPrimary() { + let localContext = new QueryPrimaryContext(this.context, this.state); + this.enterRule(localContext, 212, MySqlParser.RULE_queryPrimary); + let _la; + try { + this.state = 3565; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 476, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3551; + this.queryBlock(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3552; + this.match(MySqlParser.LR_BRACKET); + this.state = 3553; + this.queryExpressionBody(0); + this.state = 3555; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3554; + this.orderByClause(); + } + } + this.state = 3558; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3557; + this.limitClause(); + } + } + this.state = 3561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3560; + this.intoClause(); + } + } + this.state = 3563; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + updateStatement() { + let localContext = new UpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 214, MySqlParser.RULE_updateStatement); + try { + this.state = 3569; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 477, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3567; + this.singleUpdateStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3568; + this.multipleUpdateStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + valuesStatement() { + let localContext = new ValuesStatementContext(this.context, this.state); + this.enterRule(localContext, 216, MySqlParser.RULE_valuesStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3571; + this.rowValuesList(); + this.state = 3575; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 478, this.context)) { + case 1: + { + this.state = 3572; + this.match(MySqlParser.KW_ORDER); + this.state = 3573; + this.match(MySqlParser.KW_BY); + this.state = 3574; + this.indexColumnName(); + } + break; + } + this.state = 3579; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 479, this.context)) { + case 1: + { + this.state = 3577; + this.match(MySqlParser.KW_LIMIT); + this.state = 3578; + this.limitClauseAtom(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + parenthesizedQueryExpression() { + let localContext = new ParenthesizedQueryExpressionContext(this.context, this.state); + this.enterRule(localContext, 218, MySqlParser.RULE_parenthesizedQueryExpression); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3581; + this.queryBlock(); + this.state = 3586; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 59 || _la === 181 || _la === 828) { + { + { + this.state = 3582; + _la = this.tokenStream.LA(1); + if (!(_la === 59 || _la === 181 || _la === 828)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3583; + this.queryBlock(); + } + } + this.state = 3588; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3590; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 481, this.context)) { + case 1: + { + this.state = 3589; + this.orderByClause(); + } + break; + } + this.state = 3593; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 482, this.context)) { + case 1: + { + this.state = 3592; + this.limitClause(); + } + break; + } + this.state = 3596; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 88) { + { + this.state = 3595; + this.intoClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + queryBlock() { + let localContext = new QueryBlockContext(this.context, this.state); + this.enterRule(localContext, 220, MySqlParser.RULE_queryBlock); + try { + this.state = 3601; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.LR_BRACKET: + this.enterOuterAlt(localContext, 1); + { + this.state = 3598; + this.selectStatement(); + } + break; + case MySqlParser.KW_TABLE: + this.enterOuterAlt(localContext, 2); + { + this.state = 3599; + this.tableStatement(); + } + break; + case MySqlParser.KW_VALUES: + this.enterOuterAlt(localContext, 3); + { + this.state = 3600; + this.valuesStatement(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replaceStatementValuesOrSelectOrTable() { + let localContext = new ReplaceStatementValuesOrSelectOrTableContext(this.context, this.state); + this.enterRule(localContext, 222, MySqlParser.RULE_replaceStatementValuesOrSelectOrTable); + try { + this.state = 3608; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 485, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 3603; + this.selectStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 3604; + this.match(MySqlParser.KW_TABLE); + this.state = 3605; + this.tableName(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 3606; + this.valuesOrValueList(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 3607; + this.rowValuesList(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + rowValuesList() { + let localContext = new RowValuesListContext(this.context, this.state); + this.enterRule(localContext, 224, MySqlParser.RULE_rowValuesList); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3610; + this.match(MySqlParser.KW_VALUES); + this.state = 3611; + this.match(MySqlParser.KW_ROW); + this.state = 3612; + this.expressionsWithDefaults(); + this.state = 3618; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 486, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3613; + this.match(MySqlParser.COMMA); + this.state = 3614; + this.match(MySqlParser.KW_ROW); + this.state = 3615; + this.expressionsWithDefaults(); + } + } + } + this.state = 3620; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 486, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setAssignmentList() { + let localContext = new SetAssignmentListContext(this.context, this.state); + this.enterRule(localContext, 226, MySqlParser.RULE_setAssignmentList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3621; + this.match(MySqlParser.KW_SET); + this.state = 3622; + localContext._setFirst = this.updatedElement(); + this.state = 3627; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3623; + this.match(MySqlParser.COMMA); + this.state = 3624; + localContext._updatedElement = this.updatedElement(); + localContext._setElements.push(localContext._updatedElement); + } + } + this.state = 3629; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + updatedElement() { + let localContext = new UpdatedElementContext(this.context, this.state); + this.enterRule(localContext, 228, MySqlParser.RULE_updatedElement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3630; + this.columnName(); + this.state = 3631; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 3632; + this.expressionOrDefault(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + assignmentField() { + let localContext = new AssignmentFieldContext(this.context, this.state); + this.enterRule(localContext, 230, MySqlParser.RULE_assignmentField); + try { + this.state = 3636; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 1); + { + this.state = 3634; + localContext._var_name = this.uid(); + } + break; + case MySqlParser.LOCAL_ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 3635; + this.match(MySqlParser.LOCAL_ID); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockClause() { + let localContext = new LockClauseContext(this.context, this.state); + this.enterRule(localContext, 232, MySqlParser.RULE_lockClause); + let _la; + try { + let alternative; + this.state = 3659; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FOR: + this.enterOuterAlt(localContext, 1); + { + this.state = 3638; + this.match(MySqlParser.KW_FOR); + this.state = 3639; + _la = this.tokenStream.LA(1); + if (!(_la === 185 || _la === 594)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3649; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 490, this.context)) { + case 1: + { + this.state = 3640; + this.match(MySqlParser.KW_OF); + this.state = 3641; + this.tableName(); + this.state = 3646; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 489, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3642; + this.match(MySqlParser.COMMA); + this.state = 3643; + this.tableName(); + } + } + } + this.state = 3648; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 489, this.context); + } + } + break; + } + this.state = 3653; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 491, this.context)) { + case 1: + { + this.state = 3651; + _la = this.tokenStream.LA(1); + if (!(_la === 159 || _la === 503)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3652; + this.match(MySqlParser.KW_LOCKED); + } + break; + } + } + break; + case MySqlParser.KW_LOCK: + this.enterOuterAlt(localContext, 2); + { + this.state = 3655; + this.match(MySqlParser.KW_LOCK); + this.state = 3656; + this.match(MySqlParser.KW_IN); + this.state = 3657; + this.match(MySqlParser.KW_SHARE); + this.state = 3658; + this.match(MySqlParser.KW_MODE); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + singleDeleteStatement() { + let localContext = new SingleDeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 234, MySqlParser.RULE_singleDeleteStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3661; + this.match(MySqlParser.KW_DELETE); + this.state = 3663; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3662; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3666; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 549) { + { + this.state = 3665; + this.match(MySqlParser.KW_QUICK); + } + } + this.state = 3669; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3668; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3671; + this.match(MySqlParser.KW_FROM); + this.state = 3672; + this.tableName(); + this.state = 3677; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 497, this.context)) { + case 1: + { + this.state = 3674; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3673; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3676; + localContext._table_alias = this.uid(); + } + break; + } + this.state = 3684; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 3679; + this.match(MySqlParser.KW_PARTITION); + this.state = 3680; + this.match(MySqlParser.LR_BRACKET); + this.state = 3681; + this.partitionNames(); + this.state = 3682; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 3688; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3686; + this.match(MySqlParser.KW_WHERE); + this.state = 3687; + this.expression(0); + } + } + this.state = 3691; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3690; + this.orderByClause(); + } + } + this.state = 3695; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3693; + this.match(MySqlParser.KW_LIMIT); + this.state = 3694; + this.limitClauseAtom(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + multipleDeleteStatement() { + let localContext = new MultipleDeleteStatementContext(this.context, this.state); + this.enterRule(localContext, 236, MySqlParser.RULE_multipleDeleteStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3697; + this.match(MySqlParser.KW_DELETE); + this.state = 3699; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3698; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3702; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 503, this.context)) { + case 1: + { + this.state = 3701; + this.match(MySqlParser.KW_QUICK); + } + break; + } + this.state = 3705; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3704; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3746; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 3707; + this.tableName(); + this.state = 3710; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3708; + this.match(MySqlParser.DOT); + this.state = 3709; + this.match(MySqlParser.STAR); + } + } + this.state = 3720; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3712; + this.match(MySqlParser.COMMA); + this.state = 3713; + this.tableName(); + this.state = 3716; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3714; + this.match(MySqlParser.DOT); + this.state = 3715; + this.match(MySqlParser.STAR); + } + } + } + } + this.state = 3722; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3723; + this.match(MySqlParser.KW_FROM); + this.state = 3724; + this.tableSources(); + } + break; + case MySqlParser.KW_FROM: + { + this.state = 3726; + this.match(MySqlParser.KW_FROM); + this.state = 3727; + this.tableName(); + this.state = 3730; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3728; + this.match(MySqlParser.DOT); + this.state = 3729; + this.match(MySqlParser.STAR); + } + } + this.state = 3740; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3732; + this.match(MySqlParser.COMMA); + this.state = 3733; + this.tableName(); + this.state = 3736; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 3734; + this.match(MySqlParser.DOT); + this.state = 3735; + this.match(MySqlParser.STAR); + } + } + } + } + this.state = 3742; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3743; + this.match(MySqlParser.KW_USING); + this.state = 3744; + this.tableSources(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 3750; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3748; + this.match(MySqlParser.KW_WHERE); + this.state = 3749; + this.expression(0); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerOpenStatement() { + let localContext = new HandlerOpenStatementContext(this.context, this.state); + this.enterRule(localContext, 238, MySqlParser.RULE_handlerOpenStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3752; + this.match(MySqlParser.KW_HANDLER); + this.state = 3753; + this.tableName(); + this.state = 3754; + this.match(MySqlParser.KW_OPEN); + this.state = 3759; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 514, this.context)) { + case 1: + { + this.state = 3756; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3755; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3758; + localContext._table_alias = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerReadIndexStatement() { + let localContext = new HandlerReadIndexStatementContext(this.context, this.state); + this.enterRule(localContext, 240, MySqlParser.RULE_handlerReadIndexStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3761; + this.match(MySqlParser.KW_HANDLER); + this.state = 3762; + this.tableName(); + this.state = 3763; + this.match(MySqlParser.KW_READ); + this.state = 3764; + this.indexName(); + this.state = 3771; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.EQUAL_SYMBOL: + case MySqlParser.GREATER_SYMBOL: + case MySqlParser.LESS_SYMBOL: + { + this.state = 3765; + this.comparisonBase(); + this.state = 3766; + this.match(MySqlParser.LR_BRACKET); + this.state = 3767; + this.constants(); + this.state = 3768; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_FIRST: + case MySqlParser.KW_LAST: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_PREV: + { + this.state = 3770; + localContext._moveOrder = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 402 || _la === 445 || _la === 501 || _la === 542)) { + localContext._moveOrder = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 3775; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3773; + this.match(MySqlParser.KW_WHERE); + this.state = 3774; + this.expression(0); + } + } + this.state = 3779; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3777; + this.match(MySqlParser.KW_LIMIT); + this.state = 3778; + this.limitClauseAtom(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerReadStatement() { + let localContext = new HandlerReadStatementContext(this.context, this.state); + this.enterRule(localContext, 242, MySqlParser.RULE_handlerReadStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3781; + this.match(MySqlParser.KW_HANDLER); + this.state = 3782; + this.tableName(); + this.state = 3783; + this.match(MySqlParser.KW_READ); + this.state = 3784; + localContext._moveOrder = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 402 || _la === 501)) { + localContext._moveOrder = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3787; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3785; + this.match(MySqlParser.KW_WHERE); + this.state = 3786; + this.expression(0); + } + } + this.state = 3791; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3789; + this.match(MySqlParser.KW_LIMIT); + this.state = 3790; + this.limitClauseAtom(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerCloseStatement() { + let localContext = new HandlerCloseStatementContext(this.context, this.state); + this.enterRule(localContext, 244, MySqlParser.RULE_handlerCloseStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3793; + this.match(MySqlParser.KW_HANDLER); + this.state = 3794; + this.tableName(); + this.state = 3795; + this.match(MySqlParser.KW_CLOSE); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + importTableStatement() { + let localContext = new ImportTableStatementContext(this.context, this.state); + this.enterRule(localContext, 246, MySqlParser.RULE_importTableStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3797; + this.match(MySqlParser.KW_IMPORT); + this.state = 3798; + this.match(MySqlParser.KW_TABLE); + this.state = 3799; + this.match(MySqlParser.KW_FROM); + this.state = 3800; + this.stringLiteral(); + this.state = 3805; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3801; + this.match(MySqlParser.COMMA); + this.state = 3802; + this.stringLiteral(); + } + } + this.state = 3807; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + singleUpdateStatement() { + let localContext = new SingleUpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 248, MySqlParser.RULE_singleUpdateStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3808; + this.match(MySqlParser.KW_UPDATE); + this.state = 3810; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3809; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3813; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3812; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3815; + this.tableName(); + this.state = 3820; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074311168) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 3817; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3816; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3819; + localContext._table_alias = this.uid(); + } + } + this.state = 3822; + this.match(MySqlParser.KW_SET); + this.state = 3823; + this.updatedElement(); + this.state = 3828; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3824; + this.match(MySqlParser.COMMA); + this.state = 3825; + this.updatedElement(); + } + } + this.state = 3830; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3833; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3831; + this.match(MySqlParser.KW_WHERE); + this.state = 3832; + this.expression(0); + } + } + this.state = 3836; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 3835; + this.orderByClause(); + } + } + this.state = 3839; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 3838; + this.limitClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + multipleUpdateStatement() { + let localContext = new MultipleUpdateStatementContext(this.context, this.state); + this.enterRule(localContext, 250, MySqlParser.RULE_multipleUpdateStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3841; + this.match(MySqlParser.KW_UPDATE); + this.state = 3843; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 3842; + localContext._priority = this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 3846; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 3845; + this.match(MySqlParser.KW_IGNORE); + } + } + this.state = 3848; + this.tableSources(); + this.state = 3849; + this.match(MySqlParser.KW_SET); + this.state = 3850; + this.updatedElement(); + this.state = 3855; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 3851; + this.match(MySqlParser.COMMA); + this.state = 3852; + this.updatedElement(); + } + } + this.state = 3857; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3860; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 3858; + this.match(MySqlParser.KW_WHERE); + this.state = 3859; + this.expression(0); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + orderByClause() { + let localContext = new OrderByClauseContext(this.context, this.state); + this.enterRule(localContext, 252, MySqlParser.RULE_orderByClause); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3862; + this.match(MySqlParser.KW_ORDER); + this.state = 3863; + this.match(MySqlParser.KW_BY); + this.state = 3864; + this.orderByExpression(); + this.state = 3869; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 533, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3865; + this.match(MySqlParser.COMMA); + this.state = 3866; + this.orderByExpression(); + } + } + } + this.state = 3871; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 533, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + orderByExpression() { + let localContext = new OrderByExpressionContext(this.context, this.state); + this.enterRule(localContext, 254, MySqlParser.RULE_orderByExpression); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3872; + this.expression(0); + this.state = 3874; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 534, this.context)) { + case 1: + { + this.state = 3873; + localContext._order = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45)) { + localContext._order = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableSources() { + let localContext = new TableSourcesContext(this.context, this.state); + this.enterRule(localContext, 256, MySqlParser.RULE_tableSources); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 3876; + this.tableSource(); + this.state = 3881; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 535, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3877; + this.match(MySqlParser.COMMA); + this.state = 3878; + this.tableSource(); + } + } + } + this.state = 3883; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 535, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableSource() { + let localContext = new TableSourceContext(this.context, this.state); + this.enterRule(localContext, 258, MySqlParser.RULE_tableSource); + let _la; + try { + let alternative; + this.state = 3902; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 538, this.context)) { + case 1: + localContext = new TableSourceBaseContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3884; + this.tableSourceItem(); + this.state = 3888; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 536, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3885; + this.joinPart(); + } + } + } + this.state = 3890; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 536, this.context); + } + } + break; + case 2: + localContext = new TableSourceNestedContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3891; + this.match(MySqlParser.LR_BRACKET); + this.state = 3892; + this.tableSourceItem(); + this.state = 3896; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 35 || ((((_la - 84)) & ~0x1F) === 0 && ((1 << (_la - 84)) & 536887425) !== 0) || _la === 150 || _la === 172) { + { + { + this.state = 3893; + this.joinPart(); + } + } + this.state = 3898; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 3899; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 3: + localContext = new TableJsonContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 3901; + this.jsonTable(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableSourceItem() { + let localContext = new TableSourceItemContext(this.context, this.state); + this.enterRule(localContext, 260, MySqlParser.RULE_tableSourceItem); + let _la; + try { + let alternative; + this.state = 3949; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 548, this.context)) { + case 1: + localContext = new AtomTableItemContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3904; + this.tableName(); + this.state = 3910; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 539, this.context)) { + case 1: + { + this.state = 3905; + this.match(MySqlParser.KW_PARTITION); + this.state = 3906; + this.match(MySqlParser.LR_BRACKET); + this.state = 3907; + this.partitionNames(); + this.state = 3908; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3916; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 541, this.context)) { + case 1: + { + this.state = 3913; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3912; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3915; + localContext._alias = this.uid(); + } + break; + } + this.state = 3926; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 543, this.context)) { + case 1: + { + this.state = 3918; + this.indexHint(); + this.state = 3923; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 542, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3919; + this.match(MySqlParser.COMMA); + this.state = 3920; + this.indexHint(); + } + } + } + this.state = 3925; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 542, this.context); + } + } + break; + } + } + break; + case 2: + localContext = new SubqueryTableItemContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3929; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 95) { + { + this.state = 3928; + this.match(MySqlParser.KW_LATERAL); + } + } + this.state = 3936; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 545, this.context)) { + case 1: + { + this.state = 3931; + this.selectStatement(); + } + break; + case 2: + { + this.state = 3932; + this.match(MySqlParser.LR_BRACKET); + this.state = 3933; + localContext._parenthesisSubquery = this.selectStatement(); + this.state = 3934; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 3939; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 3938; + this.match(MySqlParser.KW_AS); + } + } + this.state = 3941; + localContext._alias = this.uid(); + this.state = 3943; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 547, this.context)) { + case 1: + { + this.state = 3942; + this.fullColumnNames(); + } + break; + } + } + break; + case 3: + localContext = new TableSourcesItemContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 3945; + this.match(MySqlParser.LR_BRACKET); + this.state = 3946; + this.tableSources(); + this.state = 3947; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fullColumnNames() { + let localContext = new FullColumnNamesContext(this.context, this.state); + this.enterRule(localContext, 262, MySqlParser.RULE_fullColumnNames); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3951; + this.match(MySqlParser.LR_BRACKET); + this.state = 3952; + this.columnNames(); + this.state = 3953; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexHint() { + let localContext = new IndexHintContext(this.context, this.state); + this.enterRule(localContext, 264, MySqlParser.RULE_indexHint); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 3955; + localContext._indexHintAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 66 || _la === 79 || _la === 187)) { + localContext._indexHintAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3956; + localContext._keyFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._keyFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3959; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 3957; + this.match(MySqlParser.KW_FOR); + this.state = 3958; + this.indexHintType(); + } + } + this.state = 3961; + this.match(MySqlParser.LR_BRACKET); + this.state = 3963; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 3962; + this.indexNames(); + } + } + this.state = 3965; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexHintType() { + let localContext = new IndexHintTypeContext(this.context, this.state); + this.enterRule(localContext, 266, MySqlParser.RULE_indexHintType); + try { + this.state = 3972; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_JOIN: + this.enterOuterAlt(localContext, 1); + { + this.state = 3967; + this.match(MySqlParser.KW_JOIN); + } + break; + case MySqlParser.KW_ORDER: + this.enterOuterAlt(localContext, 2); + { + this.state = 3968; + this.match(MySqlParser.KW_ORDER); + this.state = 3969; + this.match(MySqlParser.KW_BY); + } + break; + case MySqlParser.KW_GROUP: + this.enterOuterAlt(localContext, 3); + { + this.state = 3970; + this.match(MySqlParser.KW_GROUP); + this.state = 3971; + this.match(MySqlParser.KW_BY); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + joinPart() { + let localContext = new JoinPartContext(this.context, this.state); + this.enterRule(localContext, 268, MySqlParser.RULE_joinPart); + let _la; + try { + let alternative; + this.state = 4023; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CROSS: + case MySqlParser.KW_INNER: + case MySqlParser.KW_JOIN: + localContext = new InnerJoinContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 3975; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 35 || _la === 84) { + { + this.state = 3974; + _la = this.tokenStream.LA(1); + if (!(_la === 35 || _la === 84)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 3977; + this.match(MySqlParser.KW_JOIN); + this.state = 3979; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 553, this.context)) { + case 1: + { + this.state = 3978; + this.match(MySqlParser.KW_LATERAL); + } + break; + } + this.state = 3981; + this.tableSourceItem(); + this.state = 3985; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 554, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3982; + this.joinSpec(); + } + } + } + this.state = 3987; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 554, this.context); + } + } + break; + case MySqlParser.KW_STRAIGHT_JOIN: + localContext = new StraightJoinContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 3988; + this.match(MySqlParser.KW_STRAIGHT_JOIN); + this.state = 3989; + this.tableSourceItem(); + this.state = 3993; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 555, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 3990; + this.joinSpec(); + } + } + } + this.state = 3995; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 555, this.context); + } + } + break; + case MySqlParser.KW_LEFT: + case MySqlParser.KW_RIGHT: + localContext = new OuterJoinContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 3996; + _la = this.tokenStream.LA(1); + if (!(_la === 98 || _la === 150)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 3998; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 127) { + { + this.state = 3997; + this.match(MySqlParser.KW_OUTER); + } + } + this.state = 4000; + this.match(MySqlParser.KW_JOIN); + this.state = 4002; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 557, this.context)) { + case 1: + { + this.state = 4001; + this.match(MySqlParser.KW_LATERAL); + } + break; + } + this.state = 4004; + this.tableSourceItem(); + this.state = 4008; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 558, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4005; + this.joinSpec(); + } + } + } + this.state = 4010; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 558, this.context); + } + } + break; + case MySqlParser.KW_NATURAL: + localContext = new NaturalJoinContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4011; + this.match(MySqlParser.KW_NATURAL); + this.state = 4019; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 84 || _la === 98 || _la === 150) { + { + this.state = 4014; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_INNER: + { + this.state = 4012; + this.match(MySqlParser.KW_INNER); + } + break; + case MySqlParser.KW_LEFT: + case MySqlParser.KW_RIGHT: + { + this.state = 4013; + _la = this.tokenStream.LA(1); + if (!(_la === 98 || _la === 150)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4017; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 127) { + { + this.state = 4016; + this.match(MySqlParser.KW_OUTER); + } + } + } + } + this.state = 4021; + this.match(MySqlParser.KW_JOIN); + this.state = 4022; + this.tableSourceItem(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + joinSpec() { + let localContext = new JoinSpecContext(this.context, this.state); + this.enterRule(localContext, 270, MySqlParser.RULE_joinSpec); + try { + this.state = 4032; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ON: + this.enterOuterAlt(localContext, 1); + { + { + this.state = 4025; + this.match(MySqlParser.KW_ON); + this.state = 4026; + this.expression(0); + } + } + break; + case MySqlParser.KW_USING: + this.enterOuterAlt(localContext, 2); + { + this.state = 4027; + this.match(MySqlParser.KW_USING); + this.state = 4028; + this.match(MySqlParser.LR_BRACKET); + this.state = 4029; + this.columnNames(); + this.state = 4030; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + queryExpression() { + let localContext = new QueryExpressionContext(this.context, this.state); + this.enterRule(localContext, 272, MySqlParser.RULE_queryExpression); + try { + this.state = 4042; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 564, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4034; + this.match(MySqlParser.LR_BRACKET); + this.state = 4035; + this.querySpecification(); + this.state = 4036; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4038; + this.match(MySqlParser.LR_BRACKET); + this.state = 4039; + this.queryExpression(); + this.state = 4040; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + querySpecification() { + let localContext = new QuerySpecificationContext(this.context, this.state); + this.enterRule(localContext, 274, MySqlParser.RULE_querySpecification); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4044; + this.match(MySqlParser.KW_SELECT); + this.state = 4048; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 565, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4045; + this.selectSpec(); + } + } + } + this.state = 4050; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 565, this.context); + } + this.state = 4051; + this.selectElements(); + this.state = 4053; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 566, this.context)) { + case 1: + { + this.state = 4052; + this.intoClause(); + } + break; + } + this.state = 4055; + this.fromClause(); + this.state = 4057; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 567, this.context)) { + case 1: + { + this.state = 4056; + this.groupByClause(); + } + break; + } + this.state = 4060; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 568, this.context)) { + case 1: + { + this.state = 4059; + this.havingClause(); + } + break; + } + this.state = 4063; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 569, this.context)) { + case 1: + { + this.state = 4062; + this.windowClause(); + } + break; + } + this.state = 4066; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 570, this.context)) { + case 1: + { + this.state = 4065; + this.orderByClause(); + } + break; + } + this.state = 4069; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 571, this.context)) { + case 1: + { + this.state = 4068; + this.limitClause(); + } + break; + } + this.state = 4072; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 572, this.context)) { + case 1: + { + this.state = 4071; + this.intoClause(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + unionStatement() { + let localContext = new UnionStatementContext(this.context, this.state); + this.enterRule(localContext, 276, MySqlParser.RULE_unionStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4074; + this.match(MySqlParser.KW_UNION); + this.state = 4076; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 49) { + { + this.state = 4075; + localContext._unionType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._unionType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 4080; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + { + this.state = 4078; + this.querySpecification(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 4079; + this.queryExpression(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lateralStatement() { + let localContext = new LateralStatementContext(this.context, this.state); + this.enterRule(localContext, 278, MySqlParser.RULE_lateralStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4082; + this.match(MySqlParser.KW_LATERAL); + this.state = 4097; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 578, this.context)) { + case 1: + { + this.state = 4083; + this.querySpecification(); + } + break; + case 2: + { + this.state = 4084; + this.queryExpression(); + } + break; + case 3: + { + { + this.state = 4085; + this.match(MySqlParser.LR_BRACKET); + this.state = 4088; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + { + this.state = 4086; + this.querySpecification(); + } + break; + case MySqlParser.LR_BRACKET: + { + this.state = 4087; + this.queryExpression(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4090; + this.match(MySqlParser.RR_BRACKET); + this.state = 4095; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 577, this.context)) { + case 1: + { + this.state = 4092; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4091; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4094; + localContext._alias = this.uid(); + } + break; + } + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonTable() { + let localContext = new JsonTableContext(this.context, this.state); + this.enterRule(localContext, 280, MySqlParser.RULE_jsonTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4099; + this.match(MySqlParser.KW_JSON_TABLE); + this.state = 4100; + this.match(MySqlParser.LR_BRACKET); + this.state = 4101; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4102; + this.match(MySqlParser.COMMA); + this.state = 4103; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4104; + this.match(MySqlParser.KW_COLUMNS); + this.state = 4105; + this.match(MySqlParser.LR_BRACKET); + this.state = 4106; + this.jsonColumnList(); + this.state = 4107; + this.match(MySqlParser.RR_BRACKET); + this.state = 4108; + this.match(MySqlParser.RR_BRACKET); + this.state = 4113; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 580, this.context)) { + case 1: + { + this.state = 4110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4109; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4112; + localContext._alias = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonColumnList() { + let localContext = new JsonColumnListContext(this.context, this.state); + this.enterRule(localContext, 282, MySqlParser.RULE_jsonColumnList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4115; + this.jsonColumn(); + this.state = 4120; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4116; + this.match(MySqlParser.COMMA); + this.state = 4117; + this.jsonColumn(); + } + } + this.state = 4122; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonColumn() { + let localContext = new JsonColumnContext(this.context, this.state); + this.enterRule(localContext, 284, MySqlParser.RULE_jsonColumn); + let _la; + try { + this.state = 4152; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 587, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4123; + this.columnName(); + this.state = 4140; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FOR: + { + this.state = 4124; + this.match(MySqlParser.KW_FOR); + this.state = 4125; + this.match(MySqlParser.KW_ORDINALITY); + } + break; + case MySqlParser.KW_CHARACTER: + case MySqlParser.KW_SET: + case MySqlParser.KW_TINYINT: + case MySqlParser.KW_SMALLINT: + case MySqlParser.KW_MEDIUMINT: + case MySqlParser.KW_MIDDLEINT: + case MySqlParser.KW_INT: + case MySqlParser.KW_INT1: + case MySqlParser.KW_INT2: + case MySqlParser.KW_INT3: + case MySqlParser.KW_INT4: + case MySqlParser.KW_INT8: + case MySqlParser.KW_INTEGER: + case MySqlParser.KW_BIGINT: + case MySqlParser.KW_REAL: + case MySqlParser.KW_DOUBLE: + case MySqlParser.KW_FLOAT: + case MySqlParser.KW_FLOAT4: + case MySqlParser.KW_FLOAT8: + case MySqlParser.KW_DECIMAL: + case MySqlParser.KW_DEC: + case MySqlParser.KW_NUMERIC: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_CHAR: + case MySqlParser.KW_VARCHAR: + case MySqlParser.KW_NVARCHAR: + case MySqlParser.KW_NATIONAL: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_VARBINARY: + case MySqlParser.KW_TINYBLOB: + case MySqlParser.KW_BLOB: + case MySqlParser.KW_MEDIUMBLOB: + case MySqlParser.KW_LONG: + case MySqlParser.KW_LONGBLOB: + case MySqlParser.KW_TINYTEXT: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_MEDIUMTEXT: + case MySqlParser.KW_LONGTEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_JSON: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_GEOMCOLLECTION: + case MySqlParser.KW_GEOMETRY: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + { + this.state = 4126; + this.dataType(); + this.state = 4138; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PATH: + { + this.state = 4127; + this.match(MySqlParser.KW_PATH); + this.state = 4128; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4130; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 582, this.context)) { + case 1: + { + this.state = 4129; + this.jsonOnEmpty(); + } + break; + } + this.state = 4133; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42 || _la === 116 || _la === 382) { + { + this.state = 4132; + this.jsonOnError(); + } + } + } + break; + case MySqlParser.KW_EXISTS: + { + this.state = 4135; + this.match(MySqlParser.KW_EXISTS); + this.state = 4136; + this.match(MySqlParser.KW_PATH); + this.state = 4137; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4142; + this.match(MySqlParser.KW_NESTED); + this.state = 4144; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 257) { + { + this.state = 4143; + this.match(MySqlParser.KW_PATH); + } + } + this.state = 4146; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4147; + this.match(MySqlParser.KW_COLUMNS); + this.state = 4148; + this.match(MySqlParser.LR_BRACKET); + this.state = 4149; + this.jsonColumnList(); + this.state = 4150; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonOnEmpty() { + let localContext = new JsonOnEmptyContext(this.context, this.state); + this.enterRule(localContext, 286, MySqlParser.RULE_jsonOnEmpty); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4158; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NULL_LITERAL: + { + this.state = 4154; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case MySqlParser.KW_ERROR: + { + this.state = 4155; + this.match(MySqlParser.KW_ERROR); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 4156; + this.match(MySqlParser.KW_DEFAULT); + this.state = 4157; + this.defaultValue(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4160; + this.match(MySqlParser.KW_ON); + this.state = 4161; + this.match(MySqlParser.KW_EMPTY); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonOnError() { + let localContext = new JsonOnErrorContext(this.context, this.state); + this.enterRule(localContext, 288, MySqlParser.RULE_jsonOnError); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4167; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NULL_LITERAL: + { + this.state = 4163; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case MySqlParser.KW_ERROR: + { + this.state = 4164; + this.match(MySqlParser.KW_ERROR); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 4165; + this.match(MySqlParser.KW_DEFAULT); + this.state = 4166; + this.defaultValue(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4169; + this.match(MySqlParser.KW_ON); + this.state = 4170; + this.match(MySqlParser.KW_ERROR); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectSpec() { + let localContext = new SelectSpecContext(this.context, this.state); + this.enterRule(localContext, 290, MySqlParser.RULE_selectSpec); + let _la; + try { + this.state = 4180; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALL: + case MySqlParser.KW_DISTINCT: + case MySqlParser.KW_DISTINCTROW: + this.enterOuterAlt(localContext, 1); + { + this.state = 4172; + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49 || _la === 50)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_HIGH_PRIORITY: + this.enterOuterAlt(localContext, 2); + { + this.state = 4173; + this.match(MySqlParser.KW_HIGH_PRIORITY); + } + break; + case MySqlParser.KW_STRAIGHT_JOIN: + this.enterOuterAlt(localContext, 3); + { + this.state = 4174; + this.match(MySqlParser.KW_STRAIGHT_JOIN); + } + break; + case MySqlParser.KW_SQL_SMALL_RESULT: + this.enterOuterAlt(localContext, 4); + { + this.state = 4175; + this.match(MySqlParser.KW_SQL_SMALL_RESULT); + } + break; + case MySqlParser.KW_SQL_BIG_RESULT: + this.enterOuterAlt(localContext, 5); + { + this.state = 4176; + this.match(MySqlParser.KW_SQL_BIG_RESULT); + } + break; + case MySqlParser.KW_SQL_BUFFER_RESULT: + this.enterOuterAlt(localContext, 6); + { + this.state = 4177; + this.match(MySqlParser.KW_SQL_BUFFER_RESULT); + } + break; + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + this.enterOuterAlt(localContext, 7); + { + this.state = 4178; + _la = this.tokenStream.LA(1); + if (!(_la === 637 || _la === 638)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_SQL_CALC_FOUND_ROWS: + this.enterOuterAlt(localContext, 8); + { + this.state = 4179; + this.match(MySqlParser.KW_SQL_CALC_FOUND_ROWS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectElements() { + let localContext = new SelectElementsContext(this.context, this.state); + this.enterRule(localContext, 292, MySqlParser.RULE_selectElements); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4184; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 591, this.context)) { + case 1: + { + this.state = 4182; + localContext._star = this.match(MySqlParser.STAR); + } + break; + case 2: + { + this.state = 4183; + this.selectElement(); + } + break; + } + this.state = 4190; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 592, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4186; + this.match(MySqlParser.COMMA); + this.state = 4187; + this.selectElement(); + } + } + } + this.state = 4192; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 592, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectElement() { + let localContext = new SelectElementContext(this.context, this.state); + this.enterRule(localContext, 294, MySqlParser.RULE_selectElement); + let _la; + try { + this.state = 4222; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 600, this.context)) { + case 1: + localContext = new SelectExpressionElementContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4195; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 593, this.context)) { + case 1: + { + this.state = 4193; + this.match(MySqlParser.LOCAL_ID); + this.state = 4194; + this.match(MySqlParser.VAR_ASSIGN); + } + break; + } + this.state = 4197; + this.expression(0); + this.state = 4202; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 595, this.context)) { + case 1: + { + this.state = 4199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4198; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4201; + localContext._alias = this.uid(); + } + break; + } + } + break; + case 2: + localContext = new SelectFunctionElementContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4204; + this.functionCall(); + this.state = 4209; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 597, this.context)) { + case 1: + { + this.state = 4206; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4205; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4208; + localContext._alias = this.uid(); + } + break; + } + } + break; + case 3: + localContext = new SelectStarElementContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4211; + localContext._select_element = this.fullId(); + this.state = 4212; + this.match(MySqlParser.DOT); + this.state = 4213; + this.match(MySqlParser.STAR); + } + break; + case 4: + localContext = new SelectColumnElementContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4215; + this.columnName(); + this.state = 4220; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 599, this.context)) { + case 1: + { + this.state = 4217; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4216; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4219; + localContext._alias = this.uid(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intoClause() { + let localContext = new IntoClauseContext(this.context, this.state); + this.enterRule(localContext, 296, MySqlParser.RULE_intoClause); + let _la; + try { + let alternative; + this.state = 4260; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 607, this.context)) { + case 1: + localContext = new SelectIntoVariablesContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4224; + this.match(MySqlParser.KW_INTO); + this.state = 4225; + this.assignmentField(); + this.state = 4230; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 601, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4226; + this.match(MySqlParser.COMMA); + this.state = 4227; + this.assignmentField(); + } + } + } + this.state = 4232; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 601, this.context); + } + } + break; + case 2: + localContext = new SelectIntoDumpFileContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4233; + this.match(MySqlParser.KW_INTO); + this.state = 4234; + this.match(MySqlParser.KW_DUMPFILE); + this.state = 4235; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 3: + localContext = new SelectIntoTextFileContext(localContext); + this.enterOuterAlt(localContext, 3); + { + { + this.state = 4236; + this.match(MySqlParser.KW_INTO); + this.state = 4237; + this.match(MySqlParser.KW_OUTFILE); + this.state = 4238; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + this.state = 4242; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 602, this.context)) { + case 1: + { + this.state = 4239; + this.match(MySqlParser.KW_CHARACTER); + this.state = 4240; + this.match(MySqlParser.KW_SET); + this.state = 4241; + localContext._charset = this.charsetName(); + } + break; + } + this.state = 4250; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 604, this.context)) { + case 1: + { + this.state = 4244; + localContext._fieldsFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 337 || _la === 398)) { + localContext._fieldsFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4246; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4245; + this.selectFieldsInto(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4248; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 603, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + } + this.state = 4258; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 606, this.context)) { + case 1: + { + this.state = 4252; + this.match(MySqlParser.KW_LINES); + this.state = 4254; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4253; + this.selectLinesInto(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4256; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 605, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectFieldsInto() { + let localContext = new SelectFieldsIntoContext(this.context, this.state); + this.enterRule(localContext, 298, MySqlParser.RULE_selectFieldsInto); + let _la; + try { + this.state = 4274; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TERMINATED: + this.enterOuterAlt(localContext, 1); + { + this.state = 4262; + this.match(MySqlParser.KW_TERMINATED); + this.state = 4263; + this.match(MySqlParser.KW_BY); + this.state = 4264; + localContext._terminationField = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ENCLOSED: + case MySqlParser.KW_OPTIONALLY: + this.enterOuterAlt(localContext, 2); + { + this.state = 4266; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 123) { + { + this.state = 4265; + this.match(MySqlParser.KW_OPTIONALLY); + } + } + this.state = 4268; + this.match(MySqlParser.KW_ENCLOSED); + this.state = 4269; + this.match(MySqlParser.KW_BY); + this.state = 4270; + localContext._enclosion = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ESCAPED: + this.enterOuterAlt(localContext, 3); + { + this.state = 4271; + this.match(MySqlParser.KW_ESCAPED); + this.state = 4272; + this.match(MySqlParser.KW_BY); + this.state = 4273; + localContext._escaping = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + selectLinesInto() { + let localContext = new SelectLinesIntoContext(this.context, this.state); + this.enterRule(localContext, 300, MySqlParser.RULE_selectLinesInto); + try { + this.state = 4282; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_STARTING: + this.enterOuterAlt(localContext, 1); + { + this.state = 4276; + this.match(MySqlParser.KW_STARTING); + this.state = 4277; + this.match(MySqlParser.KW_BY); + this.state = 4278; + localContext._starting = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_TERMINATED: + this.enterOuterAlt(localContext, 2); + { + this.state = 4279; + this.match(MySqlParser.KW_TERMINATED); + this.state = 4280; + this.match(MySqlParser.KW_BY); + this.state = 4281; + localContext._terminationLine = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fromClause() { + let localContext = new FromClauseContext(this.context, this.state); + this.enterRule(localContext, 302, MySqlParser.RULE_fromClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4286; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 611, this.context)) { + case 1: + { + this.state = 4284; + this.match(MySqlParser.KW_FROM); + this.state = 4285; + this.tableSources(); + } + break; + } + this.state = 4290; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 612, this.context)) { + case 1: + { + this.state = 4288; + this.match(MySqlParser.KW_WHERE); + this.state = 4289; + localContext._whereExpr = this.expression(0); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupByClause() { + let localContext = new GroupByClauseContext(this.context, this.state); + this.enterRule(localContext, 304, MySqlParser.RULE_groupByClause); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4292; + this.match(MySqlParser.KW_GROUP); + this.state = 4293; + this.match(MySqlParser.KW_BY); + this.state = 4294; + this.groupByItem(); + this.state = 4299; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 613, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4295; + this.match(MySqlParser.COMMA); + this.state = 4296; + this.groupByItem(); + } + } + } + this.state = 4301; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 613, this.context); + } + this.state = 4304; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 614, this.context)) { + case 1: + { + this.state = 4302; + this.match(MySqlParser.KW_WITH); + this.state = 4303; + this.match(MySqlParser.KW_ROLLUP); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + havingClause() { + let localContext = new HavingClauseContext(this.context, this.state); + this.enterRule(localContext, 306, MySqlParser.RULE_havingClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4306; + this.match(MySqlParser.KW_HAVING); + this.state = 4307; + localContext._havingExpr = this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + windowClause() { + let localContext = new WindowClauseContext(this.context, this.state); + this.enterRule(localContext, 308, MySqlParser.RULE_windowClause); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4309; + this.match(MySqlParser.KW_WINDOW); + this.state = 4310; + this.windowName(); + this.state = 4311; + this.match(MySqlParser.KW_AS); + this.state = 4312; + this.match(MySqlParser.LR_BRACKET); + this.state = 4313; + this.windowSpec(); + this.state = 4314; + this.match(MySqlParser.RR_BRACKET); + this.state = 4324; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 615, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4315; + this.match(MySqlParser.COMMA); + this.state = 4316; + this.windowName(); + this.state = 4317; + this.match(MySqlParser.KW_AS); + this.state = 4318; + this.match(MySqlParser.LR_BRACKET); + this.state = 4319; + this.windowSpec(); + this.state = 4320; + this.match(MySqlParser.RR_BRACKET); + } + } + } + this.state = 4326; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 615, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupByItem() { + let localContext = new GroupByItemContext(this.context, this.state); + this.enterRule(localContext, 310, MySqlParser.RULE_groupByItem); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4327; + this.expression(0); + this.state = 4329; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 616, this.context)) { + case 1: + { + this.state = 4328; + localContext._order = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45)) { + localContext._order = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + limitClause() { + let localContext = new LimitClauseContext(this.context, this.state); + this.enterRule(localContext, 312, MySqlParser.RULE_limitClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4331; + this.match(MySqlParser.KW_LIMIT); + this.state = 4342; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 618, this.context)) { + case 1: + { + this.state = 4335; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 617, this.context)) { + case 1: + { + this.state = 4332; + localContext._offset = this.limitClauseAtom(); + this.state = 4333; + this.match(MySqlParser.COMMA); + } + break; + } + this.state = 4337; + localContext._limit = this.limitClauseAtom(); + } + break; + case 2: + { + this.state = 4338; + localContext._limit = this.limitClauseAtom(); + this.state = 4339; + this.match(MySqlParser.KW_OFFSET); + this.state = 4340; + localContext._offset = this.limitClauseAtom(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + limitClauseAtom() { + let localContext = new LimitClauseAtomContext(this.context, this.state); + this.enterRule(localContext, 314, MySqlParser.RULE_limitClauseAtom); + try { + this.state = 4347; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 4344; + this.decimalLiteral(); + } + break; + case MySqlParser.LOCAL_ID: + case MySqlParser.GLOBAL_ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 4345; + this.mysqlVariable(); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 3); + { + this.state = 4346; + this.simpleId(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + startTransaction() { + let localContext = new StartTransactionContext(this.context, this.state); + this.enterRule(localContext, 316, MySqlParser.RULE_startTransaction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4349; + this.match(MySqlParser.KW_START); + this.state = 4350; + this.match(MySqlParser.KW_TRANSACTION); + this.state = 4359; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 621, this.context)) { + case 1: + { + this.state = 4351; + this.transactionMode(); + this.state = 4356; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4352; + this.match(MySqlParser.COMMA); + this.state = 4353; + this.transactionMode(); + } + } + this.state = 4358; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + beginWork() { + let localContext = new BeginWorkContext(this.context, this.state); + this.enterRule(localContext, 318, MySqlParser.RULE_beginWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4361; + this.match(MySqlParser.KW_BEGIN); + this.state = 4363; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4362; + this.match(MySqlParser.KW_WORK); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + commitWork() { + let localContext = new CommitWorkContext(this.context, this.state); + this.enterRule(localContext, 320, MySqlParser.RULE_commitWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4365; + this.match(MySqlParser.KW_COMMIT); + this.state = 4367; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4366; + this.match(MySqlParser.KW_WORK); + } + } + this.state = 4374; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 4369; + this.match(MySqlParser.KW_AND); + this.state = 4371; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4370; + localContext._nochain = this.match(MySqlParser.KW_NO); + } + } + this.state = 4373; + this.match(MySqlParser.KW_CHAIN); + } + } + this.state = 4380; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 627, this.context)) { + case 1: + { + this.state = 4377; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4376; + localContext._norelease = this.match(MySqlParser.KW_NO); + } + } + this.state = 4379; + this.match(MySqlParser.KW_RELEASE); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + rollbackWork() { + let localContext = new RollbackWorkContext(this.context, this.state); + this.enterRule(localContext, 322, MySqlParser.RULE_rollbackWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4382; + this.match(MySqlParser.KW_ROLLBACK); + this.state = 4384; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4383; + this.match(MySqlParser.KW_WORK); + } + } + this.state = 4391; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 4386; + this.match(MySqlParser.KW_AND); + this.state = 4388; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4387; + localContext._nochain = this.match(MySqlParser.KW_NO); + } + } + this.state = 4390; + this.match(MySqlParser.KW_CHAIN); + } + } + this.state = 4397; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 632, this.context)) { + case 1: + { + this.state = 4394; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 4393; + localContext._norelease = this.match(MySqlParser.KW_NO); + } + } + this.state = 4396; + this.match(MySqlParser.KW_RELEASE); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + savepointStatement() { + let localContext = new SavepointStatementContext(this.context, this.state); + this.enterRule(localContext, 324, MySqlParser.RULE_savepointStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4399; + this.match(MySqlParser.KW_SAVEPOINT); + this.state = 4400; + localContext._identifier = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + rollbackStatement() { + let localContext = new RollbackStatementContext(this.context, this.state); + this.enterRule(localContext, 326, MySqlParser.RULE_rollbackStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4402; + this.match(MySqlParser.KW_ROLLBACK); + this.state = 4404; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 691) { + { + this.state = 4403; + this.match(MySqlParser.KW_WORK); + } + } + this.state = 4406; + this.match(MySqlParser.KW_TO); + this.state = 4408; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 634, this.context)) { + case 1: + { + this.state = 4407; + this.match(MySqlParser.KW_SAVEPOINT); + } + break; + } + this.state = 4410; + localContext._identifier = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + releaseStatement() { + let localContext = new ReleaseStatementContext(this.context, this.state); + this.enterRule(localContext, 328, MySqlParser.RULE_releaseStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4412; + this.match(MySqlParser.KW_RELEASE); + this.state = 4413; + this.match(MySqlParser.KW_SAVEPOINT); + this.state = 4414; + localContext._identifier = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockTables() { + let localContext = new LockTablesContext(this.context, this.state); + this.enterRule(localContext, 330, MySqlParser.RULE_lockTables); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4416; + this.match(MySqlParser.KW_LOCK); + this.state = 4417; + _la = this.tokenStream.LA(1); + if (!(_la === 173 || _la === 752)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4418; + this.lockTableElement(); + this.state = 4423; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4419; + this.match(MySqlParser.COMMA); + this.state = 4420; + this.lockTableElement(); + } + } + this.state = 4425; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + unlockTables() { + let localContext = new UnlockTablesContext(this.context, this.state); + this.enterRule(localContext, 332, MySqlParser.RULE_unlockTables); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4426; + this.match(MySqlParser.KW_UNLOCK); + this.state = 4427; + this.match(MySqlParser.KW_TABLES); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setAutocommitStatement() { + let localContext = new SetAutocommitStatementContext(this.context, this.state); + this.enterRule(localContext, 334, MySqlParser.RULE_setAutocommitStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4429; + this.match(MySqlParser.KW_SET); + this.state = 4430; + this.match(MySqlParser.KW_AUTOCOMMIT); + this.state = 4431; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4432; + localContext._autocommitValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._autocommitValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setTransactionStatement() { + let localContext = new SetTransactionStatementContext(this.context, this.state); + this.enterRule(localContext, 336, MySqlParser.RULE_setTransactionStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4434; + this.match(MySqlParser.KW_SET); + this.state = 4436; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 413 || _la === 593) { + { + this.state = 4435; + localContext._transactionContext = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 593)) { + localContext._transactionContext = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 4438; + this.match(MySqlParser.KW_TRANSACTION); + this.state = 4439; + this.transactionOption(); + this.state = 4444; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4440; + this.match(MySqlParser.COMMA); + this.state = 4441; + this.transactionOption(); + } + } + this.state = 4446; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionMode() { + let localContext = new TransactionModeContext(this.context, this.state); + this.enterRule(localContext, 338, MySqlParser.RULE_transactionMode); + try { + this.state = 4454; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 638, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4447; + this.match(MySqlParser.KW_WITH); + this.state = 4448; + this.match(MySqlParser.KW_CONSISTENT); + this.state = 4449; + this.match(MySqlParser.KW_SNAPSHOT); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4450; + this.match(MySqlParser.KW_READ); + this.state = 4451; + this.match(MySqlParser.KW_WRITE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 4452; + this.match(MySqlParser.KW_READ); + this.state = 4453; + this.match(MySqlParser.KW_ONLY); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockTableElement() { + let localContext = new LockTableElementContext(this.context, this.state); + this.enterRule(localContext, 340, MySqlParser.RULE_lockTableElement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4456; + this.tableName(); + this.state = 4461; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074311168) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4458; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 4457; + this.match(MySqlParser.KW_AS); + } + } + this.state = 4460; + localContext._alias = this.uid(); + } + } + this.state = 4463; + this.lockAction(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lockAction() { + let localContext = new LockActionContext(this.context, this.state); + this.enterRule(localContext, 342, MySqlParser.RULE_lockAction); + let _la; + try { + this.state = 4473; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_READ: + this.enterOuterAlt(localContext, 1); + { + this.state = 4465; + this.match(MySqlParser.KW_READ); + this.state = 4467; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 450) { + { + this.state = 4466; + this.match(MySqlParser.KW_LOCAL); + } + } + } + break; + case MySqlParser.KW_LOW_PRIORITY: + case MySqlParser.KW_WRITE: + this.enterOuterAlt(localContext, 2); + { + this.state = 4470; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 107) { + { + this.state = 4469; + this.match(MySqlParser.KW_LOW_PRIORITY); + } + } + this.state = 4472; + this.match(MySqlParser.KW_WRITE); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionOption() { + let localContext = new TransactionOptionContext(this.context, this.state); + this.enterRule(localContext, 344, MySqlParser.RULE_transactionOption); + try { + this.state = 4482; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 644, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4475; + this.match(MySqlParser.KW_ISOLATION); + this.state = 4476; + this.match(MySqlParser.KW_LEVEL); + this.state = 4477; + this.transactionLevel(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4478; + this.match(MySqlParser.KW_READ); + this.state = 4479; + this.match(MySqlParser.KW_WRITE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 4480; + this.match(MySqlParser.KW_READ); + this.state = 4481; + this.match(MySqlParser.KW_ONLY); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionLevel() { + let localContext = new TransactionLevelContext(this.context, this.state); + this.enterRule(localContext, 346, MySqlParser.RULE_transactionLevel); + try { + this.state = 4491; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 645, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4484; + this.match(MySqlParser.KW_REPEATABLE); + this.state = 4485; + this.match(MySqlParser.KW_READ); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4486; + this.match(MySqlParser.KW_READ); + this.state = 4487; + this.match(MySqlParser.KW_COMMITTED); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 4488; + this.match(MySqlParser.KW_READ); + this.state = 4489; + this.match(MySqlParser.KW_UNCOMMITTED); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 4490; + this.match(MySqlParser.KW_SERIALIZABLE); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + changeMaster() { + let localContext = new ChangeMasterContext(this.context, this.state); + this.enterRule(localContext, 348, MySqlParser.RULE_changeMaster); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4493; + this.match(MySqlParser.KW_CHANGE); + this.state = 4494; + this.match(MySqlParser.KW_MASTER); + this.state = 4495; + this.match(MySqlParser.KW_TO); + this.state = 4496; + this.masterOption(); + this.state = 4501; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4497; + this.match(MySqlParser.COMMA); + this.state = 4498; + this.masterOption(); + } + } + this.state = 4503; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4505; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4504; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + changeReplicationFilter() { + let localContext = new ChangeReplicationFilterContext(this.context, this.state); + this.enterRule(localContext, 350, MySqlParser.RULE_changeReplicationFilter); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4507; + this.match(MySqlParser.KW_CHANGE); + this.state = 4508; + this.match(MySqlParser.KW_REPLICATION); + this.state = 4509; + this.match(MySqlParser.KW_FILTER); + this.state = 4510; + this.replicationFilter(); + this.state = 4515; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4511; + this.match(MySqlParser.COMMA); + this.state = 4512; + this.replicationFilter(); + } + } + this.state = 4517; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4519; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4518; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + changeReplicationSource() { + let localContext = new ChangeReplicationSourceContext(this.context, this.state); + this.enterRule(localContext, 352, MySqlParser.RULE_changeReplicationSource); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4521; + this.match(MySqlParser.KW_CHANGE); + this.state = 4522; + this.match(MySqlParser.KW_REPLICATION); + this.state = 4523; + this.match(MySqlParser.KW_SOURCE); + this.state = 4524; + this.match(MySqlParser.KW_TO); + this.state = 4525; + this.replicationSourceOption(); + this.state = 4530; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4526; + this.match(MySqlParser.COMMA); + this.state = 4527; + this.replicationSourceOption(); + } + } + this.state = 4532; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4534; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4533; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + purgeBinaryLogs() { + let localContext = new PurgeBinaryLogsContext(this.context, this.state); + this.enterRule(localContext, 354, MySqlParser.RULE_purgeBinaryLogs); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4536; + this.match(MySqlParser.KW_PURGE); + this.state = 4537; + localContext._purgeFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 228 || _la === 453)) { + localContext._purgeFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4538; + this.match(MySqlParser.KW_LOGS); + this.state = 4543; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TO: + { + this.state = 4539; + this.match(MySqlParser.KW_TO); + this.state = 4540; + localContext._fileName = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_BEFORE: + { + this.state = 4541; + this.match(MySqlParser.KW_BEFORE); + this.state = 4542; + localContext._timeValue = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + startSlaveOrReplica() { + let localContext = new StartSlaveOrReplicaContext(this.context, this.state); + this.enterRule(localContext, 356, MySqlParser.RULE_startSlaveOrReplica); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4545; + this.match(MySqlParser.KW_START); + this.state = 4546; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4555; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 438 || _la === 639) { + { + this.state = 4547; + this.threadType(); + this.state = 4552; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4548; + this.match(MySqlParser.COMMA); + this.state = 4549; + this.threadType(); + } + } + this.state = 4554; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4559; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 676) { + { + this.state = 4557; + this.match(MySqlParser.KW_UNTIL); + this.state = 4558; + this.untilOption(); + } + } + this.state = 4564; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 363 || _la === 529 || _la === 535 || _la === 678) { + { + { + this.state = 4561; + this.connectionOptions(); + } + } + this.state = 4566; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4568; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4567; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stopSlaveOrReplica() { + let localContext = new StopSlaveOrReplicaContext(this.context, this.state); + this.enterRule(localContext, 358, MySqlParser.RULE_stopSlaveOrReplica); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4570; + this.match(MySqlParser.KW_STOP); + this.state = 4571; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4580; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 438 || _la === 639) { + { + this.state = 4572; + this.threadType(); + this.state = 4577; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4573; + this.match(MySqlParser.COMMA); + this.state = 4574; + this.threadType(); + } + } + this.state = 4579; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4583; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4582; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + startGroupReplication() { + let localContext = new StartGroupReplicationContext(this.context, this.state); + this.enterRule(localContext, 360, MySqlParser.RULE_startGroupReplication); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4585; + this.match(MySqlParser.KW_START); + this.state = 4586; + this.match(MySqlParser.KW_GROUP_REPLICATION); + this.state = 4590; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 678) { + { + this.state = 4587; + this.match(MySqlParser.KW_USER); + this.state = 4588; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4589; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 4596; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 662, this.context)) { + case 1: + { + this.state = 4592; + this.match(MySqlParser.COMMA); + this.state = 4593; + this.match(MySqlParser.KW_PASSWORD); + this.state = 4594; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4595; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + this.state = 4602; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 4598; + this.match(MySqlParser.COMMA); + this.state = 4599; + this.match(MySqlParser.KW_DEFAULT_AUTH); + this.state = 4600; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4601; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stopGroupReplication() { + let localContext = new StopGroupReplicationContext(this.context, this.state); + this.enterRule(localContext, 362, MySqlParser.RULE_stopGroupReplication); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4604; + this.match(MySqlParser.KW_STOP); + this.state = 4605; + this.match(MySqlParser.KW_GROUP_REPLICATION); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + masterOption() { + let localContext = new MasterOptionContext(this.context, this.state); + this.enterRule(localContext, 364, MySqlParser.RULE_masterOption); + let _la; + try { + this.state = 4634; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_MASTER_BIND: + case MySqlParser.KW_MASTER_COMPRESSION_ALGORITHMS: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PUBLIC_KEY_PATH: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_CIPHERSUITES: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_NETWORK_NAMESPACE: + case MySqlParser.KW_RELAY_LOG_FILE: + localContext = new MasterStringOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4607; + this.stringMasterOption(); + this.state = 4608; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4609; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_ZSTD_COMPRESSION_LEVEL: + case MySqlParser.KW_RELAY_LOG_POS: + localContext = new MasterDecimalOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4611; + this.decimalMasterOption(); + this.state = 4612; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4613; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MASTER_SSL_VERIFY_SERVER_CERT: + case MySqlParser.KW_GET_MASTER_PUBLIC_KEY: + case MySqlParser.KW_GTID_ONLY: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_REQUIRE_ROW_FORMAT: + case MySqlParser.KW_SOURCE_CONNECTION_AUTO_FAILOVER: + localContext = new MasterBoolOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4615; + this.boolMasterOption(); + this.state = 4616; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4617; + localContext._boolVal = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolVal = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + localContext = new V8AddMasterOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4619; + this.v8NewMasterOption(); + } + break; + case MySqlParser.KW_IGNORE_SERVER_IDS: + localContext = new MasterUidListOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4620; + this.match(MySqlParser.KW_IGNORE_SERVER_IDS); + this.state = 4621; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4622; + this.match(MySqlParser.LR_BRACKET); + this.state = 4631; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4623; + localContext._server_id = this.uid(); + this.state = 4628; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4624; + this.match(MySqlParser.COMMA); + this.state = 4625; + localContext._server_id = this.uid(); + } + } + this.state = 4630; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4633; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stringMasterOption() { + let localContext = new StringMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 366, MySqlParser.RULE_stringMasterOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4636; + _la = this.tokenStream.LA(1); + if (!(_la === 108 || ((((_la - 455)) & ~0x1F) === 0 && ((1 << (_la - 455)) & 4190897) !== 0) || _la === 499 || _la === 557)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + decimalMasterOption() { + let localContext = new DecimalMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 368, MySqlParser.RULE_decimalMasterOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4638; + _la = this.tokenStream.LA(1); + if (!(((((_la - 456)) & ~0x1F) === 0 && ((1 << (_la - 456)) & 2097831) !== 0) || _la === 558)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + boolMasterOption() { + let localContext = new BoolMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 370, MySqlParser.RULE_boolMasterOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4640; + _la = this.tokenStream.LA(1); + if (!(_la === 109 || _la === 411 || _la === 416 || _la === 454 || _la === 466 || _la === 573 || _la === 617)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + v8NewMasterOption() { + let localContext = new V8NewMasterOptionContext(this.context, this.state); + this.enterRule(localContext, 372, MySqlParser.RULE_v8NewMasterOption); + let _la; + try { + this.state = 4655; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + this.enterOuterAlt(localContext, 1); + { + this.state = 4642; + this.match(MySqlParser.KW_PRIVILEGE_CHECKS_USER); + this.state = 4643; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4644; + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + this.enterOuterAlt(localContext, 2); + { + this.state = 4645; + this.match(MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK); + this.state = 4646; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4647; + _la = this.tokenStream.LA(1); + if (!(_la === 118 || _la === 119 || _la === 507)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + this.enterOuterAlt(localContext, 3); + { + this.state = 4648; + this.match(MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS); + this.state = 4649; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4653; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_OFF: + { + this.state = 4650; + this.match(MySqlParser.KW_OFF); + } + break; + case MySqlParser.KW_LOCAL: + { + this.state = 4651; + this.match(MySqlParser.KW_LOCAL); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.STRING_LITERAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 4652; + this.gtuidSet(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replicationSourceOption() { + let localContext = new ReplicationSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 374, MySqlParser.RULE_replicationSourceOption); + let _la; + try { + this.state = 4684; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NETWORK_NAMESPACE: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_SOURCE_BIND: + case MySqlParser.KW_SOURCE_HOST: + case MySqlParser.KW_SOURCE_USER: + case MySqlParser.KW_SOURCE_PASSWORD: + case MySqlParser.KW_SOURCE_LOG_FILE: + case MySqlParser.KW_SOURCE_COMPRESSION_ALGORITHMS: + case MySqlParser.KW_SOURCE_SSL_CA: + case MySqlParser.KW_SOURCE_SSL_CAPATH: + case MySqlParser.KW_SOURCE_SSL_CERT: + case MySqlParser.KW_SOURCE_SSL_CRL: + case MySqlParser.KW_SOURCE_SSL_CRLPATH: + case MySqlParser.KW_SOURCE_SSL_KEY: + case MySqlParser.KW_SOURCE_SSL_CIPHER: + case MySqlParser.KW_SOURCE_TLS_VERSION: + case MySqlParser.KW_SOURCE_TLS_CIPHERSUITES: + case MySqlParser.KW_SOURCE_PUBLIC_KEY_PATH: + localContext = new SourceStringOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4657; + this.stringSourceOption(); + this.state = 4658; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4659; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_SOURCE_PORT: + case MySqlParser.KW_SOURCE_LOG_POS: + case MySqlParser.KW_SOURCE_HEARTBEAT_PERIOD: + case MySqlParser.KW_SOURCE_CONNECT_RETRY: + case MySqlParser.KW_SOURCE_RETRY_COUNT: + case MySqlParser.KW_SOURCE_DELAY: + case MySqlParser.KW_SOURCE_ZSTD_COMPRESSION_LEVEL: + localContext = new SourceDecimalOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4661; + this.decimalSourceOption(); + this.state = 4662; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4663; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_GET_SOURCE_PUBLIC_KEY: + case MySqlParser.KW_GTID_ONLY: + case MySqlParser.KW_REQUIRE_ROW_FORMAT: + case MySqlParser.KW_SOURCE_AUTO_POSITION: + case MySqlParser.KW_SOURCE_CONNECTION_AUTO_FAILOVER: + case MySqlParser.KW_SOURCE_SSL: + case MySqlParser.KW_SOURCE_SSL_VERIFY_SERVER_CERT: + localContext = new SourceBoolOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4665; + this.boolSourceOption(); + this.state = 4666; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4667; + localContext._boolVal = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 871 || _la === 872)) { + localContext._boolVal = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + localContext = new SourceOtherOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4669; + this.otherSourceOption(); + } + break; + case MySqlParser.KW_IGNORE_SERVER_IDS: + localContext = new SourceUidListOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4670; + this.match(MySqlParser.KW_IGNORE_SERVER_IDS); + this.state = 4671; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4672; + this.match(MySqlParser.LR_BRACKET); + this.state = 4681; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4673; + localContext._server_id = this.uid(); + this.state = 4678; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4674; + this.match(MySqlParser.COMMA); + this.state = 4675; + localContext._server_id = this.uid(); + } + } + this.state = 4680; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 4683; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stringSourceOption() { + let localContext = new StringSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 376, MySqlParser.RULE_stringSourceOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4686; + _la = this.tokenStream.LA(1); + if (!(_la === 499 || _la === 557 || ((((_la - 606)) & ~0x1F) === 0 && ((1 << (_la - 606)) & 125771823) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + decimalSourceOption() { + let localContext = new DecimalSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 378, MySqlParser.RULE_decimalSourceOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4688; + _la = this.tokenStream.LA(1); + if (!(_la === 558 || ((((_la - 610)) & ~0x1F) === 0 && ((1 << (_la - 610)) & 1397) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + boolSourceOption() { + let localContext = new BoolSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 380, MySqlParser.RULE_boolSourceOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4690; + _la = this.tokenStream.LA(1); + if (!(_la === 412 || _la === 416 || _la === 573 || ((((_la - 613)) & ~0x1F) === 0 && ((1 << (_la - 613)) & 65809) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + otherSourceOption() { + let localContext = new OtherSourceOptionContext(this.context, this.state); + this.enterRule(localContext, 382, MySqlParser.RULE_otherSourceOption); + let _la; + try { + this.state = 4705; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_PRIVILEGE_CHECKS_USER: + this.enterOuterAlt(localContext, 1); + { + this.state = 4692; + this.match(MySqlParser.KW_PRIVILEGE_CHECKS_USER); + this.state = 4693; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4694; + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 882)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK: + this.enterOuterAlt(localContext, 2); + { + this.state = 4695; + this.match(MySqlParser.KW_REQUIRE_TABLE_PRIMARY_KEY_CHECK); + this.state = 4696; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4697; + _la = this.tokenStream.LA(1); + if (!(_la === 70 || _la === 118 || _la === 119 || _la === 507)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS: + this.enterOuterAlt(localContext, 3); + { + this.state = 4698; + this.match(MySqlParser.KW_ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS); + this.state = 4699; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4703; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_OFF: + { + this.state = 4700; + this.match(MySqlParser.KW_OFF); + } + break; + case MySqlParser.KW_LOCAL: + { + this.state = 4701; + this.match(MySqlParser.KW_LOCAL); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.STRING_LITERAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 4702; + this.gtuidSet(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + channelOption() { + let localContext = new ChannelOptionContext(this.context, this.state); + this.enterRule(localContext, 384, MySqlParser.RULE_channelOption); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4707; + this.match(MySqlParser.KW_FOR); + this.state = 4708; + this.match(MySqlParser.KW_CHANNEL); + this.state = 4709; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + replicationFilter() { + let localContext = new ReplicationFilterContext(this.context, this.state); + this.enterRule(localContext, 386, MySqlParser.RULE_replicationFilter); + let _la; + try { + this.state = 4774; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_REPLICATE_DO_DB: + localContext = new DoDbReplicationContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4711; + this.match(MySqlParser.KW_REPLICATE_DO_DB); + this.state = 4712; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4713; + this.match(MySqlParser.LR_BRACKET); + this.state = 4714; + this.databaseName(); + this.state = 4719; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4715; + this.match(MySqlParser.COMMA); + this.state = 4716; + this.databaseName(); + } + } + this.state = 4721; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4722; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_IGNORE_DB: + localContext = new IgnoreDbReplicationContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4724; + this.match(MySqlParser.KW_REPLICATE_IGNORE_DB); + this.state = 4725; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4726; + this.match(MySqlParser.LR_BRACKET); + this.state = 4727; + this.databaseName(); + this.state = 4732; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4728; + this.match(MySqlParser.COMMA); + this.state = 4729; + this.databaseName(); + } + } + this.state = 4734; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4735; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_DO_TABLE: + localContext = new DoTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4737; + this.match(MySqlParser.KW_REPLICATE_DO_TABLE); + this.state = 4738; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4739; + this.match(MySqlParser.LR_BRACKET); + this.state = 4740; + this.tableNames(); + this.state = 4741; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + localContext = new IgnoreTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4743; + this.match(MySqlParser.KW_REPLICATE_IGNORE_TABLE); + this.state = 4744; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4745; + this.match(MySqlParser.LR_BRACKET); + this.state = 4746; + this.tableNames(); + this.state = 4747; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + localContext = new WildDoTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4749; + this.match(MySqlParser.KW_REPLICATE_WILD_DO_TABLE); + this.state = 4750; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4751; + this.match(MySqlParser.LR_BRACKET); + this.state = 4752; + this.simpleStrings(); + this.state = 4753; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + localContext = new WildIgnoreTableReplicationContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 4755; + this.match(MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE); + this.state = 4756; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4757; + this.match(MySqlParser.LR_BRACKET); + this.state = 4758; + this.simpleStrings(); + this.state = 4759; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_REPLICATE_REWRITE_DB: + localContext = new RewriteDbReplicationContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 4761; + this.match(MySqlParser.KW_REPLICATE_REWRITE_DB); + this.state = 4762; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4763; + this.match(MySqlParser.LR_BRACKET); + this.state = 4764; + this.tablePair(); + this.state = 4769; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 4765; + this.match(MySqlParser.COMMA); + this.state = 4766; + this.tablePair(); + } + } + this.state = 4771; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4772; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablePair() { + let localContext = new TablePairContext(this.context, this.state); + this.enterRule(localContext, 388, MySqlParser.RULE_tablePair); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4776; + this.match(MySqlParser.LR_BRACKET); + this.state = 4777; + localContext._firstTable = this.tableName(); + this.state = 4778; + this.match(MySqlParser.COMMA); + this.state = 4779; + localContext._secondTable = this.tableName(); + this.state = 4780; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + threadType() { + let localContext = new ThreadTypeContext(this.context, this.state); + this.enterRule(localContext, 390, MySqlParser.RULE_threadType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4782; + _la = this.tokenStream.LA(1); + if (!(_la === 438 || _la === 639)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + untilOption() { + let localContext = new UntilOptionContext(this.context, this.state); + this.enterRule(localContext, 392, MySqlParser.RULE_untilOption); + let _la; + try { + this.state = 4809; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + localContext = new GtidsUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4784; + localContext._gtids = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 633 || _la === 635)) { + localContext._gtids = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4785; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4786; + this.gtuidSet(); + } + break; + case MySqlParser.KW_MASTER_LOG_FILE: + localContext = new MasterLogUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4787; + this.match(MySqlParser.KW_MASTER_LOG_FILE); + this.state = 4788; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4789; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4790; + this.match(MySqlParser.COMMA); + this.state = 4791; + this.match(MySqlParser.KW_MASTER_LOG_POS); + this.state = 4792; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4793; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SOURCE_LOG_FILE: + localContext = new SourceLogUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4794; + this.match(MySqlParser.KW_SOURCE_LOG_FILE); + this.state = 4795; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4796; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4797; + this.match(MySqlParser.COMMA); + this.state = 4798; + this.match(MySqlParser.KW_SOURCE_LOG_POS); + this.state = 4799; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4800; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_RELAY_LOG_FILE: + localContext = new RelayLogUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4801; + this.match(MySqlParser.KW_RELAY_LOG_FILE); + this.state = 4802; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4803; + this.match(MySqlParser.STRING_LITERAL); + this.state = 4804; + this.match(MySqlParser.COMMA); + this.state = 4805; + this.match(MySqlParser.KW_RELAY_LOG_POS); + this.state = 4806; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4807; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + localContext = new SqlGapsUntilOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 4808; + this.match(MySqlParser.KW_SQL_AFTER_MTS_GAPS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + connectionOptions() { + let localContext = new ConnectionOptionsContext(this.context, this.state); + this.enterRule(localContext, 394, MySqlParser.RULE_connectionOptions); + try { + this.state = 4823; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_USER: + localContext = new UserConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 4811; + this.match(MySqlParser.KW_USER); + this.state = 4812; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4813; + localContext._conOptUser = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PASSWORD: + localContext = new PasswordConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 4814; + this.match(MySqlParser.KW_PASSWORD); + this.state = 4815; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4816; + localContext._conOptPassword = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_DEFAULT_AUTH: + localContext = new DefaultAuthConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 4817; + this.match(MySqlParser.KW_DEFAULT_AUTH); + this.state = 4818; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4819; + localContext._conOptDefAuth = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_PLUGIN_DIR: + localContext = new PluginDirConnectionOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 4820; + this.match(MySqlParser.KW_PLUGIN_DIR); + this.state = 4821; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 4822; + localContext._conOptPluginDir = this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + gtuidSet() { + let localContext = new GtuidSetContext(this.context, this.state); + this.enterRule(localContext, 396, MySqlParser.RULE_gtuidSet); + try { + let alternative; + this.state = 4834; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 4825; + this.uuidSet(); + this.state = 4830; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 680, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4826; + this.match(MySqlParser.COMMA); + this.state = 4827; + this.uuidSet(); + } + } + } + this.state = 4832; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 680, this.context); + } + } + break; + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 2); + { + this.state = 4833; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaStartTransaction() { + let localContext = new XaStartTransactionContext(this.context, this.state); + this.enterRule(localContext, 398, MySqlParser.RULE_xaStartTransaction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4836; + this.match(MySqlParser.KW_XA); + this.state = 4837; + localContext._xaStart = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 317 || _la === 640)) { + localContext._xaStart = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4838; + this.xid(); + this.state = 4840; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 91 || _la === 577) { + { + this.state = 4839; + localContext._xaAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 91 || _la === 577)) { + localContext._xaAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaEndTransaction() { + let localContext = new XaEndTransactionContext(this.context, this.state); + this.enterRule(localContext, 400, MySqlParser.RULE_xaEndTransaction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4842; + this.match(MySqlParser.KW_XA); + this.state = 4843; + this.match(MySqlParser.KW_END); + this.state = 4844; + this.xid(); + this.state = 4850; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 654) { + { + this.state = 4845; + this.match(MySqlParser.KW_SUSPEND); + this.state = 4848; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 4846; + this.match(MySqlParser.KW_FOR); + this.state = 4847; + this.match(MySqlParser.KW_MIGRATE); + } + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaPrepareStatement() { + let localContext = new XaPrepareStatementContext(this.context, this.state); + this.enterRule(localContext, 402, MySqlParser.RULE_xaPrepareStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4852; + this.match(MySqlParser.KW_XA); + this.state = 4853; + this.match(MySqlParser.KW_PREPARE); + this.state = 4854; + this.xid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaCommitWork() { + let localContext = new XaCommitWorkContext(this.context, this.state); + this.enterRule(localContext, 404, MySqlParser.RULE_xaCommitWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4856; + this.match(MySqlParser.KW_XA); + this.state = 4857; + this.match(MySqlParser.KW_COMMIT); + this.state = 4858; + this.xid(); + this.state = 4861; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 513) { + { + this.state = 4859; + this.match(MySqlParser.KW_ONE); + this.state = 4860; + this.match(MySqlParser.KW_PHASE); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaRollbackWork() { + let localContext = new XaRollbackWorkContext(this.context, this.state); + this.enterRule(localContext, 406, MySqlParser.RULE_xaRollbackWork); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4863; + this.match(MySqlParser.KW_XA); + this.state = 4864; + this.match(MySqlParser.KW_ROLLBACK); + this.state = 4865; + this.xid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xaRecoverWork() { + let localContext = new XaRecoverWorkContext(this.context, this.state); + this.enterRule(localContext, 408, MySqlParser.RULE_xaRecoverWork); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4867; + this.match(MySqlParser.KW_XA); + this.state = 4868; + this.match(MySqlParser.KW_RECOVER); + this.state = 4871; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 33) { + { + this.state = 4869; + this.match(MySqlParser.KW_CONVERT); + this.state = 4870; + this.xid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + prepareStatement() { + let localContext = new PrepareStatementContext(this.context, this.state); + this.enterRule(localContext, 410, MySqlParser.RULE_prepareStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4873; + this.match(MySqlParser.KW_PREPARE); + this.state = 4874; + localContext._stmt_name = this.uid(); + this.state = 4875; + this.match(MySqlParser.KW_FROM); + this.state = 4878; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 4876; + localContext._query = this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.LOCAL_ID: + { + this.state = 4877; + localContext._variable = this.match(MySqlParser.LOCAL_ID); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + executeStatement() { + let localContext = new ExecuteStatementContext(this.context, this.state); + this.enterRule(localContext, 412, MySqlParser.RULE_executeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4880; + this.match(MySqlParser.KW_EXECUTE); + this.state = 4881; + localContext._stmt_name = this.uid(); + this.state = 4884; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 4882; + this.match(MySqlParser.KW_USING); + this.state = 4883; + this.userVariables(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + deallocatePrepare() { + let localContext = new DeallocatePrepareContext(this.context, this.state); + this.enterRule(localContext, 414, MySqlParser.RULE_deallocatePrepare); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4886; + localContext._dropFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 51 || _la === 362)) { + localContext._dropFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 4887; + this.match(MySqlParser.KW_PREPARE); + this.state = 4888; + localContext._stmt_name = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + routineBody() { + let localContext = new RoutineBodyContext(this.context, this.state); + this.enterRule(localContext, 416, MySqlParser.RULE_routineBody); + try { + this.state = 4892; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 689, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 4890; + this.blockStatement(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 4891; + this.sqlStatement(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + blockStatement() { + let localContext = new BlockStatementContext(this.context, this.state); + this.enterRule(localContext, 418, MySqlParser.RULE_blockStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4897; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 690, this.context)) { + case 1: + { + this.state = 4894; + localContext._begin = this.uid(); + this.state = 4895; + this.match(MySqlParser.COLON_SYMB); + } + break; + } + this.state = 4899; + this.match(MySqlParser.KW_BEGIN); + this.state = 4905; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 691, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4900; + this.declareVariable(); + this.state = 4901; + this.match(MySqlParser.SEMI); + } + } + } + this.state = 4907; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 691, this.context); + } + this.state = 4913; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 692, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4908; + this.declareCondition(); + this.state = 4909; + this.match(MySqlParser.SEMI); + } + } + } + this.state = 4915; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 692, this.context); + } + this.state = 4921; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 693, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4916; + this.declareCursor(); + this.state = 4917; + this.match(MySqlParser.SEMI); + } + } + } + this.state = 4923; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 693, this.context); + } + this.state = 4929; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 41) { + { + { + this.state = 4924; + this.declareHandler(); + this.state = 4925; + this.match(MySqlParser.SEMI); + } + } + this.state = 4931; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4935; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 695, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 4932; + this.procedureSqlStatement(); + } + } + } + this.state = 4937; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 695, this.context); + } + this.state = 4938; + this.match(MySqlParser.KW_END); + this.state = 4940; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 696, this.context)) { + case 1: + { + this.state = 4939; + localContext._end = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + caseStatement() { + let localContext = new CaseStatementContext(this.context, this.state); + this.enterRule(localContext, 420, MySqlParser.RULE_caseStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4942; + this.match(MySqlParser.KW_CASE); + this.state = 4945; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 697, this.context)) { + case 1: + { + this.state = 4943; + localContext._case_value = this.uid(); + } + break; + case 2: + { + this.state = 4944; + this.expression(0); + } + break; + } + this.state = 4948; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 4947; + this.caseAlternative(); + } + } + this.state = 4950; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 191); + this.state = 4958; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 4952; + this.match(MySqlParser.KW_ELSE); + this.state = 4954; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4953; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4956; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 699, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + this.state = 4960; + this.match(MySqlParser.KW_END); + this.state = 4961; + this.match(MySqlParser.KW_CASE); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ifStatement() { + let localContext = new IfStatementContext(this.context, this.state); + this.enterRule(localContext, 422, MySqlParser.RULE_ifStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4963; + this.match(MySqlParser.KW_IF); + this.state = 4964; + this.expression(0); + this.state = 4965; + this.match(MySqlParser.KW_THEN); + this.state = 4967; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4966; + localContext._procedureSqlStatement = this.procedureSqlStatement(); + localContext._thenStatements.push(localContext._procedureSqlStatement); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4969; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 701, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 4974; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 54) { + { + { + this.state = 4971; + this.elifAlternative(); + } + } + this.state = 4976; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 4983; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 4977; + this.match(MySqlParser.KW_ELSE); + this.state = 4979; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 4978; + localContext._procedureSqlStatement = this.procedureSqlStatement(); + localContext._elseStatements.push(localContext._procedureSqlStatement); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 4981; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 703, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + this.state = 4985; + this.match(MySqlParser.KW_END); + this.state = 4986; + this.match(MySqlParser.KW_IF); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + iterateStatement() { + let localContext = new IterateStatementContext(this.context, this.state); + this.enterRule(localContext, 424, MySqlParser.RULE_iterateStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4988; + this.match(MySqlParser.KW_ITERATE); + this.state = 4989; + localContext._label = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + leaveStatement() { + let localContext = new LeaveStatementContext(this.context, this.state); + this.enterRule(localContext, 426, MySqlParser.RULE_leaveStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 4991; + this.match(MySqlParser.KW_LEAVE); + this.state = 4992; + localContext._label = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loopStatement() { + let localContext = new LoopStatementContext(this.context, this.state); + this.enterRule(localContext, 428, MySqlParser.RULE_loopStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 4997; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 4994; + localContext._begin_label = this.uid(); + this.state = 4995; + this.match(MySqlParser.COLON_SYMB); + } + } + this.state = 4999; + this.match(MySqlParser.KW_LOOP); + this.state = 5001; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5000; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5003; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 706, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 5005; + this.match(MySqlParser.KW_END); + this.state = 5006; + this.match(MySqlParser.KW_LOOP); + this.state = 5008; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5007; + localContext._end_label = this.uid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + repeatStatement() { + let localContext = new RepeatStatementContext(this.context, this.state); + this.enterRule(localContext, 430, MySqlParser.RULE_repeatStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5013; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 708, this.context)) { + case 1: + { + this.state = 5010; + localContext._begin_label = this.uid(); + this.state = 5011; + this.match(MySqlParser.COLON_SYMB); + } + break; + } + this.state = 5015; + this.match(MySqlParser.KW_REPEAT); + this.state = 5017; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5016; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5019; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 709, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 5021; + this.match(MySqlParser.KW_UNTIL); + this.state = 5022; + this.expression(0); + this.state = 5023; + this.match(MySqlParser.KW_END); + this.state = 5024; + this.match(MySqlParser.KW_REPEAT); + this.state = 5026; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5025; + localContext._end_label = this.uid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + returnStatement() { + let localContext = new ReturnStatementContext(this.context, this.state); + this.enterRule(localContext, 432, MySqlParser.RULE_returnStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5028; + this.match(MySqlParser.KW_RETURN); + this.state = 5029; + this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + whileStatement() { + let localContext = new WhileStatementContext(this.context, this.state); + this.enterRule(localContext, 434, MySqlParser.RULE_whileStatement); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5034; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5031; + localContext._begin_label = this.uid(); + this.state = 5032; + this.match(MySqlParser.COLON_SYMB); + } + } + this.state = 5036; + this.match(MySqlParser.KW_WHILE); + this.state = 5037; + this.expression(0); + this.state = 5038; + this.match(MySqlParser.KW_DO); + this.state = 5040; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5039; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5042; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 712, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + this.state = 5044; + this.match(MySqlParser.KW_END); + this.state = 5045; + this.match(MySqlParser.KW_WHILE); + this.state = 5047; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014219) !== 0) || ((((_la - 74)) & ~0x1F) === 0 && ((1 << (_la - 74)) & 18878481) !== 0) || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 100679969) !== 0) || ((((_la - 150)) & ~0x1F) === 0 && ((1 << (_la - 150)) & 1049605) !== 0) || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 5374495) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 4294967295) !== 0) || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 4261412607) !== 0) || ((((_la - 317)) & ~0x1F) === 0 && ((1 << (_la - 317)) & 4160741375) !== 0) || ((((_la - 349)) & ~0x1F) === 0 && ((1 << (_la - 349)) & 4026531839) !== 0) || ((((_la - 381)) & ~0x1F) === 0 && ((1 << (_la - 381)) & 1055907839) !== 0) || ((((_la - 413)) & ~0x1F) === 0 && ((1 << (_la - 413)) & 4294885367) !== 0) || ((((_la - 445)) & ~0x1F) === 0 && ((1 << (_la - 445)) & 3757571071) !== 0) || ((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 3755999231) !== 0) || ((((_la - 510)) & ~0x1F) === 0 && ((1 << (_la - 510)) & 3751780349) !== 0) || ((((_la - 542)) & ~0x1F) === 0 && ((1 << (_la - 542)) & 2141183997) !== 0) || ((((_la - 575)) & ~0x1F) === 0 && ((1 << (_la - 575)) & 2147483629) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 4278189053) !== 0) || ((((_la - 697)) & ~0x1F) === 0 && ((1 << (_la - 697)) & 1644099327) !== 0) || ((((_la - 729)) & ~0x1F) === 0 && ((1 << (_la - 729)) & 4294900735) !== 0) || ((((_la - 761)) & ~0x1F) === 0 && ((1 << (_la - 761)) & 4294967295) !== 0) || ((((_la - 793)) & ~0x1F) === 0 && ((1 << (_la - 793)) & 4288675839) !== 0) || ((((_la - 825)) & ~0x1F) === 0 && ((1 << (_la - 825)) & 2147527671) !== 0) || ((((_la - 879)) & ~0x1F) === 0 && ((1 << (_la - 879)) & 1033) !== 0)) { + { + this.state = 5046; + localContext._end_label = this.uid(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + cursorStatement() { + let localContext = new CursorStatementContext(this.context, this.state); + this.enterRule(localContext, 436, MySqlParser.RULE_cursorStatement); + let _la; + try { + this.state = 5064; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CLOSE: + localContext = new CloseCursorContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5049; + this.match(MySqlParser.KW_CLOSE); + this.state = 5050; + localContext._cursor_name = this.uid(); + } + break; + case MySqlParser.KW_FETCH: + localContext = new FetchCursorContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5051; + this.match(MySqlParser.KW_FETCH); + this.state = 5056; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 715, this.context)) { + case 1: + { + this.state = 5053; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 501) { + { + this.state = 5052; + this.match(MySqlParser.KW_NEXT); + } + } + this.state = 5055; + this.match(MySqlParser.KW_FROM); + } + break; + } + this.state = 5058; + localContext._cursor_name = this.uid(); + this.state = 5059; + this.match(MySqlParser.KW_INTO); + this.state = 5060; + localContext._var_names = this.uidList(); + } + break; + case MySqlParser.KW_OPEN: + localContext = new OpenCursorContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5062; + this.match(MySqlParser.KW_OPEN); + this.state = 5063; + localContext._cursor_name = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareVariable() { + let localContext = new DeclareVariableContext(this.context, this.state); + this.enterRule(localContext, 438, MySqlParser.RULE_declareVariable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5066; + this.match(MySqlParser.KW_DECLARE); + this.state = 5067; + localContext._var_names = this.uidList(); + this.state = 5068; + this.dataType(); + this.state = 5071; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 5069; + this.match(MySqlParser.KW_DEFAULT); + this.state = 5070; + this.expression(0); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareCondition() { + let localContext = new DeclareConditionContext(this.context, this.state); + this.enterRule(localContext, 440, MySqlParser.RULE_declareCondition); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5073; + this.match(MySqlParser.KW_DECLARE); + this.state = 5074; + localContext._condition_name = this.uid(); + this.state = 5075; + this.match(MySqlParser.KW_CONDITION); + this.state = 5076; + this.match(MySqlParser.KW_FOR); + this.state = 5083; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5077; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SQLSTATE: + { + this.state = 5078; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 5080; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 5079; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 5082; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareCursor() { + let localContext = new DeclareCursorContext(this.context, this.state); + this.enterRule(localContext, 442, MySqlParser.RULE_declareCursor); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5085; + this.match(MySqlParser.KW_DECLARE); + this.state = 5086; + localContext._condition_name = this.uid(); + this.state = 5087; + this.match(MySqlParser.KW_CURSOR); + this.state = 5088; + this.match(MySqlParser.KW_FOR); + this.state = 5089; + this.selectStatement(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + declareHandler() { + let localContext = new DeclareHandlerContext(this.context, this.state); + this.enterRule(localContext, 444, MySqlParser.RULE_declareHandler); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5091; + this.match(MySqlParser.KW_DECLARE); + this.state = 5092; + localContext._handlerAction = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 32 || _la === 61 || _la === 180)) { + localContext._handlerAction = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5093; + this.match(MySqlParser.KW_HANDLER); + this.state = 5094; + this.match(MySqlParser.KW_FOR); + this.state = 5095; + this.handlerConditionValue(); + this.state = 5100; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5096; + this.match(MySqlParser.COMMA); + this.state = 5097; + this.handlerConditionValue(); + } + } + this.state = 5102; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5103; + this.routineBody(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + handlerConditionValue() { + let localContext = new HandlerConditionValueContext(this.context, this.state); + this.enterRule(localContext, 446, MySqlParser.RULE_handlerConditionValue); + let _la; + try { + this.state = 5116; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + localContext = new HandlerConditionCodeContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5105; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_SQLSTATE: + localContext = new HandlerConditionStateContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5106; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 5108; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 5107; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 5110; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + localContext = new HandlerConditionNameContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5111; + localContext._condition_name = this.uid(); + } + break; + case MySqlParser.KW_SQLWARNING: + localContext = new HandlerConditionWarningContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 5112; + this.match(MySqlParser.KW_SQLWARNING); + } + break; + case MySqlParser.KW_NOT: + localContext = new HandlerConditionNotfoundContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 5113; + this.match(MySqlParser.KW_NOT); + this.state = 5114; + this.match(MySqlParser.KW_FOUND); + } + break; + case MySqlParser.KW_SQLEXCEPTION: + localContext = new HandlerConditionExceptionContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 5115; + this.match(MySqlParser.KW_SQLEXCEPTION); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + procedureSqlStatement() { + let localContext = new ProcedureSqlStatementContext(this.context, this.state); + this.enterRule(localContext, 448, MySqlParser.RULE_procedureSqlStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5120; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 723, this.context)) { + case 1: + { + this.state = 5118; + this.compoundStatement(); + } + break; + case 2: + { + this.state = 5119; + this.sqlStatement(); + } + break; + } + this.state = 5122; + this.match(MySqlParser.SEMI); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + caseAlternative() { + let localContext = new CaseAlternativeContext(this.context, this.state); + this.enterRule(localContext, 450, MySqlParser.RULE_caseAlternative); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5124; + this.match(MySqlParser.KW_WHEN); + this.state = 5127; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 724, this.context)) { + case 1: + { + this.state = 5125; + this.constant(); + } + break; + case 2: + { + this.state = 5126; + this.expression(0); + } + break; + } + this.state = 5129; + this.match(MySqlParser.KW_THEN); + this.state = 5131; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5130; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5133; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 725, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + elifAlternative() { + let localContext = new ElifAlternativeContext(this.context, this.state); + this.enterRule(localContext, 452, MySqlParser.RULE_elifAlternative); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5135; + this.match(MySqlParser.KW_ELSEIF); + this.state = 5136; + this.expression(0); + this.state = 5137; + this.match(MySqlParser.KW_THEN); + this.state = 5139; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5138; + this.procedureSqlStatement(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5141; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 726, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterUser() { + let localContext = new AlterUserContext(this.context, this.state); + this.enterRule(localContext, 454, MySqlParser.RULE_alterUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5143; + this.match(MySqlParser.KW_ALTER); + this.state = 5144; + this.match(MySqlParser.KW_USER); + this.state = 5146; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 727, this.context)) { + case 1: + { + this.state = 5145; + this.ifExists(); + } + break; + } + this.state = 5204; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 739, this.context)) { + case 1: + { + { + this.state = 5148; + this.userSpecification(); + this.state = 5153; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5149; + this.match(MySqlParser.COMMA); + this.state = 5150; + this.userSpecification(); + } + } + this.state = 5155; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + case 2: + { + { + this.state = 5156; + this.alterUserAuthOption(); + this.state = 5161; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5157; + this.match(MySqlParser.COMMA); + this.state = 5158; + this.alterUserAuthOption(); + } + } + this.state = 5163; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5178; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 5164; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5176; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NONE: + { + this.state = 5165; + this.match(MySqlParser.KW_NONE); + } + break; + case MySqlParser.KW_SSL: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_X509: + { + this.state = 5166; + this.tlsOption(); + this.state = 5173; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 11 || _la === 169 || _la === 331 || _la === 441 || _la === 651 || _la === 693) { + { + { + this.state = 5168; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5167; + this.match(MySqlParser.KW_AND); + } + } + this.state = 5170; + this.tlsOption(); + } + } + this.state = 5175; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5186; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 735, this.context)) { + case 1: + { + this.state = 5180; + this.match(MySqlParser.KW_WITH); + this.state = 5182; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 5181; + this.userResourceOption(); + } + } + this.state = 5184; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 51) !== 0)); + } + break; + } + this.state = 5192; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 304 || _la === 395 || _la === 529 || _la === 530) { + { + this.state = 5190; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + { + this.state = 5188; + this.userPasswordOption(); + } + break; + case MySqlParser.KW_ACCOUNT: + { + this.state = 5189; + this.userLockOption(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + this.state = 5194; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5197; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 15 || _la === 340) { + { + this.state = 5195; + _la = this.tokenStream.LA(1); + if (!(_la === 15 || _la === 340)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5196; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + break; + case 3: + { + { + { + this.state = 5199; + this.userOrRoleName(); + } + this.state = 5200; + this.match(MySqlParser.KW_DEFAULT); + this.state = 5201; + this.match(MySqlParser.KW_ROLE); + this.state = 5202; + this.roleOption(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createUser() { + let localContext = new CreateUserContext(this.context, this.state); + this.enterRule(localContext, 456, MySqlParser.RULE_createUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5206; + this.match(MySqlParser.KW_CREATE); + this.state = 5207; + this.match(MySqlParser.KW_USER); + this.state = 5209; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5208; + this.ifNotExists(); + } + } + this.state = 5211; + this.userName(); + this.state = 5213; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 423) { + { + this.state = 5212; + this.createUserAuthOption(); + } + } + this.state = 5222; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5215; + this.match(MySqlParser.COMMA); + this.state = 5216; + this.userName(); + this.state = 5218; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 423) { + { + this.state = 5217; + this.createUserAuthOption(); + } + } + } + } + this.state = 5224; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5228; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42) { + { + this.state = 5225; + this.match(MySqlParser.KW_DEFAULT); + this.state = 5226; + this.match(MySqlParser.KW_ROLE); + this.state = 5227; + this.roleOption(); + } + } + this.state = 5244; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 5230; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5242; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NONE: + { + this.state = 5231; + this.match(MySqlParser.KW_NONE); + } + break; + case MySqlParser.KW_SSL: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_X509: + { + this.state = 5232; + this.tlsOption(); + this.state = 5239; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 11 || _la === 169 || _la === 331 || _la === 441 || _la === 651 || _la === 693) { + { + { + this.state = 5234; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5233; + this.match(MySqlParser.KW_AND); + } + } + this.state = 5236; + this.tlsOption(); + } + } + this.state = 5241; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5252; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 750, this.context)) { + case 1: + { + this.state = 5246; + this.match(MySqlParser.KW_WITH); + this.state = 5248; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 5247; + this.userResourceOption(); + } + } + this.state = 5250; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (((((_la - 478)) & ~0x1F) === 0 && ((1 << (_la - 478)) & 51) !== 0)); + } + break; + } + this.state = 5258; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 304 || _la === 395 || _la === 529 || _la === 530) { + { + this.state = 5256; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + { + this.state = 5254; + this.userPasswordOption(); + } + break; + case MySqlParser.KW_ACCOUNT: + { + this.state = 5255; + this.userLockOption(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + this.state = 5260; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5263; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 15 || _la === 340) { + { + this.state = 5261; + _la = this.tokenStream.LA(1); + if (!(_la === 15 || _la === 340)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5262; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropUser() { + let localContext = new DropUserContext(this.context, this.state); + this.enterRule(localContext, 458, MySqlParser.RULE_dropUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5265; + this.match(MySqlParser.KW_DROP); + this.state = 5266; + this.match(MySqlParser.KW_USER); + this.state = 5268; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5267; + this.ifExists(); + } + } + this.state = 5270; + this.userName(); + this.state = 5275; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5271; + this.match(MySqlParser.COMMA); + this.state = 5272; + this.userName(); + } + } + this.state = 5277; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + grantStatement() { + let localContext = new GrantStatementContext(this.context, this.state); + this.enterRule(localContext, 460, MySqlParser.RULE_grantStatement); + let _la; + try { + let alternative; + this.state = 5367; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 773, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5278; + this.match(MySqlParser.KW_GRANT); + this.state = 5279; + this.privelegeClause(); + this.state = 5284; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5280; + this.match(MySqlParser.COMMA); + this.state = 5281; + this.privelegeClause(); + } + } + this.state = 5286; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5287; + this.match(MySqlParser.KW_ON); + this.state = 5289; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 757, this.context)) { + case 1: + { + this.state = 5288; + this.privilegeObjectType(); + } + break; + } + this.state = 5291; + this.privilegeLevel(); + this.state = 5292; + this.match(MySqlParser.KW_TO); + this.state = 5302; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 759, this.context)) { + case 1: + { + { + this.state = 5293; + this.userAuthOption(); + this.state = 5298; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5294; + this.match(MySqlParser.COMMA); + this.state = 5295; + this.userAuthOption(); + } + } + this.state = 5300; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + case 2: + { + this.state = 5301; + this.userOrRoleNames(); + } + break; + } + this.state = 5318; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 5304; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5316; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_NONE: + { + this.state = 5305; + localContext._tlsNone = this.match(MySqlParser.KW_NONE); + } + break; + case MySqlParser.KW_SSL: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_X509: + { + this.state = 5306; + this.tlsOption(); + this.state = 5313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 11 || _la === 169 || _la === 331 || _la === 441 || _la === 651 || _la === 693) { + { + { + this.state = 5308; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5307; + this.match(MySqlParser.KW_AND); + } + } + this.state = 5310; + this.tlsOption(); + } + } + this.state = 5315; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5329; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 766, this.context)) { + case 1: + { + this.state = 5320; + this.match(MySqlParser.KW_WITH); + this.state = 5326; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 765, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + this.state = 5324; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_GRANT: + { + this.state = 5321; + this.match(MySqlParser.KW_GRANT); + this.state = 5322; + this.match(MySqlParser.KW_OPTION); + } + break; + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + { + this.state = 5323; + this.userResourceOption(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + this.state = 5328; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 765, this.context); + } + } + break; + } + this.state = 5338; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 5331; + this.match(MySqlParser.KW_AS); + this.state = 5332; + this.userName(); + this.state = 5336; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 767, this.context)) { + case 1: + { + this.state = 5333; + this.match(MySqlParser.KW_WITH); + this.state = 5334; + this.match(MySqlParser.KW_ROLE); + this.state = 5335; + this.roleOption(); + } + break; + } + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5340; + this.match(MySqlParser.KW_GRANT); + this.state = 5343; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 769, this.context)) { + case 1: + { + this.state = 5341; + this.match(MySqlParser.KW_PROXY); + this.state = 5342; + this.match(MySqlParser.KW_ON); + } + break; + } + { + this.state = 5345; + this.userOrRoleName(); + } + this.state = 5350; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5346; + this.match(MySqlParser.COMMA); + { + this.state = 5347; + this.userOrRoleName(); + } + } + } + this.state = 5352; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5353; + this.match(MySqlParser.KW_TO); + { + this.state = 5354; + this.userOrRoleName(); + } + this.state = 5359; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5355; + this.match(MySqlParser.COMMA); + { + this.state = 5356; + this.userOrRoleName(); + } + } + } + this.state = 5361; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5365; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 772, this.context)) { + case 1: + { + this.state = 5362; + this.match(MySqlParser.KW_WITH); + this.state = 5363; + this.match(MySqlParser.KW_ADMIN); + this.state = 5364; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + roleOption() { + let localContext = new RoleOptionContext(this.context, this.state); + this.enterRule(localContext, 462, MySqlParser.RULE_roleOption); + let _la; + try { + this.state = 5377; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 775, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5369; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5370; + this.match(MySqlParser.KW_NONE); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5371; + this.match(MySqlParser.KW_ALL); + this.state = 5374; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 59) { + { + this.state = 5372; + this.match(MySqlParser.KW_EXCEPT); + this.state = 5373; + this.userOrRoleNames(); + } + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5376; + this.userOrRoleNames(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + grantProxy() { + let localContext = new GrantProxyContext(this.context, this.state); + this.enterRule(localContext, 464, MySqlParser.RULE_grantProxy); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5379; + this.match(MySqlParser.KW_GRANT); + this.state = 5380; + this.match(MySqlParser.KW_PROXY); + this.state = 5381; + this.match(MySqlParser.KW_ON); + this.state = 5382; + localContext._fromFirst = this.userName(); + this.state = 5383; + this.match(MySqlParser.KW_TO); + this.state = 5384; + localContext._toFirst = this.userName(); + this.state = 5389; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5385; + this.match(MySqlParser.COMMA); + this.state = 5386; + localContext._userName = this.userName(); + localContext._toOther.push(localContext._userName); + } + } + this.state = 5391; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5395; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 777, this.context)) { + case 1: + { + this.state = 5392; + this.match(MySqlParser.KW_WITH); + this.state = 5393; + this.match(MySqlParser.KW_GRANT); + this.state = 5394; + this.match(MySqlParser.KW_OPTION); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterResourceGroup() { + let localContext = new AlterResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 466, MySqlParser.RULE_alterResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5397; + this.match(MySqlParser.KW_ALTER); + this.state = 5398; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5399; + this.match(MySqlParser.KW_GROUP); + this.state = 5400; + this.groupName(); + this.state = 5406; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 190) { + { + this.state = 5401; + this.match(MySqlParser.KW_VCPU); + this.state = 5403; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5402; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5405; + this.resourceGroupVcpuSpec(); + } + } + this.state = 5413; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 837) { + { + this.state = 5408; + this.match(MySqlParser.KW_THREAD_PRIORITY); + this.state = 5410; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5409; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5412; + this.decimalLiteral(); + } + } + this.state = 5419; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 5415; + _la = this.tokenStream.LA(1); + if (!(_la === 368 || _la === 375)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5417; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 66) { + { + this.state = 5416; + this.match(MySqlParser.KW_FORCE); + } + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createResourceGroup() { + let localContext = new CreateResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 468, MySqlParser.RULE_createResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5421; + this.match(MySqlParser.KW_CREATE); + this.state = 5422; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5423; + this.match(MySqlParser.KW_GROUP); + this.state = 5424; + this.groupNameCreate(); + this.state = 5425; + this.match(MySqlParser.KW_TYPE); + this.state = 5426; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 5427; + _la = this.tokenStream.LA(1); + if (!(_la === 678 || _la === 835)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5433; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 190) { + { + this.state = 5428; + this.match(MySqlParser.KW_VCPU); + this.state = 5430; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5429; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5432; + this.resourceGroupVcpuSpec(); + } + } + this.state = 5440; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 837) { + { + this.state = 5435; + this.match(MySqlParser.KW_THREAD_PRIORITY); + this.state = 5437; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 5436; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 5439; + this.decimalLiteral(); + } + } + this.state = 5443; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 368 || _la === 375) { + { + this.state = 5442; + _la = this.tokenStream.LA(1); + if (!(_la === 368 || _la === 375)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dropResourceGroup() { + let localContext = new DropResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 470, MySqlParser.RULE_dropResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5445; + this.match(MySqlParser.KW_DROP); + this.state = 5446; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5447; + this.match(MySqlParser.KW_GROUP); + this.state = 5448; + this.groupName(); + this.state = 5450; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 66) { + { + this.state = 5449; + this.match(MySqlParser.KW_FORCE); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setResourceGroup() { + let localContext = new SetResourceGroupContext(this.context, this.state); + this.enterRule(localContext, 472, MySqlParser.RULE_setResourceGroup); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5452; + this.match(MySqlParser.KW_SET); + this.state = 5453; + this.match(MySqlParser.KW_RESOURCE); + this.state = 5454; + this.match(MySqlParser.KW_GROUP); + this.state = 5455; + this.groupName(); + this.state = 5465; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 5456; + this.match(MySqlParser.KW_FOR); + this.state = 5457; + this.decimalLiteral(); + this.state = 5462; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5458; + this.match(MySqlParser.COMMA); + this.state = 5459; + this.decimalLiteral(); + } + } + this.state = 5464; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resourceGroupVcpuSpec() { + let localContext = new ResourceGroupVcpuSpecContext(this.context, this.state); + this.enterRule(localContext, 474, MySqlParser.RULE_resourceGroupVcpuSpec); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5472; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 792, this.context)) { + case 1: + { + this.state = 5467; + this.decimalLiteral(); + } + break; + case 2: + { + this.state = 5468; + this.decimalLiteral(); + this.state = 5469; + this.match(MySqlParser.MINUS); + this.state = 5470; + this.decimalLiteral(); + } + break; + } + this.state = 5478; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 793, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 5474; + this.match(MySqlParser.COMMA); + this.state = 5475; + this.resourceGroupVcpuSpec(); + } + } + } + this.state = 5480; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 793, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameUser() { + let localContext = new RenameUserContext(this.context, this.state); + this.enterRule(localContext, 476, MySqlParser.RULE_renameUser); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5481; + this.match(MySqlParser.KW_RENAME); + this.state = 5482; + this.match(MySqlParser.KW_USER); + this.state = 5483; + this.renameUserClause(); + this.state = 5488; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5484; + this.match(MySqlParser.COMMA); + this.state = 5485; + this.renameUserClause(); + } + } + this.state = 5490; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + revokeStatement() { + let localContext = new RevokeStatementContext(this.context, this.state); + this.enterRule(localContext, 478, MySqlParser.RULE_revokeStatement); + let _la; + try { + this.state = 5543; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 805, this.context)) { + case 1: + localContext = new DetailRevokeContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5491; + this.match(MySqlParser.KW_REVOKE); + this.state = 5493; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5492; + this.ifExists(); + } + } + this.state = 5495; + this.privelegeClause(); + this.state = 5500; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 5496; + this.match(MySqlParser.COMMA); + this.state = 5497; + this.privelegeClause(); + } + } + this.state = 5502; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 5503; + this.match(MySqlParser.KW_ON); + this.state = 5505; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 797, this.context)) { + case 1: + { + this.state = 5504; + this.privilegeObjectType(); + } + break; + } + this.state = 5507; + this.privilegeLevel(); + this.state = 5508; + this.match(MySqlParser.KW_FROM); + this.state = 5509; + this.userOrRoleNames(); + this.state = 5511; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 5510; + this.ignoreUnknownUser(); + } + } + } + break; + case 2: + localContext = new ShortRevokeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5513; + this.match(MySqlParser.KW_REVOKE); + this.state = 5515; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 78) { + { + this.state = 5514; + this.ifExists(); + } + } + this.state = 5517; + this.match(MySqlParser.KW_ALL); + this.state = 5519; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 734) { + { + this.state = 5518; + this.match(MySqlParser.KW_PRIVILEGES); + } + } + this.state = 5521; + this.match(MySqlParser.COMMA); + this.state = 5522; + this.match(MySqlParser.KW_GRANT); + this.state = 5523; + this.match(MySqlParser.KW_OPTION); + this.state = 5524; + this.match(MySqlParser.KW_FROM); + this.state = 5525; + this.userOrRoleNames(); + this.state = 5527; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 5526; + this.ignoreUnknownUser(); + } + } + } + break; + case 3: + localContext = new ProxyAndRoleRevokeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5529; + this.match(MySqlParser.KW_REVOKE); + this.state = 5531; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 802, this.context)) { + case 1: + { + this.state = 5530; + this.ifExists(); + } + break; + } + this.state = 5535; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 803, this.context)) { + case 1: + { + this.state = 5533; + this.match(MySqlParser.KW_PROXY); + this.state = 5534; + this.match(MySqlParser.KW_ON); + } + break; + } + this.state = 5537; + this.userOrRoleNames(); + this.state = 5538; + this.match(MySqlParser.KW_FROM); + this.state = 5539; + this.userOrRoleNames(); + this.state = 5541; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 5540; + this.ignoreUnknownUser(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ignoreUnknownUser() { + let localContext = new IgnoreUnknownUserContext(this.context, this.state); + this.enterRule(localContext, 480, MySqlParser.RULE_ignoreUnknownUser); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5545; + this.match(MySqlParser.KW_IGNORE); + this.state = 5546; + this.match(MySqlParser.KW_UNKNOWN); + this.state = 5547; + this.match(MySqlParser.KW_USER); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilegeObjectType() { + let localContext = new PrivilegeObjectTypeContext(this.context, this.state); + this.enterRule(localContext, 482, MySqlParser.RULE_privilegeObjectType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5549; + _la = this.tokenStream.LA(1); + if (!(_la === 132 || _la === 173 || _la === 409)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setPasswordStatement() { + let localContext = new SetPasswordStatementContext(this.context, this.state); + this.enterRule(localContext, 484, MySqlParser.RULE_setPasswordStatement); + let _la; + try { + this.state = 5583; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 812, this.context)) { + case 1: + localContext = new V57Context(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5551; + this.match(MySqlParser.KW_SET); + this.state = 5552; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5555; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 5553; + this.match(MySqlParser.KW_FOR); + this.state = 5554; + this.userName(); + } + } + this.state = 5557; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 5560; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_PASSWORD: + { + this.state = 5558; + this.passwordFunctionClause(); + } + break; + case MySqlParser.STRING_LITERAL: + { + this.state = 5559; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + localContext = new V80Context(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5562; + this.match(MySqlParser.KW_SET); + this.state = 5563; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5566; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 5564; + this.match(MySqlParser.KW_FOR); + this.state = 5565; + this.userName(); + } + } + this.state = 5572; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TO: + { + this.state = 5568; + this.match(MySqlParser.KW_TO); + this.state = 5569; + this.match(MySqlParser.KW_RANDOM); + } + break; + case MySqlParser.EQUAL_SYMBOL: + { + this.state = 5570; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 5571; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5576; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 810, this.context)) { + case 1: + { + this.state = 5574; + this.match(MySqlParser.KW_REPLACE); + this.state = 5575; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + this.state = 5581; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 147) { + { + this.state = 5578; + this.match(MySqlParser.KW_RETAIN); + this.state = 5579; + this.match(MySqlParser.KW_CURRENT); + this.state = 5580; + this.match(MySqlParser.KW_PASSWORD); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userSpecification() { + let localContext = new UserSpecificationContext(this.context, this.state); + this.enterRule(localContext, 486, MySqlParser.RULE_userSpecification); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5585; + this.userName(); + this.state = 5586; + this.userPasswordOption(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + alterUserAuthOption() { + let localContext = new AlterUserAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 488, MySqlParser.RULE_alterUserAuthOption); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 5588; + this.userName(); + this.state = 5614; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 815, this.context)) { + case 1: + { + this.state = 5589; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5590; + this.match(MySqlParser.KW_BY); + this.state = 5591; + this.match(MySqlParser.STRING_LITERAL); + this.state = 5592; + this.authOptionClause(); + } + break; + case 2: + { + this.state = 5593; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5594; + this.match(MySqlParser.KW_BY); + this.state = 5595; + this.match(MySqlParser.KW_RANDOM); + this.state = 5596; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5597; + this.authOptionClause(); + } + break; + case 3: + { + this.state = 5598; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5599; + this.match(MySqlParser.KW_WITH); + this.state = 5600; + this.authenticationRule(); + } + break; + case 4: + { + this.state = 5601; + this.match(MySqlParser.KW_DISCARD); + this.state = 5602; + this.match(MySqlParser.KW_OLD); + this.state = 5603; + this.match(MySqlParser.KW_PASSWORD); + } + break; + case 5: + { + this.state = 5609; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 5604; + _la = this.tokenStream.LA(1); + if (!(_la === 6 || _la === 51 || _la === 492)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5605; + this.factor(); + this.state = 5607; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 423) { + { + this.state = 5606; + this.factorAuthOption(); + } + } + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5611; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 814, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + case 6: + { + this.state = 5613; + this.registrationOption(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createUserAuthOption() { + let localContext = new CreateUserAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 490, MySqlParser.RULE_createUserAuthOption); + let _la; + try { + this.state = 5652; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 822, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5616; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5617; + this.match(MySqlParser.KW_BY); + this.state = 5623; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5618; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + { + this.state = 5619; + this.match(MySqlParser.KW_RANDOM); + this.state = 5620; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + case MySqlParser.KW_PASSWORD: + { + { + this.state = 5621; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5622; + this.match(MySqlParser.STRING_LITERAL); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5627; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5625; + this.match(MySqlParser.KW_AND); + this.state = 5626; + this.createUserAuthOption(); + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5629; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5630; + this.match(MySqlParser.KW_WITH); + this.state = 5631; + localContext._authPlugin = this.uid(); + this.state = 5640; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BY: + { + { + this.state = 5632; + this.match(MySqlParser.KW_BY); + this.state = 5636; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5633; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + { + this.state = 5634; + this.match(MySqlParser.KW_RANDOM); + this.state = 5635; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + break; + case MySqlParser.KW_AS: + { + this.state = 5638; + this.match(MySqlParser.KW_AS); + this.state = 5639; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_AND: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_REQUIRE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + this.state = 5644; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 11) { + { + this.state = 5642; + this.match(MySqlParser.KW_AND); + this.state = 5643; + this.createUserAuthOption(); + } + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5646; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5647; + this.match(MySqlParser.KW_WITH); + this.state = 5648; + localContext._authPlugin = this.uid(); + this.state = 5650; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 427) { + { + this.state = 5649; + this.createUserInitialAuthOption(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createUserInitialAuthOption() { + let localContext = new CreateUserInitialAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 492, MySqlParser.RULE_createUserInitialAuthOption); + try { + this.state = 5671; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 824, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5654; + this.match(MySqlParser.KW_INITIAL); + this.state = 5655; + this.match(MySqlParser.KW_AUTHENTICATION); + this.state = 5656; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5657; + this.match(MySqlParser.KW_BY); + this.state = 5661; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_RANDOM: + { + { + this.state = 5658; + this.match(MySqlParser.KW_RANDOM); + this.state = 5659; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + case MySqlParser.STRING_LITERAL: + { + this.state = 5660; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5663; + this.match(MySqlParser.KW_INITIAL); + this.state = 5664; + this.match(MySqlParser.KW_AUTHENTICATION); + this.state = 5665; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5666; + this.match(MySqlParser.KW_WITH); + this.state = 5667; + localContext._authPlugin = this.uid(); + this.state = 5668; + this.match(MySqlParser.KW_AS); + this.state = 5669; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userAuthOption() { + let localContext = new UserAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 494, MySqlParser.RULE_userAuthOption); + try { + this.state = 5698; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 825, this.context)) { + case 1: + localContext = new HashAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5673; + this.userName(); + this.state = 5674; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5675; + this.match(MySqlParser.KW_BY); + this.state = 5676; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5677; + localContext._hashed = this.match(MySqlParser.STRING_LITERAL); + } + break; + case 2: + localContext = new RandomAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5679; + this.userName(); + this.state = 5680; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5681; + this.match(MySqlParser.KW_BY); + this.state = 5682; + this.match(MySqlParser.KW_RANDOM); + this.state = 5683; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5684; + this.authOptionClause(); + } + break; + case 3: + localContext = new StringAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5686; + this.userName(); + this.state = 5687; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5688; + this.match(MySqlParser.KW_BY); + this.state = 5689; + this.match(MySqlParser.STRING_LITERAL); + this.state = 5690; + this.authOptionClause(); + } + break; + case 4: + localContext = new ModuleAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 5692; + this.userName(); + this.state = 5693; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5694; + this.match(MySqlParser.KW_WITH); + this.state = 5695; + this.authenticationRule(); + } + break; + case 5: + localContext = new SimpleAuthOptionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 5697; + this.userName(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + authOptionClause() { + let localContext = new AuthOptionClauseContext(this.context, this.state); + this.enterRule(localContext, 496, MySqlParser.RULE_authOptionClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5702; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 826, this.context)) { + case 1: + { + this.state = 5700; + this.match(MySqlParser.KW_REPLACE); + this.state = 5701; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + this.state = 5707; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 147) { + { + this.state = 5704; + this.match(MySqlParser.KW_RETAIN); + this.state = 5705; + this.match(MySqlParser.KW_CURRENT); + this.state = 5706; + this.match(MySqlParser.KW_PASSWORD); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + authenticationRule() { + let localContext = new AuthenticationRuleContext(this.context, this.state); + this.enterRule(localContext, 498, MySqlParser.RULE_authenticationRule); + let _la; + try { + this.state = 5723; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 830, this.context)) { + case 1: + localContext = new ModuleContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5709; + localContext._authPlugin = this.uid(); + this.state = 5717; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 829, this.context)) { + case 1: + { + this.state = 5710; + _la = this.tokenStream.LA(1); + if (!(_la === 13 || _la === 20 || _la === 188)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5714; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5711; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + this.state = 5712; + this.match(MySqlParser.KW_RANDOM); + this.state = 5713; + this.match(MySqlParser.KW_PASSWORD); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 5716; + this.authOptionClause(); + } + break; + } + } + break; + case 2: + localContext = new PasswordModuleOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5719; + localContext._authPlugin = this.uid(); + this.state = 5720; + this.match(MySqlParser.KW_USING); + this.state = 5721; + this.passwordFunctionClause(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tlsOption() { + let localContext = new TlsOptionContext(this.context, this.state); + this.enterRule(localContext, 500, MySqlParser.RULE_tlsOption); + try { + this.state = 5733; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SSL: + this.enterOuterAlt(localContext, 1); + { + this.state = 5725; + this.match(MySqlParser.KW_SSL); + } + break; + case MySqlParser.KW_X509: + this.enterOuterAlt(localContext, 2); + { + this.state = 5726; + this.match(MySqlParser.KW_X509); + } + break; + case MySqlParser.KW_CIPHER: + this.enterOuterAlt(localContext, 3); + { + this.state = 5727; + this.match(MySqlParser.KW_CIPHER); + this.state = 5728; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_ISSUER: + this.enterOuterAlt(localContext, 4); + { + this.state = 5729; + this.match(MySqlParser.KW_ISSUER); + this.state = 5730; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_SUBJECT: + this.enterOuterAlt(localContext, 5); + { + this.state = 5731; + this.match(MySqlParser.KW_SUBJECT); + this.state = 5732; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userResourceOption() { + let localContext = new UserResourceOptionContext(this.context, this.state); + this.enterRule(localContext, 502, MySqlParser.RULE_userResourceOption); + try { + this.state = 5743; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + this.enterOuterAlt(localContext, 1); + { + this.state = 5735; + this.match(MySqlParser.KW_MAX_QUERIES_PER_HOUR); + this.state = 5736; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + this.enterOuterAlt(localContext, 2); + { + this.state = 5737; + this.match(MySqlParser.KW_MAX_UPDATES_PER_HOUR); + this.state = 5738; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + this.enterOuterAlt(localContext, 3); + { + this.state = 5739; + this.match(MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR); + this.state = 5740; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_MAX_USER_CONNECTIONS: + this.enterOuterAlt(localContext, 4); + { + this.state = 5741; + this.match(MySqlParser.KW_MAX_USER_CONNECTIONS); + this.state = 5742; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userPasswordOption() { + let localContext = new UserPasswordOptionContext(this.context, this.state); + this.enterRule(localContext, 504, MySqlParser.RULE_userPasswordOption); + let _la; + try { + this.state = 5783; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 838, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5745; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5746; + this.match(MySqlParser.KW_EXPIRE); + this.state = 5753; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 5747; + localContext._expireType = this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.KW_NEVER: + { + this.state = 5748; + localContext._expireType = this.match(MySqlParser.KW_NEVER); + } + break; + case MySqlParser.KW_INTERVAL: + { + this.state = 5749; + localContext._expireType = this.match(MySqlParser.KW_INTERVAL); + this.state = 5750; + this.decimalLiteral(); + this.state = 5751; + this.match(MySqlParser.KW_DAY); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + case MySqlParser.SEMI: + break; + default: + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5755; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5756; + this.match(MySqlParser.KW_HISTORY); + this.state = 5759; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 5757; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5758; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5761; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5762; + this.match(MySqlParser.KW_REUSE); + this.state = 5763; + this.match(MySqlParser.KW_INTERVAL); + this.state = 5768; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DEFAULT: + { + this.state = 5764; + this.match(MySqlParser.KW_DEFAULT); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5765; + this.decimalLiteral(); + this.state = 5766; + this.match(MySqlParser.KW_DAY); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5770; + this.match(MySqlParser.KW_PASSWORD); + this.state = 5771; + this.match(MySqlParser.KW_REQUIRE); + this.state = 5772; + this.match(MySqlParser.KW_CURRENT); + this.state = 5774; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42 || _la === 122) { + { + this.state = 5773; + _la = this.tokenStream.LA(1); + if (!(_la === 42 || _la === 122)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 5776; + this.match(MySqlParser.KW_FAILED_LOGIN_ATTEMPTS); + this.state = 5777; + this.decimalLiteral(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 5778; + this.match(MySqlParser.KW_PASSWORD_LOCK_TIME); + this.state = 5781; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 5779; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_UNBOUNDED: + { + this.state = 5780; + this.match(MySqlParser.KW_UNBOUNDED); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userLockOption() { + let localContext = new UserLockOptionContext(this.context, this.state); + this.enterRule(localContext, 506, MySqlParser.RULE_userLockOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5785; + this.match(MySqlParser.KW_ACCOUNT); + this.state = 5786; + localContext._lockType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 104 || _la === 183)) { + localContext._lockType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + factorAuthOption() { + let localContext = new FactorAuthOptionContext(this.context, this.state); + this.enterRule(localContext, 508, MySqlParser.RULE_factorAuthOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5788; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 5791; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 194) { + { + this.state = 5789; + this.match(MySqlParser.KW_WITH); + this.state = 5790; + localContext._authPlugin = this.uid(); + } + } + this.state = 5801; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BY: + { + { + this.state = 5793; + this.match(MySqlParser.KW_BY); + this.state = 5797; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + { + this.state = 5794; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_RANDOM: + { + { + this.state = 5795; + this.match(MySqlParser.KW_RANDOM); + this.state = 5796; + this.match(MySqlParser.KW_PASSWORD); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + break; + case MySqlParser.KW_AS: + { + this.state = 5799; + this.match(MySqlParser.KW_AS); + this.state = 5800; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + registrationOption() { + let localContext = new RegistrationOptionContext(this.context, this.state); + this.enterRule(localContext, 510, MySqlParser.RULE_registrationOption); + try { + this.state = 5818; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 842, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5803; + this.factor(); + this.state = 5804; + this.match(MySqlParser.KW_INITIATE); + this.state = 5805; + this.match(MySqlParser.KW_REGISTRATION); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5807; + this.factor(); + this.state = 5808; + this.match(MySqlParser.KW_FINISH); + this.state = 5809; + this.match(MySqlParser.KW_REGISTRATION); + this.state = 5810; + this.match(MySqlParser.KW_SET); + this.state = 5811; + this.match(MySqlParser.KW_CHALLENGE_RESPONSE); + this.state = 5812; + this.match(MySqlParser.KW_AS); + this.state = 5813; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5815; + this.factor(); + this.state = 5816; + this.match(MySqlParser.KW_UNREGISTER); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + factor() { + let localContext = new FactorContext(this.context, this.state); + this.enterRule(localContext, 512, MySqlParser.RULE_factor); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5820; + _la = this.tokenStream.LA(1); + if (!(_la === 873 || _la === 874)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 5821; + this.match(MySqlParser.KW_FACTOR); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privelegeClause() { + let localContext = new PrivelegeClauseContext(this.context, this.state); + this.enterRule(localContext, 514, MySqlParser.RULE_privelegeClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5823; + this.privilege(); + this.state = 5828; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 5824; + this.match(MySqlParser.LR_BRACKET); + this.state = 5825; + this.columnNames(); + this.state = 5826; + this.match(MySqlParser.RR_BRACKET); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilege() { + let localContext = new PrivilegeContext(this.context, this.state); + this.enterRule(localContext, 516, MySqlParser.RULE_privilege); + let _la; + try { + this.state = 5923; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 848, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5830; + this.match(MySqlParser.KW_ALL); + this.state = 5832; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 734) { + { + this.state = 5831; + this.match(MySqlParser.KW_PRIVILEGES); + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5834; + this.match(MySqlParser.KW_ALTER); + this.state = 5836; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 743) { + { + this.state = 5835; + this.match(MySqlParser.KW_ROUTINE); + } + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5838; + this.match(MySqlParser.KW_CREATE); + this.state = 5846; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_TEMPORARY: + { + this.state = 5839; + this.match(MySqlParser.KW_TEMPORARY); + this.state = 5840; + this.match(MySqlParser.KW_TABLES); + } + break; + case MySqlParser.KW_ROUTINE: + { + this.state = 5841; + this.match(MySqlParser.KW_ROUTINE); + } + break; + case MySqlParser.KW_VIEW: + { + this.state = 5842; + this.match(MySqlParser.KW_VIEW); + } + break; + case MySqlParser.KW_USER: + { + this.state = 5843; + this.match(MySqlParser.KW_USER); + } + break; + case MySqlParser.KW_TABLESPACE: + { + this.state = 5844; + this.match(MySqlParser.KW_TABLESPACE); + } + break; + case MySqlParser.KW_ROLE: + { + this.state = 5845; + this.match(MySqlParser.KW_ROLE); + } + break; + case MySqlParser.KW_ON: + case MySqlParser.LR_BRACKET: + case MySqlParser.COMMA: + break; + default: + break; + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5848; + this.match(MySqlParser.KW_DELETE); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 5849; + this.match(MySqlParser.KW_DROP); + this.state = 5851; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 582) { + { + this.state = 5850; + this.match(MySqlParser.KW_ROLE); + } + } + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 5853; + this.match(MySqlParser.KW_EVENT); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 5854; + this.match(MySqlParser.KW_EXECUTE); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 5855; + this.match(MySqlParser.KW_FILE); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 5856; + this.match(MySqlParser.KW_GRANT); + this.state = 5857; + this.match(MySqlParser.KW_OPTION); + } + break; + case 10: + this.enterOuterAlt(localContext, 10); + { + this.state = 5858; + this.match(MySqlParser.KW_INDEX); + } + break; + case 11: + this.enterOuterAlt(localContext, 11); + { + this.state = 5859; + this.match(MySqlParser.KW_INSERT); + } + break; + case 12: + this.enterOuterAlt(localContext, 12); + { + this.state = 5860; + this.match(MySqlParser.KW_LOCK); + this.state = 5861; + this.match(MySqlParser.KW_TABLES); + } + break; + case 13: + this.enterOuterAlt(localContext, 13); + { + this.state = 5862; + this.match(MySqlParser.KW_PROCESS); + } + break; + case 14: + this.enterOuterAlt(localContext, 14); + { + this.state = 5863; + this.match(MySqlParser.KW_PROXY); + } + break; + case 15: + this.enterOuterAlt(localContext, 15); + { + this.state = 5864; + this.match(MySqlParser.KW_REFERENCES); + } + break; + case 16: + this.enterOuterAlt(localContext, 16); + { + this.state = 5865; + this.match(MySqlParser.KW_RELOAD); + } + break; + case 17: + this.enterOuterAlt(localContext, 17); + { + this.state = 5866; + this.match(MySqlParser.KW_REPLICATION); + this.state = 5867; + _la = this.tokenStream.LA(1); + if (!(_la === 333 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 18: + this.enterOuterAlt(localContext, 18); + { + this.state = 5868; + this.match(MySqlParser.KW_SELECT); + } + break; + case 19: + this.enterOuterAlt(localContext, 19); + { + this.state = 5869; + this.match(MySqlParser.KW_SHOW); + this.state = 5870; + _la = this.tokenStream.LA(1); + if (!(_la === 40 || _la === 684)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 20: + this.enterOuterAlt(localContext, 20); + { + this.state = 5871; + this.match(MySqlParser.KW_SHUTDOWN); + } + break; + case 21: + this.enterOuterAlt(localContext, 21); + { + this.state = 5872; + this.match(MySqlParser.KW_SUPER); + } + break; + case 22: + this.enterOuterAlt(localContext, 22); + { + this.state = 5873; + this.match(MySqlParser.KW_TRIGGER); + } + break; + case 23: + this.enterOuterAlt(localContext, 23); + { + this.state = 5874; + this.match(MySqlParser.KW_UPDATE); + } + break; + case 24: + this.enterOuterAlt(localContext, 24); + { + this.state = 5875; + this.match(MySqlParser.KW_USAGE); + } + break; + case 25: + this.enterOuterAlt(localContext, 25); + { + this.state = 5876; + this.match(MySqlParser.KW_APPLICATION_PASSWORD_ADMIN); + } + break; + case 26: + this.enterOuterAlt(localContext, 26); + { + this.state = 5877; + this.match(MySqlParser.KW_AUDIT_ABORT_EXEMPT); + } + break; + case 27: + this.enterOuterAlt(localContext, 27); + { + this.state = 5878; + this.match(MySqlParser.KW_AUDIT_ADMIN); + } + break; + case 28: + this.enterOuterAlt(localContext, 28); + { + this.state = 5879; + this.match(MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN); + } + break; + case 29: + this.enterOuterAlt(localContext, 29); + { + this.state = 5880; + this.match(MySqlParser.KW_BACKUP_ADMIN); + } + break; + case 30: + this.enterOuterAlt(localContext, 30); + { + this.state = 5881; + this.match(MySqlParser.KW_BINLOG_ADMIN); + } + break; + case 31: + this.enterOuterAlt(localContext, 31); + { + this.state = 5882; + this.match(MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN); + } + break; + case 32: + this.enterOuterAlt(localContext, 32); + { + this.state = 5883; + this.match(MySqlParser.KW_CLONE_ADMIN); + } + break; + case 33: + this.enterOuterAlt(localContext, 33); + { + this.state = 5884; + this.match(MySqlParser.KW_CONNECTION_ADMIN); + } + break; + case 34: + this.enterOuterAlt(localContext, 34); + { + this.state = 5885; + this.match(MySqlParser.KW_ENCRYPTION_KEY_ADMIN); + } + break; + case 35: + this.enterOuterAlt(localContext, 35); + { + this.state = 5886; + this.match(MySqlParser.KW_FIREWALL_ADMIN); + } + break; + case 36: + this.enterOuterAlt(localContext, 36); + { + this.state = 5887; + this.match(MySqlParser.KW_FIREWALL_EXEMPT); + } + break; + case 37: + this.enterOuterAlt(localContext, 37); + { + this.state = 5888; + this.match(MySqlParser.KW_FIREWALL_USER); + } + break; + case 38: + this.enterOuterAlt(localContext, 38); + { + this.state = 5889; + this.match(MySqlParser.KW_FLUSH_OPTIMIZER_COSTS); + } + break; + case 39: + this.enterOuterAlt(localContext, 39); + { + this.state = 5890; + this.match(MySqlParser.KW_FLUSH_STATUS); + } + break; + case 40: + this.enterOuterAlt(localContext, 40); + { + this.state = 5891; + this.match(MySqlParser.KW_FLUSH_TABLES); + } + break; + case 41: + this.enterOuterAlt(localContext, 41); + { + this.state = 5892; + this.match(MySqlParser.KW_FLUSH_USER_RESOURCES); + } + break; + case 42: + this.enterOuterAlt(localContext, 42); + { + this.state = 5893; + this.match(MySqlParser.KW_GROUP_REPLICATION_ADMIN); + } + break; + case 43: + this.enterOuterAlt(localContext, 43); + { + this.state = 5894; + this.match(MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE); + } + break; + case 44: + this.enterOuterAlt(localContext, 44); + { + this.state = 5895; + this.match(MySqlParser.KW_INNODB_REDO_LOG_ENABLE); + } + break; + case 45: + this.enterOuterAlt(localContext, 45); + { + this.state = 5896; + this.match(MySqlParser.KW_NDB_STORED_USER); + } + break; + case 46: + this.enterOuterAlt(localContext, 46); + { + this.state = 5897; + this.match(MySqlParser.KW_PASSWORDLESS_USER_ADMIN); + } + break; + case 47: + this.enterOuterAlt(localContext, 47); + { + this.state = 5898; + this.match(MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN); + } + break; + case 48: + this.enterOuterAlt(localContext, 48); + { + this.state = 5899; + this.match(MySqlParser.KW_REPLICATION_APPLIER); + } + break; + case 49: + this.enterOuterAlt(localContext, 49); + { + this.state = 5900; + this.match(MySqlParser.KW_REPLICATION_SLAVE_ADMIN); + } + break; + case 50: + this.enterOuterAlt(localContext, 50); + { + this.state = 5901; + this.match(MySqlParser.KW_RESOURCE_GROUP_ADMIN); + } + break; + case 51: + this.enterOuterAlt(localContext, 51); + { + this.state = 5902; + this.match(MySqlParser.KW_RESOURCE_GROUP_USER); + } + break; + case 52: + this.enterOuterAlt(localContext, 52); + { + this.state = 5903; + this.match(MySqlParser.KW_ROLE_ADMIN); + } + break; + case 53: + this.enterOuterAlt(localContext, 53); + { + this.state = 5904; + this.match(MySqlParser.KW_SERVICE_CONNECTION_ADMIN); + } + break; + case 54: + this.enterOuterAlt(localContext, 54); + { + this.state = 5905; + this.match(MySqlParser.KW_SESSION_VARIABLES_ADMIN); + } + break; + case 55: + this.enterOuterAlt(localContext, 55); + { + this.state = 5906; + this.match(MySqlParser.KW_SET_USER_ID); + } + break; + case 56: + this.enterOuterAlt(localContext, 56); + { + this.state = 5907; + this.match(MySqlParser.KW_SKIP_QUERY_REWRITE); + } + break; + case 57: + this.enterOuterAlt(localContext, 57); + { + this.state = 5908; + this.match(MySqlParser.KW_SHOW_ROUTINE); + } + break; + case 58: + this.enterOuterAlt(localContext, 58); + { + this.state = 5909; + this.match(MySqlParser.KW_SYSTEM_USER); + } + break; + case 59: + this.enterOuterAlt(localContext, 59); + { + this.state = 5910; + this.match(MySqlParser.KW_SYSTEM_VARIABLES_ADMIN); + } + break; + case 60: + this.enterOuterAlt(localContext, 60); + { + this.state = 5911; + this.match(MySqlParser.KW_TABLE_ENCRYPTION_ADMIN); + } + break; + case 61: + this.enterOuterAlt(localContext, 61); + { + this.state = 5912; + this.match(MySqlParser.KW_TP_CONNECTION_ADMIN); + } + break; + case 62: + this.enterOuterAlt(localContext, 62); + { + this.state = 5913; + this.match(MySqlParser.KW_VERSION_TOKEN_ADMIN); + } + break; + case 63: + this.enterOuterAlt(localContext, 63); + { + this.state = 5914; + this.match(MySqlParser.KW_XA_RECOVER_ADMIN); + } + break; + case 64: + this.enterOuterAlt(localContext, 64); + { + this.state = 5915; + this.match(MySqlParser.KW_LOAD); + this.state = 5916; + this.match(MySqlParser.KW_FROM); + this.state = 5917; + this.match(MySqlParser.KW_S3); + } + break; + case 65: + this.enterOuterAlt(localContext, 65); + { + this.state = 5918; + this.match(MySqlParser.KW_SELECT); + this.state = 5919; + this.match(MySqlParser.KW_INTO); + this.state = 5920; + this.match(MySqlParser.KW_S3); + } + break; + case 66: + this.enterOuterAlt(localContext, 66); + { + this.state = 5921; + this.match(MySqlParser.KW_INVOKE); + this.state = 5922; + this.match(MySqlParser.KW_LAMBDA); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilegeLevel() { + let localContext = new PrivilegeLevelContext(this.context, this.state); + this.enterRule(localContext, 518, MySqlParser.RULE_privilegeLevel); + try { + this.state = 5941; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 849, this.context)) { + case 1: + localContext = new CurrentSchemaPriviLevelContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 5925; + this.match(MySqlParser.STAR); + } + break; + case 2: + localContext = new GlobalPrivLevelContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 5926; + this.match(MySqlParser.STAR); + this.state = 5927; + this.match(MySqlParser.DOT); + this.state = 5928; + this.match(MySqlParser.STAR); + } + break; + case 3: + localContext = new DefiniteSchemaPrivLevelContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 5929; + this.uid(); + this.state = 5930; + this.match(MySqlParser.DOT); + this.state = 5931; + this.match(MySqlParser.STAR); + } + break; + case 4: + localContext = new DefiniteFullTablePrivLevelContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 5933; + this.uid(); + this.state = 5934; + this.match(MySqlParser.DOT); + this.state = 5935; + this.uid(); + } + break; + case 5: + localContext = new DefiniteFullTablePrivLevel2Context(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 5937; + this.uid(); + this.state = 5938; + this.dottedId(); + } + break; + case 6: + localContext = new DefiniteTablePrivLevelContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 5940; + this.uid(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + renameUserClause() { + let localContext = new RenameUserClauseContext(this.context, this.state); + this.enterRule(localContext, 520, MySqlParser.RULE_renameUserClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5943; + localContext._fromFirst = this.userName(); + this.state = 5944; + this.match(MySqlParser.KW_TO); + this.state = 5945; + localContext._toFirst = this.userName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + analyzeTable() { + let localContext = new AnalyzeTableContext(this.context, this.state); + this.enterRule(localContext, 522, MySqlParser.RULE_analyzeTable); + let _la; + try { + this.state = 5995; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 856, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 5947; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5949; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5948; + this.tableActionOption(); + } + } + this.state = 5951; + this.match(MySqlParser.KW_TABLE); + this.state = 5952; + this.tableNames(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 5953; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5955; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5954; + this.tableActionOption(); + } + } + this.state = 5957; + this.match(MySqlParser.KW_TABLE); + this.state = 5958; + this.tableName(); + this.state = 5959; + this.match(MySqlParser.KW_UPDATE); + this.state = 5960; + this.match(MySqlParser.KW_HISTOGRAM); + this.state = 5961; + this.match(MySqlParser.KW_ON); + this.state = 5962; + this.columnNames(); + this.state = 5967; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 852, this.context)) { + case 1: + { + this.state = 5963; + this.match(MySqlParser.KW_WITH); + this.state = 5964; + this.decimalLiteral(); + this.state = 5965; + this.match(MySqlParser.KW_BUCKETS); + } + break; + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 5969; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5971; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5970; + this.tableActionOption(); + } + } + this.state = 5973; + this.match(MySqlParser.KW_TABLE); + this.state = 5974; + this.tableName(); + this.state = 5975; + this.match(MySqlParser.KW_UPDATE); + this.state = 5976; + this.match(MySqlParser.KW_HISTOGRAM); + this.state = 5977; + this.match(MySqlParser.KW_ON); + this.state = 5978; + this.columnName(); + this.state = 5982; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 5979; + this.match(MySqlParser.KW_USING); + this.state = 5980; + this.match(MySqlParser.KW_DATA); + this.state = 5981; + this.match(MySqlParser.STRING_LITERAL); + } + } + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 5984; + this.match(MySqlParser.KW_ANALYZE); + this.state = 5986; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 5985; + this.tableActionOption(); + } + } + this.state = 5988; + this.match(MySqlParser.KW_TABLE); + this.state = 5989; + this.tableName(); + this.state = 5990; + this.match(MySqlParser.KW_DROP); + this.state = 5991; + this.match(MySqlParser.KW_HISTOGRAM); + this.state = 5992; + this.match(MySqlParser.KW_ON); + this.state = 5993; + this.columnNames(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checkTable() { + let localContext = new CheckTableContext(this.context, this.state); + this.enterRule(localContext, 524, MySqlParser.RULE_checkTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 5997; + this.match(MySqlParser.KW_CHECK); + this.state = 5998; + this.match(MySqlParser.KW_TABLE); + this.state = 5999; + this.tableNames(); + this.state = 6003; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 65 || _la === 327 || _la === 392 || _la === 396 || _la === 484 || _la === 549) { + { + { + this.state = 6000; + this.checkTableOption(); + } + } + this.state = 6005; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checksumTable() { + let localContext = new ChecksumTableContext(this.context, this.state); + this.enterRule(localContext, 526, MySqlParser.RULE_checksumTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6006; + this.match(MySqlParser.KW_CHECKSUM); + this.state = 6007; + this.match(MySqlParser.KW_TABLE); + this.state = 6008; + this.tableNames(); + this.state = 6010; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392 || _la === 549) { + { + this.state = 6009; + localContext._actionOption = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 392 || _la === 549)) { + localContext._actionOption = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + optimizeTable() { + let localContext = new OptimizeTableContext(this.context, this.state); + this.enterRule(localContext, 528, MySqlParser.RULE_optimizeTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6012; + this.match(MySqlParser.KW_OPTIMIZE); + this.state = 6014; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 6013; + this.tableActionOption(); + } + } + this.state = 6016; + _la = this.tokenStream.LA(1); + if (!(_la === 173 || _la === 752)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6017; + this.tableNames(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + repairTable() { + let localContext = new RepairTableContext(this.context, this.state); + this.enterRule(localContext, 530, MySqlParser.RULE_repairTable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6019; + this.match(MySqlParser.KW_REPAIR); + this.state = 6021; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 6020; + this.tableActionOption(); + } + } + this.state = 6023; + this.match(MySqlParser.KW_TABLE); + this.state = 6024; + this.tableNames(); + this.state = 6026; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 549) { + { + this.state = 6025; + this.match(MySqlParser.KW_QUICK); + } + } + this.state = 6029; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6028; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6032; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 679) { + { + this.state = 6031; + this.match(MySqlParser.KW_USE_FRM); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableActionOption() { + let localContext = new TableActionOptionContext(this.context, this.state); + this.enterRule(localContext, 532, MySqlParser.RULE_tableActionOption); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6034; + _la = this.tokenStream.LA(1); + if (!(_la === 115 || _la === 450)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + checkTableOption() { + let localContext = new CheckTableOptionContext(this.context, this.state); + this.enterRule(localContext, 534, MySqlParser.RULE_checkTableOption); + try { + this.state = 6043; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_FOR: + this.enterOuterAlt(localContext, 1); + { + this.state = 6036; + this.match(MySqlParser.KW_FOR); + this.state = 6037; + this.match(MySqlParser.KW_UPGRADE); + } + break; + case MySqlParser.KW_QUICK: + this.enterOuterAlt(localContext, 2); + { + this.state = 6038; + this.match(MySqlParser.KW_QUICK); + } + break; + case MySqlParser.KW_FAST: + this.enterOuterAlt(localContext, 3); + { + this.state = 6039; + this.match(MySqlParser.KW_FAST); + } + break; + case MySqlParser.KW_MEDIUM: + this.enterOuterAlt(localContext, 4); + { + this.state = 6040; + this.match(MySqlParser.KW_MEDIUM); + } + break; + case MySqlParser.KW_EXTENDED: + this.enterOuterAlt(localContext, 5); + { + this.state = 6041; + this.match(MySqlParser.KW_EXTENDED); + } + break; + case MySqlParser.KW_CHANGED: + this.enterOuterAlt(localContext, 6); + { + this.state = 6042; + this.match(MySqlParser.KW_CHANGED); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + createFunction() { + let localContext = new CreateFunctionContext(this.context, this.state); + this.enterRule(localContext, 536, MySqlParser.RULE_createFunction); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6045; + this.match(MySqlParser.KW_CREATE); + this.state = 6047; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 307) { + { + this.state = 6046; + this.match(MySqlParser.KW_AGGREGATE); + } + } + this.state = 6049; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6051; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 866, this.context)) { + case 1: + { + this.state = 6050; + this.ifNotExists(); + } + break; + } + this.state = 6053; + this.functionNameCreate(); + this.state = 6054; + this.match(MySqlParser.KW_RETURNS); + this.state = 6055; + localContext._returnType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 208)) & ~0x1F) === 0 && ((1 << (_la - 208)) & 261) !== 0) || _la === 649)) { + localContext._returnType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6056; + this.match(MySqlParser.KW_SONAME); + this.state = 6057; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + installComponent() { + let localContext = new InstallComponentContext(this.context, this.state); + this.enterRule(localContext, 538, MySqlParser.RULE_installComponent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6059; + this.match(MySqlParser.KW_INSTALL); + this.state = 6060; + this.match(MySqlParser.KW_COMPONENT); + this.state = 6061; + localContext._component_name = this.uid(); + this.state = 6066; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6062; + this.match(MySqlParser.COMMA); + this.state = 6063; + localContext._component_name = this.uid(); + } + } + this.state = 6068; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 6078; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 869, this.context)) { + case 1: + { + this.state = 6069; + this.match(MySqlParser.KW_SET); + this.state = 6070; + this.variableExpr(); + this.state = 6075; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6071; + this.match(MySqlParser.COMMA); + this.state = 6072; + this.variableExpr(); + } + } + this.state = 6077; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + variableExpr() { + let localContext = new VariableExprContext(this.context, this.state); + this.enterRule(localContext, 540, MySqlParser.RULE_variableExpr); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6080; + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 531 || _la === 893 || _la === 894)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6081; + localContext._system_var_name = this.fullId(); + this.state = 6082; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6083; + this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uninstallComponent() { + let localContext = new UninstallComponentContext(this.context, this.state); + this.enterRule(localContext, 542, MySqlParser.RULE_uninstallComponent); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6085; + this.match(MySqlParser.KW_UNINSTALL); + this.state = 6086; + this.match(MySqlParser.KW_COMPONENT); + this.state = 6087; + localContext._component_name = this.uid(); + this.state = 6092; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6088; + this.match(MySqlParser.COMMA); + this.state = 6089; + localContext._component_name = this.uid(); + } + } + this.state = 6094; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + installPlugin() { + let localContext = new InstallPluginContext(this.context, this.state); + this.enterRule(localContext, 544, MySqlParser.RULE_installPlugin); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6095; + this.match(MySqlParser.KW_INSTALL); + this.state = 6096; + this.match(MySqlParser.KW_PLUGIN); + this.state = 6097; + localContext._pluginName = this.uid(); + this.state = 6098; + this.match(MySqlParser.KW_SONAME); + this.state = 6099; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uninstallPlugin() { + let localContext = new UninstallPluginContext(this.context, this.state); + this.enterRule(localContext, 546, MySqlParser.RULE_uninstallPlugin); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6101; + this.match(MySqlParser.KW_UNINSTALL); + this.state = 6102; + this.match(MySqlParser.KW_PLUGIN); + this.state = 6103; + localContext._pluginName = this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + cloneStatement() { + let localContext = new CloneStatementContext(this.context, this.state); + this.enterRule(localContext, 548, MySqlParser.RULE_cloneStatement); + let _la; + try { + this.state = 6135; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 876, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6105; + this.match(MySqlParser.KW_CLONE); + this.state = 6106; + this.match(MySqlParser.KW_LOCAL); + this.state = 6107; + this.match(MySqlParser.KW_DATA); + this.state = 6108; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 6110; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 6109; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 6112; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6113; + this.match(MySqlParser.KW_CLONE); + this.state = 6114; + this.match(MySqlParser.KW_INSTANCE); + this.state = 6115; + this.match(MySqlParser.KW_FROM); + this.state = 6116; + this.userHostPort(); + this.state = 6117; + this.match(MySqlParser.KW_IDENTIFIED); + this.state = 6118; + this.match(MySqlParser.KW_BY); + this.state = 6119; + this.match(MySqlParser.STRING_LITERAL); + this.state = 6126; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 360) { + { + this.state = 6120; + this.match(MySqlParser.KW_DATA); + this.state = 6121; + this.match(MySqlParser.KW_DIRECTORY); + this.state = 6123; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 857) { + { + this.state = 6122; + this.match(MySqlParser.EQUAL_SYMBOL); + } + } + this.state = 6125; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 6133; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 144) { + { + this.state = 6128; + this.match(MySqlParser.KW_REQUIRE); + this.state = 6130; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 502) { + { + this.state = 6129; + this.match(MySqlParser.KW_NO); + } + } + this.state = 6132; + this.match(MySqlParser.KW_SSL); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + setStatement() { + let localContext = new SetStatementContext(this.context, this.state); + this.enterRule(localContext, 550, MySqlParser.RULE_setStatement); + let _la; + try { + this.state = 6189; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 884, this.context)) { + case 1: + localContext = new SetVariableContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6137; + this.match(MySqlParser.KW_SET); + this.state = 6138; + this.variableClause(); + this.state = 6139; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6142; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 877, this.context)) { + case 1: + { + this.state = 6140; + this.expression(0); + } + break; + case 2: + { + this.state = 6141; + this.match(MySqlParser.KW_ON); + } + break; + } + this.state = 6153; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6144; + this.match(MySqlParser.COMMA); + this.state = 6145; + this.variableClause(); + this.state = 6146; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6149; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 878, this.context)) { + case 1: + { + this.state = 6147; + this.expression(0); + } + break; + case 2: + { + this.state = 6148; + this.match(MySqlParser.KW_ON); + } + break; + } + } + } + this.state = 6155; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + localContext = new SetCharsetContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6156; + this.match(MySqlParser.KW_SET); + this.state = 6157; + this.charSet(); + this.state = 6160; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 6158; + this.charsetName(); + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 6159; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 3: + localContext = new SetNamesContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 6162; + this.match(MySqlParser.KW_SET); + this.state = 6163; + this.match(MySqlParser.KW_NAMES); + this.state = 6170; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + { + this.state = 6164; + this.charsetName(); + this.state = 6167; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 28) { + { + this.state = 6165; + this.match(MySqlParser.KW_COLLATE); + this.state = 6166; + this.collationName(); + } + } + } + break; + case MySqlParser.KW_DEFAULT: + { + this.state = 6169; + this.match(MySqlParser.KW_DEFAULT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 4: + localContext = new SetPasswordContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 6172; + this.setPasswordStatement(); + } + break; + case 5: + localContext = new SetTransactionContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 6173; + this.setTransactionStatement(); + } + break; + case 6: + localContext = new SetAutocommitContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 6174; + this.setAutocommitStatement(); + } + break; + case 7: + localContext = new SetNewValueInsideTriggerContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 6175; + this.match(MySqlParser.KW_SET); + this.state = 6176; + localContext._system_var_name = this.fullId(); + this.state = 6177; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6178; + this.expression(0); + this.state = 6186; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6179; + this.match(MySqlParser.COMMA); + this.state = 6180; + localContext._system_var_name = this.fullId(); + this.state = 6181; + _la = this.tokenStream.LA(1); + if (!(_la === 841 || _la === 857)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6182; + this.expression(0); + } + } + this.state = 6188; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showStatement() { + let localContext = new ShowStatementContext(this.context, this.state); + this.enterRule(localContext, 552, MySqlParser.RULE_showStatement); + let _la; + try { + this.state = 6375; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 913, this.context)) { + case 1: + localContext = new ShowMasterLogsContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6191; + this.match(MySqlParser.KW_SHOW); + this.state = 6192; + localContext._logFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 228 || _la === 453)) { + localContext._logFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6193; + this.match(MySqlParser.KW_LOGS); + } + break; + case 2: + localContext = new ShowLogEventsContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6194; + this.match(MySqlParser.KW_SHOW); + this.state = 6195; + localContext._logFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 318 || _la === 559)) { + localContext._logFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6196; + this.match(MySqlParser.KW_EVENTS); + this.state = 6199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 80) { + { + this.state = 6197; + this.match(MySqlParser.KW_IN); + this.state = 6198; + localContext._filename = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 6203; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68) { + { + this.state = 6201; + this.match(MySqlParser.KW_FROM); + this.state = 6202; + localContext._fromPosition = this.decimalLiteral(); + } + } + this.state = 6212; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 6205; + this.match(MySqlParser.KW_LIMIT); + this.state = 6209; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 887, this.context)) { + case 1: + { + this.state = 6206; + localContext._offset = this.decimalLiteral(); + this.state = 6207; + this.match(MySqlParser.COMMA); + } + break; + } + this.state = 6211; + localContext._rowCount = this.decimalLiteral(); + } + } + this.state = 6215; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6214; + this.channelOption(); + } + } + } + break; + case 3: + localContext = new ShowObjectFilterContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 6217; + this.match(MySqlParser.KW_SHOW); + this.state = 6218; + this.showCommonEntity(); + this.state = 6220; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6219; + this.showFilter(); + } + } + } + break; + case 4: + localContext = new ShowColumnsContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 6222; + this.match(MySqlParser.KW_SHOW); + this.state = 6224; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6223; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6227; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 408) { + { + this.state = 6226; + this.match(MySqlParser.KW_FULL); + } + } + this.state = 6229; + localContext._columnsFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 337 || _la === 398)) { + localContext._columnsFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6230; + localContext._tableFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._tableFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6231; + this.tableName(); + this.state = 6234; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6232; + localContext._schemaFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._schemaFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6233; + this.databaseName(); + } + } + this.state = 6237; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6236; + this.showFilter(); + } + } + } + break; + case 5: + localContext = new ShowCreateDbContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 6239; + this.match(MySqlParser.KW_SHOW); + this.state = 6240; + this.match(MySqlParser.KW_CREATE); + this.state = 6241; + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 152)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6243; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 895, this.context)) { + case 1: + { + this.state = 6242; + this.ifNotExists(); + } + break; + } + this.state = 6245; + this.databaseName(); + } + break; + case 6: + localContext = new ShowCreateFullIdObjectContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 6246; + this.match(MySqlParser.KW_SHOW); + this.state = 6247; + this.match(MySqlParser.KW_CREATE); + this.state = 6248; + _la = this.tokenStream.LA(1); + if (!(_la === 132 || _la === 178 || _la === 385)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6249; + this.fullId(); + } + break; + case 7: + localContext = new ShowCreateFunctionContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 6250; + this.match(MySqlParser.KW_SHOW); + this.state = 6251; + this.match(MySqlParser.KW_CREATE); + this.state = 6252; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6253; + this.functionName(); + } + break; + case 8: + localContext = new ShowCreateViewContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 6254; + this.match(MySqlParser.KW_SHOW); + this.state = 6255; + this.match(MySqlParser.KW_CREATE); + this.state = 6256; + this.match(MySqlParser.KW_VIEW); + this.state = 6257; + this.viewName(); + } + break; + case 9: + localContext = new ShowCreateTableContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 6258; + this.match(MySqlParser.KW_SHOW); + this.state = 6259; + this.match(MySqlParser.KW_CREATE); + this.state = 6260; + this.match(MySqlParser.KW_TABLE); + this.state = 6261; + this.tableName(); + } + break; + case 10: + localContext = new ShowCreateUserContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 6262; + this.match(MySqlParser.KW_SHOW); + this.state = 6263; + this.match(MySqlParser.KW_CREATE); + this.state = 6264; + this.match(MySqlParser.KW_USER); + this.state = 6265; + this.userName(); + } + break; + case 11: + localContext = new ShowEngineContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 6266; + this.match(MySqlParser.KW_SHOW); + this.state = 6267; + this.match(MySqlParser.KW_ENGINE); + this.state = 6268; + this.engineName(); + this.state = 6269; + localContext._engineOption = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 493 || _la === 645)) { + localContext._engineOption = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 12: + localContext = new ShowGlobalInfoContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 6271; + this.match(MySqlParser.KW_SHOW); + this.state = 6272; + this.showGlobalInfoClause(); + } + break; + case 13: + localContext = new ShowErrorsContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 6273; + this.match(MySqlParser.KW_SHOW); + this.state = 6274; + localContext._errorFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 383 || _la === 688)) { + localContext._errorFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6282; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 6275; + this.match(MySqlParser.KW_LIMIT); + this.state = 6279; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 896, this.context)) { + case 1: + { + this.state = 6276; + localContext._offset = this.decimalLiteral(); + this.state = 6277; + this.match(MySqlParser.COMMA); + } + break; + } + this.state = 6281; + localContext._rowCount = this.decimalLiteral(); + } + } + } + break; + case 14: + localContext = new ShowCountErrorsContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 6284; + this.match(MySqlParser.KW_SHOW); + this.state = 6285; + this.match(MySqlParser.KW_COUNT); + this.state = 6286; + this.match(MySqlParser.LR_BRACKET); + this.state = 6287; + this.match(MySqlParser.STAR); + this.state = 6288; + this.match(MySqlParser.RR_BRACKET); + this.state = 6289; + localContext._errorFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 383 || _la === 688)) { + localContext._errorFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 15: + localContext = new ShowSchemaFilterContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 6290; + this.match(MySqlParser.KW_SHOW); + this.state = 6291; + this.showSchemaEntity(); + this.state = 6294; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6292; + localContext._schemaFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._schemaFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6293; + this.databaseName(); + } + } + this.state = 6297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6296; + this.showFilter(); + } + } + } + break; + case 16: + localContext = new ShowPercedureCodeContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 6299; + this.match(MySqlParser.KW_SHOW); + this.state = 6300; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 6301; + this.match(MySqlParser.KW_CODE); + this.state = 6302; + localContext._proc_name = this.fullId(); + } + break; + case 17: + localContext = new ShowFunctionCodeContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 6303; + this.match(MySqlParser.KW_SHOW); + this.state = 6304; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6305; + this.match(MySqlParser.KW_CODE); + this.state = 6306; + this.functionName(); + } + break; + case 18: + localContext = new ShowGrantsContext(localContext); + this.enterOuterAlt(localContext, 18); + { + this.state = 6307; + this.match(MySqlParser.KW_SHOW); + this.state = 6308; + this.match(MySqlParser.KW_GRANTS); + this.state = 6315; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6309; + this.match(MySqlParser.KW_FOR); + this.state = 6310; + this.userOrRoleName(); + this.state = 6313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 6311; + this.match(MySqlParser.KW_USING); + this.state = 6312; + this.userOrRoleNames(); + } + } + } + } + } + break; + case 19: + localContext = new ShowIndexesContext(localContext); + this.enterOuterAlt(localContext, 19); + { + this.state = 6317; + this.match(MySqlParser.KW_SHOW); + this.state = 6319; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6318; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6321; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 93 || _la === 426)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6322; + localContext._tableFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._tableFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6323; + this.tableName(); + this.state = 6326; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6324; + localContext._schemaFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + localContext._schemaFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6325; + this.databaseName(); + } + } + this.state = 6330; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 192) { + { + this.state = 6328; + this.match(MySqlParser.KW_WHERE); + this.state = 6329; + this.expression(0); + } + } + } + break; + case 20: + localContext = new ShowOpenTablesContext(localContext); + this.enterOuterAlt(localContext, 20); + { + this.state = 6332; + this.match(MySqlParser.KW_SHOW); + this.state = 6333; + this.match(MySqlParser.KW_OPEN); + this.state = 6334; + this.match(MySqlParser.KW_TABLES); + this.state = 6337; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 68 || _la === 80) { + { + this.state = 6335; + _la = this.tokenStream.LA(1); + if (!(_la === 68 || _la === 80)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6336; + this.databaseName(); + } + } + this.state = 6340; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 99 || _la === 192) { + { + this.state = 6339; + this.showFilter(); + } + } + } + break; + case 21: + localContext = new ShowProfileContext(localContext); + this.enterOuterAlt(localContext, 21); + { + this.state = 6342; + this.match(MySqlParser.KW_SHOW); + this.state = 6343; + this.match(MySqlParser.KW_PROFILE); + this.state = 6352; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7 || _la === 320 || _la === 355 || _la === 358 || _la === 439 || _la === 521 || _la === 605 || _la === 655 || _la === 802) { + { + this.state = 6344; + this.showProfileType(); + this.state = 6349; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6345; + this.match(MySqlParser.COMMA); + this.state = 6346; + this.showProfileType(); + } + } + this.state = 6351; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 6357; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6354; + this.match(MySqlParser.KW_FOR); + this.state = 6355; + this.match(MySqlParser.KW_QUERY); + this.state = 6356; + localContext._queryCount = this.decimalLiteral(); + } + } + this.state = 6365; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 100) { + { + this.state = 6359; + this.match(MySqlParser.KW_LIMIT); + this.state = 6360; + localContext._rowCount = this.decimalLiteral(); + this.state = 6363; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 509) { + { + this.state = 6361; + this.match(MySqlParser.KW_OFFSET); + this.state = 6362; + localContext._offset = this.decimalLiteral(); + } + } + } + } + } + break; + case 22: + localContext = new ShowSlaveStatusContext(localContext); + this.enterOuterAlt(localContext, 22); + { + this.state = 6367; + this.match(MySqlParser.KW_SHOW); + this.state = 6368; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6369; + this.match(MySqlParser.KW_STATUS); + this.state = 6371; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6370; + this.channelOption(); + } + } + } + break; + case 23: + localContext = new ShowReplicasContext(localContext); + this.enterOuterAlt(localContext, 23); + { + this.state = 6373; + this.match(MySqlParser.KW_SHOW); + this.state = 6374; + this.match(MySqlParser.KW_REPLICAS); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + variableClause() { + let localContext = new VariableClauseContext(this.context, this.state); + this.enterRule(localContext, 554, MySqlParser.RULE_variableClause); + let _la; + try { + this.state = 6387; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LOCAL_ID: + this.enterOuterAlt(localContext, 1); + { + this.state = 6377; + this.match(MySqlParser.LOCAL_ID); + } + break; + case MySqlParser.GLOBAL_ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 6378; + this.match(MySqlParser.GLOBAL_ID); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PERSIST: + case MySqlParser.KW_PERSIST_ONLY: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.AT_SIGN: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 3); + { + this.state = 6384; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 915, this.context)) { + case 1: + { + this.state = 6381; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 870) { + { + this.state = 6379; + this.match(MySqlParser.AT_SIGN); + this.state = 6380; + this.match(MySqlParser.AT_SIGN); + } + } + this.state = 6383; + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 450 || _la === 531 || _la === 532 || _la === 593)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 6386; + localContext._target = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showCommonEntity() { + let localContext = new ShowCommonEntityContext(this.context, this.state); + this.enterRule(localContext, 556, MySqlParser.RULE_showCommonEntity); + let _la; + try { + this.state = 6403; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CHARACTER: + this.enterOuterAlt(localContext, 1); + { + this.state = 6389; + this.match(MySqlParser.KW_CHARACTER); + this.state = 6390; + this.match(MySqlParser.KW_SET); + } + break; + case MySqlParser.KW_CHARSET: + this.enterOuterAlt(localContext, 2); + { + this.state = 6391; + this.match(MySqlParser.KW_CHARSET); + } + break; + case MySqlParser.KW_COLLATION: + this.enterOuterAlt(localContext, 3); + { + this.state = 6392; + this.match(MySqlParser.KW_COLLATION); + } + break; + case MySqlParser.KW_DATABASES: + this.enterOuterAlt(localContext, 4); + { + this.state = 6393; + this.match(MySqlParser.KW_DATABASES); + } + break; + case MySqlParser.KW_SCHEMAS: + this.enterOuterAlt(localContext, 5); + { + this.state = 6394; + this.match(MySqlParser.KW_SCHEMAS); + } + break; + case MySqlParser.KW_FUNCTION: + this.enterOuterAlt(localContext, 6); + { + this.state = 6395; + this.match(MySqlParser.KW_FUNCTION); + this.state = 6396; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_PROCEDURE: + this.enterOuterAlt(localContext, 7); + { + this.state = 6397; + this.match(MySqlParser.KW_PROCEDURE); + this.state = 6398; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_VARIABLES: + this.enterOuterAlt(localContext, 8); + { + this.state = 6400; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 413 || _la === 593) { + { + this.state = 6399; + _la = this.tokenStream.LA(1); + if (!(_la === 413 || _la === 593)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6402; + _la = this.tokenStream.LA(1); + if (!(_la === 645 || _la === 683)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showFilter() { + let localContext = new ShowFilterContext(this.context, this.state); + this.enterRule(localContext, 558, MySqlParser.RULE_showFilter); + try { + this.state = 6409; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_LIKE: + this.enterOuterAlt(localContext, 1); + { + this.state = 6405; + this.match(MySqlParser.KW_LIKE); + this.state = 6406; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.KW_WHERE: + this.enterOuterAlt(localContext, 2); + { + this.state = 6407; + this.match(MySqlParser.KW_WHERE); + this.state = 6408; + this.expression(0); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showGlobalInfoClause() { + let localContext = new ShowGlobalInfoClauseContext(this.context, this.state); + this.enterRule(localContext, 560, MySqlParser.RULE_showGlobalInfoClause); + let _la; + try { + this.state = 6428; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_STORAGE: + this.enterOuterAlt(localContext, 1); + { + this.state = 6412; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 647) { + { + this.state = 6411; + this.match(MySqlParser.KW_STORAGE); + } + } + this.state = 6414; + this.match(MySqlParser.KW_ENGINES); + } + break; + case MySqlParser.KW_MASTER: + this.enterOuterAlt(localContext, 2); + { + this.state = 6415; + this.match(MySqlParser.KW_MASTER); + this.state = 6416; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_PLUGINS: + this.enterOuterAlt(localContext, 3); + { + this.state = 6417; + this.match(MySqlParser.KW_PLUGINS); + } + break; + case MySqlParser.KW_PRIVILEGES: + this.enterOuterAlt(localContext, 4); + { + this.state = 6418; + this.match(MySqlParser.KW_PRIVILEGES); + } + break; + case MySqlParser.KW_FULL: + case MySqlParser.KW_PROCESSLIST: + this.enterOuterAlt(localContext, 5); + { + this.state = 6420; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 408) { + { + this.state = 6419; + this.match(MySqlParser.KW_FULL); + } + } + this.state = 6422; + this.match(MySqlParser.KW_PROCESSLIST); + } + break; + case MySqlParser.KW_PROFILES: + this.enterOuterAlt(localContext, 6); + { + this.state = 6423; + this.match(MySqlParser.KW_PROFILES); + } + break; + case MySqlParser.KW_SLAVE: + this.enterOuterAlt(localContext, 7); + { + this.state = 6424; + this.match(MySqlParser.KW_SLAVE); + this.state = 6425; + this.match(MySqlParser.KW_HOSTS); + } + break; + case MySqlParser.KW_AUTHORS: + this.enterOuterAlt(localContext, 8); + { + this.state = 6426; + this.match(MySqlParser.KW_AUTHORS); + } + break; + case MySqlParser.KW_CONTRIBUTORS: + this.enterOuterAlt(localContext, 9); + { + this.state = 6427; + this.match(MySqlParser.KW_CONTRIBUTORS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showSchemaEntity() { + let localContext = new ShowSchemaEntityContext(this.context, this.state); + this.enterRule(localContext, 562, MySqlParser.RULE_showSchemaEntity); + let _la; + try { + this.state = 6441; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_EVENTS: + this.enterOuterAlt(localContext, 1); + { + this.state = 6430; + this.match(MySqlParser.KW_EVENTS); + } + break; + case MySqlParser.KW_TABLE: + this.enterOuterAlt(localContext, 2); + { + this.state = 6431; + this.match(MySqlParser.KW_TABLE); + this.state = 6432; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_FULL: + case MySqlParser.KW_TABLES: + this.enterOuterAlt(localContext, 3); + { + this.state = 6434; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 392) { + { + this.state = 6433; + this.match(MySqlParser.KW_EXTENDED); + } + } + this.state = 6437; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 408) { + { + this.state = 6436; + this.match(MySqlParser.KW_FULL); + } + } + this.state = 6439; + this.match(MySqlParser.KW_TABLES); + } + break; + case MySqlParser.KW_TRIGGERS: + this.enterOuterAlt(localContext, 4); + { + this.state = 6440; + this.match(MySqlParser.KW_TRIGGERS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + showProfileType() { + let localContext = new ShowProfileTypeContext(this.context, this.state); + this.enterRule(localContext, 564, MySqlParser.RULE_showProfileType); + try { + this.state = 6455; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ALL: + this.enterOuterAlt(localContext, 1); + { + this.state = 6443; + this.match(MySqlParser.KW_ALL); + } + break; + case MySqlParser.KW_BLOCK: + this.enterOuterAlt(localContext, 2); + { + this.state = 6444; + this.match(MySqlParser.KW_BLOCK); + this.state = 6445; + this.match(MySqlParser.KW_IO); + } + break; + case MySqlParser.KW_CONTEXT: + this.enterOuterAlt(localContext, 3); + { + this.state = 6446; + this.match(MySqlParser.KW_CONTEXT); + this.state = 6447; + this.match(MySqlParser.KW_SWITCHES); + } + break; + case MySqlParser.KW_CPU: + this.enterOuterAlt(localContext, 4); + { + this.state = 6448; + this.match(MySqlParser.KW_CPU); + } + break; + case MySqlParser.KW_IPC: + this.enterOuterAlt(localContext, 5); + { + this.state = 6449; + this.match(MySqlParser.KW_IPC); + } + break; + case MySqlParser.KW_MEMORY: + this.enterOuterAlt(localContext, 6); + { + this.state = 6450; + this.match(MySqlParser.KW_MEMORY); + } + break; + case MySqlParser.KW_PAGE: + this.enterOuterAlt(localContext, 7); + { + this.state = 6451; + this.match(MySqlParser.KW_PAGE); + this.state = 6452; + this.match(MySqlParser.KW_FAULTS); + } + break; + case MySqlParser.KW_SOURCE: + this.enterOuterAlt(localContext, 8); + { + this.state = 6453; + this.match(MySqlParser.KW_SOURCE); + } + break; + case MySqlParser.KW_SWAPS: + this.enterOuterAlt(localContext, 9); + { + this.state = 6454; + this.match(MySqlParser.KW_SWAPS); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + binlogStatement() { + let localContext = new BinlogStatementContext(this.context, this.state); + this.enterRule(localContext, 566, MySqlParser.RULE_binlogStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6457; + this.match(MySqlParser.KW_BINLOG); + this.state = 6458; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + cacheIndexStatement() { + let localContext = new CacheIndexStatementContext(this.context, this.state); + this.enterRule(localContext, 568, MySqlParser.RULE_cacheIndexStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6460; + this.match(MySqlParser.KW_CACHE); + this.state = 6461; + this.match(MySqlParser.KW_INDEX); + this.state = 6479; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 929, this.context)) { + case 1: + { + this.state = 6462; + this.tableIndex(); + this.state = 6467; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6463; + this.match(MySqlParser.COMMA); + this.state = 6464; + this.tableIndex(); + } + } + this.state = 6469; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + { + this.state = 6470; + this.tableName(); + this.state = 6471; + this.match(MySqlParser.KW_PARTITION); + this.state = 6472; + this.match(MySqlParser.LR_BRACKET); + this.state = 6475; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 6473; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 6474; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6477; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 6481; + this.match(MySqlParser.KW_IN); + this.state = 6482; + this.databaseName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + flushStatement() { + let localContext = new FlushStatementContext(this.context, this.state); + this.enterRule(localContext, 570, MySqlParser.RULE_flushStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6484; + this.match(MySqlParser.KW_FLUSH); + this.state = 6486; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 115 || _la === 450) { + { + this.state = 6485; + this.tableActionOption(); + } + } + this.state = 6488; + this.flushOption(); + this.state = 6493; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6489; + this.match(MySqlParser.COMMA); + this.state = 6490; + this.flushOption(); + } + } + this.state = 6495; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + killStatement() { + let localContext = new KillStatementContext(this.context, this.state); + this.enterRule(localContext, 572, MySqlParser.RULE_killStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6496; + this.match(MySqlParser.KW_KILL); + this.state = 6498; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 932, this.context)) { + case 1: + { + this.state = 6497; + localContext._connectionFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 349 || _la === 548)) { + localContext._connectionFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 6500; + this.expression(0); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadIndexIntoCache() { + let localContext = new LoadIndexIntoCacheContext(this.context, this.state); + this.enterRule(localContext, 574, MySqlParser.RULE_loadIndexIntoCache); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6502; + this.match(MySqlParser.KW_LOAD); + this.state = 6503; + this.match(MySqlParser.KW_INDEX); + this.state = 6504; + this.match(MySqlParser.KW_INTO); + this.state = 6505; + this.match(MySqlParser.KW_CACHE); + this.state = 6506; + this.loadedTableIndexes(); + this.state = 6511; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6507; + this.match(MySqlParser.COMMA); + this.state = 6508; + this.loadedTableIndexes(); + } + } + this.state = 6513; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetStatement() { + let localContext = new ResetStatementContext(this.context, this.state); + this.enterRule(localContext, 576, MySqlParser.RULE_resetStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6514; + this.match(MySqlParser.KW_RESET); + this.state = 6515; + this.resetOption(); + this.state = 6520; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6516; + this.match(MySqlParser.COMMA); + this.state = 6517; + this.resetOption(); + } + } + this.state = 6522; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetOption() { + let localContext = new ResetOptionContext(this.context, this.state); + this.enterRule(localContext, 578, MySqlParser.RULE_resetOption); + try { + this.state = 6528; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_MASTER: + this.enterOuterAlt(localContext, 1); + { + this.state = 6523; + this.match(MySqlParser.KW_MASTER); + } + break; + case MySqlParser.KW_REPLICA: + this.enterOuterAlt(localContext, 2); + { + this.state = 6524; + this.match(MySqlParser.KW_REPLICA); + } + break; + case MySqlParser.KW_QUERY: + this.enterOuterAlt(localContext, 3); + { + this.state = 6525; + this.match(MySqlParser.KW_QUERY); + this.state = 6526; + this.match(MySqlParser.KW_CACHE); + } + break; + case MySqlParser.KW_SLAVE: + this.enterOuterAlt(localContext, 4); + { + this.state = 6527; + this.match(MySqlParser.KW_SLAVE); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetPersist() { + let localContext = new ResetPersistContext(this.context, this.state); + this.enterRule(localContext, 580, MySqlParser.RULE_resetPersist); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6530; + this.match(MySqlParser.KW_RESET); + this.state = 6531; + this.match(MySqlParser.KW_PERSIST); + this.state = 6536; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 937, this.context)) { + case 1: + { + this.state = 6533; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 936, this.context)) { + case 1: + { + this.state = 6532; + this.ifExists(); + } + break; + } + this.state = 6535; + localContext._system_var_name = this.uid(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resetAllChannel() { + let localContext = new ResetAllChannelContext(this.context, this.state); + this.enterRule(localContext, 582, MySqlParser.RULE_resetAllChannel); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6538; + this.match(MySqlParser.KW_RESET); + this.state = 6539; + _la = this.tokenStream.LA(1); + if (!(_la === 563 || _la === 598)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6541; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 7) { + { + this.state = 6540; + this.match(MySqlParser.KW_ALL); + } + } + this.state = 6544; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6543; + this.channelOption(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + reStartStatement() { + let localContext = new ReStartStatementContext(this.context, this.state); + this.enterRule(localContext, 584, MySqlParser.RULE_reStartStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6546; + this.match(MySqlParser.KW_RESTART); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + shutdownStatement() { + let localContext = new ShutdownStatementContext(this.context, this.state); + this.enterRule(localContext, 586, MySqlParser.RULE_shutdownStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6548; + this.match(MySqlParser.KW_SHUTDOWN); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableIndex() { + let localContext = new TableIndexContext(this.context, this.state); + this.enterRule(localContext, 588, MySqlParser.RULE_tableIndex); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6550; + this.tableName(); + this.state = 6556; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 6551; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6552; + this.match(MySqlParser.LR_BRACKET); + this.state = 6553; + this.indexNames(); + this.state = 6554; + this.match(MySqlParser.RR_BRACKET); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + flushOption() { + let localContext = new FlushOptionContext(this.context, this.state); + this.enterRule(localContext, 590, MySqlParser.RULE_flushOption); + let _la; + try { + this.state = 6590; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 947, this.context)) { + case 1: + localContext = new SimpleFlushOptionContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6576; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DES_KEY_FILE: + { + this.state = 6558; + this.match(MySqlParser.KW_DES_KEY_FILE); + } + break; + case MySqlParser.KW_HOSTS: + { + this.state = 6559; + this.match(MySqlParser.KW_HOSTS); + } + break; + case MySqlParser.KW_BINARY: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_SLOW: + { + this.state = 6561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228 || ((((_la - 380)) & ~0x1F) === 0 && ((1 << (_la - 380)) & 1073741829) !== 0) || _la === 556 || _la === 599) { + { + this.state = 6560; + _la = this.tokenStream.LA(1); + if (!(_la === 228 || ((((_la - 380)) & ~0x1F) === 0 && ((1 << (_la - 380)) & 1073741829) !== 0) || _la === 556 || _la === 599)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6563; + this.match(MySqlParser.KW_LOGS); + } + break; + case MySqlParser.KW_OPTIMIZER_COSTS: + { + this.state = 6564; + this.match(MySqlParser.KW_OPTIMIZER_COSTS); + } + break; + case MySqlParser.KW_PRIVILEGES: + { + this.state = 6565; + this.match(MySqlParser.KW_PRIVILEGES); + } + break; + case MySqlParser.KW_QUERY: + { + this.state = 6566; + this.match(MySqlParser.KW_QUERY); + this.state = 6567; + this.match(MySqlParser.KW_CACHE); + } + break; + case MySqlParser.KW_STATUS: + { + this.state = 6568; + this.match(MySqlParser.KW_STATUS); + } + break; + case MySqlParser.KW_USER_RESOURCES: + { + this.state = 6569; + this.match(MySqlParser.KW_USER_RESOURCES); + } + break; + case MySqlParser.KW_TABLES: + { + this.state = 6570; + this.match(MySqlParser.KW_TABLES); + this.state = 6574; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 942, this.context)) { + case 1: + { + this.state = 6571; + this.match(MySqlParser.KW_WITH); + this.state = 6572; + this.match(MySqlParser.KW_READ); + this.state = 6573; + this.match(MySqlParser.KW_LOCK); + } + break; + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case 2: + localContext = new ChannelFlushOptionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6578; + this.match(MySqlParser.KW_RELAY); + this.state = 6579; + this.match(MySqlParser.KW_LOGS); + this.state = 6581; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 6580; + this.channelOption(); + } + } + } + break; + case 3: + localContext = new TableFlushOptionContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 6583; + _la = this.tokenStream.LA(1); + if (!(_la === 173 || _la === 752)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6585; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 945, this.context)) { + case 1: + { + this.state = 6584; + this.tableNames(); + } + break; + } + this.state = 6588; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 946, this.context)) { + case 1: + { + this.state = 6587; + this.flushTableOption(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + flushTableOption() { + let localContext = new FlushTableOptionContext(this.context, this.state); + this.enterRule(localContext, 592, MySqlParser.RULE_flushTableOption); + try { + this.state = 6597; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_WITH: + this.enterOuterAlt(localContext, 1); + { + this.state = 6592; + this.match(MySqlParser.KW_WITH); + this.state = 6593; + this.match(MySqlParser.KW_READ); + this.state = 6594; + this.match(MySqlParser.KW_LOCK); + } + break; + case MySqlParser.KW_FOR: + this.enterOuterAlt(localContext, 2); + { + this.state = 6595; + this.match(MySqlParser.KW_FOR); + this.state = 6596; + this.match(MySqlParser.KW_EXPORT); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + loadedTableIndexes() { + let localContext = new LoadedTableIndexesContext(this.context, this.state); + this.enterRule(localContext, 594, MySqlParser.RULE_loadedTableIndexes); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6599; + this.tableName(); + this.state = 6607; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 6600; + this.match(MySqlParser.KW_PARTITION); + this.state = 6601; + this.match(MySqlParser.LR_BRACKET); + this.state = 6604; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 6602; + this.partitionNames(); + } + break; + case MySqlParser.KW_ALL: + { + this.state = 6603; + this.match(MySqlParser.KW_ALL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6606; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 6616; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 952, this.context)) { + case 1: + { + this.state = 6610; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 82 || _la === 92) { + { + this.state = 6609; + localContext._indexFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 82 || _la === 92)) { + localContext._indexFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6612; + this.match(MySqlParser.LR_BRACKET); + this.state = 6613; + this.indexNames(); + this.state = 6614; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + this.state = 6620; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 79) { + { + this.state = 6618; + this.match(MySqlParser.KW_IGNORE); + this.state = 6619; + this.match(MySqlParser.KW_LEAVES); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleDescribeStatement() { + let localContext = new SimpleDescribeStatementContext(this.context, this.state); + this.enterRule(localContext, 596, MySqlParser.RULE_simpleDescribeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6622; + localContext._command = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 45)) & ~0x1F) === 0 && ((1 << (_la - 45)) & 131075) !== 0))) { + localContext._command = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6623; + this.tableName(); + this.state = 6626; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 954, this.context)) { + case 1: + { + this.state = 6624; + localContext._column = this.columnName(); + } + break; + case 2: + { + this.state = 6625; + localContext._pattern = this.match(MySqlParser.STRING_LITERAL); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fullDescribeStatement() { + let localContext = new FullDescribeStatementContext(this.context, this.state); + this.enterRule(localContext, 598, MySqlParser.RULE_fullDescribeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6628; + localContext._command = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 45)) & ~0x1F) === 0 && ((1 << (_la - 45)) & 131075) !== 0))) { + localContext._command = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6634; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_EXTENDED: + { + this.state = 6629; + this.match(MySqlParser.KW_EXTENDED); + } + break; + case MySqlParser.KW_PARTITIONS: + { + this.state = 6630; + this.match(MySqlParser.KW_PARTITIONS); + } + break; + case MySqlParser.KW_FORMAT: + { + this.state = 6631; + this.match(MySqlParser.KW_FORMAT); + this.state = 6632; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6633; + _la = this.tokenStream.LA(1); + if (!(_la === 442 || _la === 663 || _la === 666)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_DELETE: + case MySqlParser.KW_FOR: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_UPDATE: + case MySqlParser.LR_BRACKET: + break; + default: + break; + } + this.state = 6636; + this.describeObjectClause(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + analyzeDescribeStatement() { + let localContext = new AnalyzeDescribeStatementContext(this.context, this.state); + this.enterRule(localContext, 600, MySqlParser.RULE_analyzeDescribeStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6638; + localContext._command = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 45)) & ~0x1F) === 0 && ((1 << (_la - 45)) & 131075) !== 0))) { + localContext._command = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6639; + this.match(MySqlParser.KW_ANALYZE); + this.state = 6643; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 826) { + { + this.state = 6640; + this.match(MySqlParser.KW_FORMAT); + this.state = 6641; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6642; + this.match(MySqlParser.KW_TREE); + } + } + this.state = 6645; + this.selectStatement(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + helpStatement() { + let localContext = new HelpStatementContext(this.context, this.state); + this.enterRule(localContext, 602, MySqlParser.RULE_helpStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6647; + this.match(MySqlParser.KW_HELP); + this.state = 6648; + this.match(MySqlParser.STRING_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + useStatement() { + let localContext = new UseStatementContext(this.context, this.state); + this.enterRule(localContext, 604, MySqlParser.RULE_useStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6650; + this.match(MySqlParser.KW_USE); + this.state = 6651; + this.databaseName(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + signalStatement() { + let localContext = new SignalStatementContext(this.context, this.state); + this.enterRule(localContext, 606, MySqlParser.RULE_signalStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6653; + this.match(MySqlParser.KW_SIGNAL); + this.state = 6661; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SQLSTATE: + { + { + this.state = 6654; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 6656; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 6655; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 6658; + this.stringLiteral(); + } + } + break; + case MySqlParser.ID: + { + this.state = 6659; + this.match(MySqlParser.ID); + } + break; + case MySqlParser.REVERSE_QUOTE_ID: + { + this.state = 6660; + this.match(MySqlParser.REVERSE_QUOTE_ID); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6672; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 960, this.context)) { + case 1: + { + this.state = 6663; + this.match(MySqlParser.KW_SET); + this.state = 6664; + this.signalConditionInformation(); + this.state = 6669; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6665; + this.match(MySqlParser.COMMA); + this.state = 6666; + this.signalConditionInformation(); + } + } + this.state = 6671; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + resignalStatement() { + let localContext = new ResignalStatementContext(this.context, this.state); + this.enterRule(localContext, 608, MySqlParser.RULE_resignalStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6674; + this.match(MySqlParser.KW_RESIGNAL); + this.state = 6682; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SQLSTATE: + { + { + this.state = 6675; + this.match(MySqlParser.KW_SQLSTATE); + this.state = 6677; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 682) { + { + this.state = 6676; + this.match(MySqlParser.KW_VALUE); + } + } + this.state = 6679; + this.stringLiteral(); + } + } + break; + case MySqlParser.ID: + { + this.state = 6680; + this.match(MySqlParser.ID); + } + break; + case MySqlParser.REVERSE_QUOTE_ID: + { + this.state = 6681; + this.match(MySqlParser.REVERSE_QUOTE_ID); + } + break; + case MySqlParser.EOF: + case MySqlParser.KW_ALTER: + case MySqlParser.KW_ANALYZE: + case MySqlParser.KW_CALL: + case MySqlParser.KW_CHANGE: + case MySqlParser.KW_CHECK: + case MySqlParser.KW_CREATE: + case MySqlParser.KW_DELETE: + case MySqlParser.KW_DESC: + case MySqlParser.KW_DESCRIBE: + case MySqlParser.KW_DROP: + case MySqlParser.KW_EXPLAIN: + case MySqlParser.KW_GET: + case MySqlParser.KW_GRANT: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_KILL: + case MySqlParser.KW_LOAD: + case MySqlParser.KW_LOCK: + case MySqlParser.KW_OPTIMIZE: + case MySqlParser.KW_PURGE: + case MySqlParser.KW_RELEASE: + case MySqlParser.KW_RENAME: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RESIGNAL: + case MySqlParser.KW_REVOKE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_SET: + case MySqlParser.KW_SHOW: + case MySqlParser.KW_SIGNAL: + case MySqlParser.KW_TABLE: + case MySqlParser.KW_UNLOCK: + case MySqlParser.KW_UPDATE: + case MySqlParser.KW_USE: + case MySqlParser.KW_VALUES: + case MySqlParser.KW_WITH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DO: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HELP: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESTART: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_START: + case MySqlParser.KW_STOP: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_XA: + case MySqlParser.KW_CLONE: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.LR_BRACKET: + case MySqlParser.SEMI: + break; + default: + break; + } + this.state = 6693; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 964, this.context)) { + case 1: + { + this.state = 6684; + this.match(MySqlParser.KW_SET); + this.state = 6685; + this.signalConditionInformation(); + this.state = 6690; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6686; + this.match(MySqlParser.COMMA); + this.state = 6687; + this.signalConditionInformation(); + } + } + this.state = 6692; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + signalConditionInformation() { + let localContext = new SignalConditionInformationContext(this.context, this.state); + this.enterRule(localContext, 610, MySqlParser.RULE_signalConditionInformation); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6695; + _la = this.tokenStream.LA(1); + if (!(((((_la - 332)) & ~0x1F) === 0 && ((1 << (_la - 332)) & 137887873) !== 0) || _la === 487 || _la === 495 || _la === 650 || _la === 657 || _la === 822 || _la === 832)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6696; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6701; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.START_NATIONAL_STRING_LITERAL: + case MySqlParser.STRING_LITERAL: + case MySqlParser.STRING_CHARSET_NAME: + { + this.state = 6697; + this.stringLiteral(); + } + break; + case MySqlParser.DECIMAL_LITERAL: + { + this.state = 6698; + this.match(MySqlParser.DECIMAL_LITERAL); + } + break; + case MySqlParser.LOCAL_ID: + case MySqlParser.GLOBAL_ID: + { + this.state = 6699; + this.mysqlVariable(); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.ID: + { + this.state = 6700; + this.simpleId(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + withStatement() { + let localContext = new WithStatementContext(this.context, this.state); + this.enterRule(localContext, 612, MySqlParser.RULE_withStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6703; + this.match(MySqlParser.KW_WITH); + this.state = 6705; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 966, this.context)) { + case 1: + { + this.state = 6704; + this.match(MySqlParser.KW_RECURSIVE); + } + break; + } + this.state = 6707; + this.commonTableExpressions(); + this.state = 6712; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6708; + this.match(MySqlParser.COMMA); + this.state = 6709; + this.commonTableExpressions(); + } + } + this.state = 6714; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableStatement() { + let localContext = new TableStatementContext(this.context, this.state); + this.enterRule(localContext, 614, MySqlParser.RULE_tableStatement); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6715; + this.match(MySqlParser.KW_TABLE); + this.state = 6716; + this.tableName(); + this.state = 6718; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 968, this.context)) { + case 1: + { + this.state = 6717; + this.orderByClause(); + } + break; + } + this.state = 6721; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 969, this.context)) { + case 1: + { + this.state = 6720; + this.limitClause(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + diagnosticsStatement() { + let localContext = new DiagnosticsStatementContext(this.context, this.state); + this.enterRule(localContext, 616, MySqlParser.RULE_diagnosticsStatement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6723; + this.match(MySqlParser.KW_GET); + this.state = 6725; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 36 || _la === 170) { + { + this.state = 6724; + _la = this.tokenStream.LA(1); + if (!(_la === 36 || _la === 170)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6727; + this.match(MySqlParser.KW_DIAGNOSTICS); + this.state = 6759; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 974, this.context)) { + case 1: + { + { + this.state = 6728; + this.variableClause(); + this.state = 6729; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6730; + _la = this.tokenStream.LA(1); + if (!(_la === 117 || _la === 831)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 6738; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6731; + this.match(MySqlParser.COMMA); + this.state = 6732; + this.variableClause(); + this.state = 6733; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6734; + _la = this.tokenStream.LA(1); + if (!(_la === 117 || _la === 831)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 6740; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + case 2: + { + { + this.state = 6741; + this.match(MySqlParser.KW_CONDITION); + this.state = 6744; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + { + this.state = 6742; + this.decimalLiteral(); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PERSIST: + case MySqlParser.KW_PERSIST_ONLY: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.AT_SIGN: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + case MySqlParser.LOCAL_ID: + case MySqlParser.GLOBAL_ID: + { + this.state = 6743; + this.variableClause(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 6746; + this.variableClause(); + this.state = 6747; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6748; + this.diagnosticsConditionInformationName(); + this.state = 6756; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6749; + this.match(MySqlParser.COMMA); + this.state = 6750; + this.variableClause(); + this.state = 6751; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 6752; + this.diagnosticsConditionInformationName(); + } + } + this.state = 6758; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + diagnosticsConditionInformationName() { + let localContext = new DiagnosticsConditionInformationNameContext(this.context, this.state); + this.enterRule(localContext, 618, MySqlParser.RULE_diagnosticsConditionInformationName); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6761; + _la = this.tokenStream.LA(1); + if (!(((((_la - 332)) & ~0x1F) === 0 && ((1 << (_la - 332)) & 137887873) !== 0) || _la === 487 || _la === 495 || _la === 578 || _la === 650 || _la === 657 || _la === 822 || _la === 832)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + describeObjectClause() { + let localContext = new DescribeObjectClauseContext(this.context, this.state); + this.enterRule(localContext, 620, MySqlParser.RULE_describeObjectClause); + try { + this.state = 6773; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DELETE: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_SELECT: + case MySqlParser.KW_UPDATE: + case MySqlParser.LR_BRACKET: + localContext = new DescribeStatementsContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 6768; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_SELECT: + case MySqlParser.LR_BRACKET: + { + this.state = 6763; + this.selectStatement(); + } + break; + case MySqlParser.KW_DELETE: + { + this.state = 6764; + this.deleteStatement(); + } + break; + case MySqlParser.KW_INSERT: + { + this.state = 6765; + this.insertStatement(); + } + break; + case MySqlParser.KW_REPLACE: + { + this.state = 6766; + this.replaceStatement(); + } + break; + case MySqlParser.KW_UPDATE: + { + this.state = 6767; + this.updateStatement(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + break; + case MySqlParser.KW_FOR: + localContext = new DescribeConnectionContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 6770; + this.match(MySqlParser.KW_FOR); + this.state = 6771; + this.match(MySqlParser.KW_CONNECTION); + this.state = 6772; + localContext._connection_id = this.uid(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + databaseNameCreate() { + let localContext = new DatabaseNameCreateContext(this.context, this.state); + this.enterRule(localContext, 622, MySqlParser.RULE_databaseNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6775; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + databaseName() { + let localContext = new DatabaseNameContext(this.context, this.state); + this.enterRule(localContext, 624, MySqlParser.RULE_databaseName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6777; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionNameCreate() { + let localContext = new FunctionNameCreateContext(this.context, this.state); + this.enterRule(localContext, 626, MySqlParser.RULE_functionNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6779; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionName() { + let localContext = new FunctionNameContext(this.context, this.state); + this.enterRule(localContext, 628, MySqlParser.RULE_functionName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6781; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + viewNameCreate() { + let localContext = new ViewNameCreateContext(this.context, this.state); + this.enterRule(localContext, 630, MySqlParser.RULE_viewNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6783; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + viewName() { + let localContext = new ViewNameContext(this.context, this.state); + this.enterRule(localContext, 632, MySqlParser.RULE_viewName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6785; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexNameCreate() { + let localContext = new IndexNameCreateContext(this.context, this.state); + this.enterRule(localContext, 634, MySqlParser.RULE_indexNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6787; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexNames() { + let localContext = new IndexNamesContext(this.context, this.state); + this.enterRule(localContext, 636, MySqlParser.RULE_indexNames); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6789; + this.indexName(); + this.state = 6794; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6790; + this.match(MySqlParser.COMMA); + this.state = 6791; + this.indexName(); + } + } + this.state = 6796; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexName() { + let localContext = new IndexNameContext(this.context, this.state); + this.enterRule(localContext, 638, MySqlParser.RULE_indexName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6797; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupNameCreate() { + let localContext = new GroupNameCreateContext(this.context, this.state); + this.enterRule(localContext, 640, MySqlParser.RULE_groupNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6799; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + groupName() { + let localContext = new GroupNameContext(this.context, this.state); + this.enterRule(localContext, 642, MySqlParser.RULE_groupName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6801; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableNameCreate() { + let localContext = new TableNameCreateContext(this.context, this.state); + this.enterRule(localContext, 644, MySqlParser.RULE_tableNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6803; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableNames() { + let localContext = new TableNamesContext(this.context, this.state); + this.enterRule(localContext, 646, MySqlParser.RULE_tableNames); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 6805; + this.tableName(); + this.state = 6810; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 978, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 6806; + this.match(MySqlParser.COMMA); + this.state = 6807; + this.tableName(); + } + } + } + this.state = 6812; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 978, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tableName() { + let localContext = new TableNameContext(this.context, this.state); + this.enterRule(localContext, 648, MySqlParser.RULE_tableName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6813; + this.fullId(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userOrRoleNames() { + let localContext = new UserOrRoleNamesContext(this.context, this.state); + this.enterRule(localContext, 650, MySqlParser.RULE_userOrRoleNames); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6815; + this.userOrRoleName(); + this.state = 6820; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6816; + this.match(MySqlParser.COMMA); + this.state = 6817; + this.userOrRoleName(); + } + } + this.state = 6822; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userOrRoleName() { + let localContext = new UserOrRoleNameContext(this.context, this.state); + this.enterRule(localContext, 652, MySqlParser.RULE_userOrRoleName); + try { + this.state = 6825; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 980, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6823; + this.userName(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6824; + this.uid(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnNameCreate() { + let localContext = new ColumnNameCreateContext(this.context, this.state); + this.enterRule(localContext, 654, MySqlParser.RULE_columnNameCreate); + let _la; + try { + this.state = 6841; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 985, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6827; + this.uid(); + this.state = 6832; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 6828; + this.dottedId(); + this.state = 6830; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 6829; + this.dottedId(); + } + } + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6835; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 983, this.context)) { + case 1: + { + this.state = 6834; + this.matchWildcard(); + } + break; + } + this.state = 6837; + this.dottedId(); + this.state = 6839; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 865) { + { + this.state = 6838; + this.dottedId(); + } + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnNames() { + let localContext = new ColumnNamesContext(this.context, this.state); + this.enterRule(localContext, 656, MySqlParser.RULE_columnNames); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 6843; + this.columnName(); + this.state = 6848; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 986, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 6844; + this.match(MySqlParser.COMMA); + this.state = 6845; + this.columnName(); + } + } + } + this.state = 6850; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 986, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + columnName() { + let localContext = new ColumnNameContext(this.context, this.state); + this.enterRule(localContext, 658, MySqlParser.RULE_columnName); + try { + this.state = 6866; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 991, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6851; + this.uid(); + this.state = 6856; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 988, this.context)) { + case 1: + { + this.state = 6852; + this.dottedId(); + this.state = 6854; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 987, this.context)) { + case 1: + { + this.state = 6853; + this.dottedId(); + } + break; + } + } + break; + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6859; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 989, this.context)) { + case 1: + { + this.state = 6858; + this.matchWildcard(); + } + break; + } + this.state = 6861; + this.dottedId(); + this.state = 6863; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 990, this.context)) { + case 1: + { + this.state = 6862; + this.dottedId(); + } + break; + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6865; + if (!(this.shouldMatchEmpty())) { + throw this.createFailedPredicateException("this.shouldMatchEmpty()"); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablespaceNameCreate() { + let localContext = new TablespaceNameCreateContext(this.context, this.state); + this.enterRule(localContext, 660, MySqlParser.RULE_tablespaceNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6868; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + tablespaceName() { + let localContext = new TablespaceNameContext(this.context, this.state); + this.enterRule(localContext, 662, MySqlParser.RULE_tablespaceName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6870; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionNameCreate() { + let localContext = new PartitionNameCreateContext(this.context, this.state); + this.enterRule(localContext, 664, MySqlParser.RULE_partitionNameCreate); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6872; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionNames() { + let localContext = new PartitionNamesContext(this.context, this.state); + this.enterRule(localContext, 666, MySqlParser.RULE_partitionNames); + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 6874; + this.partitionName(); + this.state = 6879; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 992, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + { + { + this.state = 6875; + this.match(MySqlParser.COMMA); + this.state = 6876; + this.partitionName(); + } + } + } + this.state = 6881; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 992, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionName() { + let localContext = new PartitionNameContext(this.context, this.state); + this.enterRule(localContext, 668, MySqlParser.RULE_partitionName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6882; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexColumnName() { + let localContext = new IndexColumnNameContext(this.context, this.state); + this.enterRule(localContext, 670, MySqlParser.RULE_indexColumnName); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6892; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 994, this.context)) { + case 1: + { + this.state = 6884; + this.uid(); + this.state = 6889; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 993, this.context)) { + case 1: + { + this.state = 6885; + this.match(MySqlParser.LR_BRACKET); + this.state = 6886; + this.decimalLiteral(); + this.state = 6887; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 2: + { + this.state = 6891; + this.expression(0); + } + break; + } + this.state = 6895; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 995, this.context)) { + case 1: + { + this.state = 6894; + localContext._sortType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45)) { + localContext._sortType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userHostPort() { + let localContext = new UserHostPortContext(this.context, this.state); + this.enterRule(localContext, 672, MySqlParser.RULE_userHostPort); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6897; + this.userAtHost(); + this.state = 6898; + this.match(MySqlParser.COLON_SYMB); + this.state = 6899; + this.decimalLiteral(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userAtHost() { + let localContext = new UserAtHostContext(this.context, this.state); + this.enterRule(localContext, 674, MySqlParser.RULE_userAtHost); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6901; + this.simpleUserName(); + this.state = 6902; + this.match(MySqlParser.HOST_IP_ADDRESS); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleUserName() { + let localContext = new SimpleUserNameContext(this.context, this.state); + this.enterRule(localContext, 676, MySqlParser.RULE_simpleUserName); + try { + this.state = 6908; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 996, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6904; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6905; + this.match(MySqlParser.ID); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6906; + this.match(MySqlParser.KW_ADMIN); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 6907; + this.keywordsCanBeId(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + hostName() { + let localContext = new HostNameContext(this.context, this.state); + this.enterRule(localContext, 678, MySqlParser.RULE_hostName); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6910; + _la = this.tokenStream.LA(1); + if (!(((((_la - 870)) & ~0x1F) === 0 && ((1 << (_la - 870)) & 6291457) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userName() { + let localContext = new UserNameContext(this.context, this.state); + this.enterRule(localContext, 680, MySqlParser.RULE_userName); + let _la; + try { + this.state = 6917; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 998, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6912; + this.simpleUserName(); + this.state = 6914; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 870)) & ~0x1F) === 0 && ((1 << (_la - 870)) & 6291457) !== 0)) { + { + this.state = 6913; + this.hostName(); + } + } + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6916; + this.currentUserExpression(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + mysqlVariable() { + let localContext = new MysqlVariableContext(this.context, this.state); + this.enterRule(localContext, 682, MySqlParser.RULE_mysqlVariable); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6919; + _la = this.tokenStream.LA(1); + if (!(_la === 892 || _la === 893)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + charsetName() { + let localContext = new CharsetNameContext(this.context, this.state); + this.enterRule(localContext, 684, MySqlParser.RULE_charsetName); + try { + this.state = 6925; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 999, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6921; + this.match(MySqlParser.KW_BINARY); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6922; + this.charsetNameBase(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6923; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 6924; + this.match(MySqlParser.CHARSET_REVERSE_QOUTE_STRING); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + collationName() { + let localContext = new CollationNameContext(this.context, this.state); + this.enterRule(localContext, 686, MySqlParser.RULE_collationName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6927; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + engineName() { + let localContext = new EngineNameContext(this.context, this.state); + this.enterRule(localContext, 688, MySqlParser.RULE_engineName); + try { + this.state = 6932; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + this.enterOuterAlt(localContext, 1); + { + this.state = 6929; + this.engineNameBase(); + } + break; + case MySqlParser.ID: + this.enterOuterAlt(localContext, 2); + { + this.state = 6930; + this.match(MySqlParser.ID); + } + break; + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 3); + { + this.state = 6931; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + engineNameBase() { + let localContext = new EngineNameBaseContext(this.context, this.state); + this.enterRule(localContext, 690, MySqlParser.RULE_engineNameBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6934; + _la = this.tokenStream.LA(1); + if (!(_la === 348 || ((((_la - 797)) & ~0x1F) === 0 && ((1 << (_la - 797)) & 4095) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uuidSet() { + let localContext = new UuidSetContext(this.context, this.state); + this.enterRule(localContext, 692, MySqlParser.RULE_uuidSet); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6936; + this.decimalLiteral(); + this.state = 6937; + this.match(MySqlParser.MINUS); + this.state = 6938; + this.decimalLiteral(); + this.state = 6939; + this.match(MySqlParser.MINUS); + this.state = 6940; + this.decimalLiteral(); + this.state = 6941; + this.match(MySqlParser.MINUS); + this.state = 6942; + this.decimalLiteral(); + this.state = 6943; + this.match(MySqlParser.MINUS); + this.state = 6944; + this.decimalLiteral(); + this.state = 6950; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 6945; + this.match(MySqlParser.COLON_SYMB); + this.state = 6946; + this.decimalLiteral(); + this.state = 6947; + this.match(MySqlParser.MINUS); + this.state = 6948; + this.decimalLiteral(); + } + } + this.state = 6952; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 878); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xid() { + let localContext = new XidContext(this.context, this.state); + this.enterRule(localContext, 694, MySqlParser.RULE_xid); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6954; + localContext._globalTableUid = this.xuidStringId(); + this.state = 6961; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 6955; + this.match(MySqlParser.COMMA); + this.state = 6956; + localContext._qualifier = this.xuidStringId(); + this.state = 6959; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 6957; + this.match(MySqlParser.COMMA); + this.state = 6958; + localContext._idFormat = this.decimalLiteral(); + } + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + xuidStringId() { + let localContext = new XuidStringIdContext(this.context, this.state); + this.enterRule(localContext, 696, MySqlParser.RULE_xuidStringId); + let _la; + try { + this.state = 6970; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 6963; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.BIT_STRING: + this.enterOuterAlt(localContext, 2); + { + this.state = 6964; + this.match(MySqlParser.BIT_STRING); + } + break; + case MySqlParser.HEXADECIMAL_LITERAL: + this.enterOuterAlt(localContext, 3); + { + this.state = 6966; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 6965; + this.match(MySqlParser.HEXADECIMAL_LITERAL); + } + } + this.state = 6968; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 884); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fullId() { + let localContext = new FullIdContext(this.context, this.state); + this.enterRule(localContext, 698, MySqlParser.RULE_fullId); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6972; + this.uid(); + this.state = 6974; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1006, this.context)) { + case 1: + { + this.state = 6973; + this.dottedId(); + } + break; + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uidList() { + let localContext = new UidListContext(this.context, this.state); + this.enterRule(localContext, 700, MySqlParser.RULE_uidList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 6976; + this.uid(); + this.state = 6981; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 6977; + this.match(MySqlParser.COMMA); + this.state = 6978; + this.uid(); + } + } + this.state = 6983; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + uid() { + let localContext = new UidContext(this.context, this.state); + this.enterRule(localContext, 702, MySqlParser.RULE_uid); + try { + this.state = 6987; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.ID: + this.enterOuterAlt(localContext, 1); + { + this.state = 6984; + this.simpleId(); + } + break; + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + this.enterOuterAlt(localContext, 2); + { + this.state = 6985; + this.match(MySqlParser.CHARSET_REVERSE_QOUTE_STRING); + } + break; + case MySqlParser.STRING_LITERAL: + this.enterOuterAlt(localContext, 3); + { + this.state = 6986; + this.match(MySqlParser.STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleId() { + let localContext = new SimpleIdContext(this.context, this.state); + this.enterRule(localContext, 704, MySqlParser.RULE_simpleId); + try { + this.state = 6998; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1009, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 6989; + this.match(MySqlParser.ID); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 6990; + this.charsetNameBase(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 6991; + this.transactionLevelBase(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 6992; + this.engineNameBase(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 6993; + this.privilegesBase(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 6994; + this.intervalTypeBase(); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 6995; + this.dataTypeBase(); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 6996; + this.keywordsCanBeId(); + } + break; + case 9: + this.enterOuterAlt(localContext, 9); + { + this.state = 6997; + this.scalarFunctionName(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dottedId() { + let localContext = new DottedIdContext(this.context, this.state); + this.enterRule(localContext, 706, MySqlParser.RULE_dottedId); + try { + this.state = 7004; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1010, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7000; + this.match(MySqlParser.DOT); + this.state = 7001; + this.match(MySqlParser.ID); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7002; + this.match(MySqlParser.DOT); + this.state = 7003; + this.uid(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + decimalLiteral() { + let localContext = new DecimalLiteralContext(this.context, this.state); + this.enterRule(localContext, 708, MySqlParser.RULE_decimalLiteral); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7006; + _la = this.tokenStream.LA(1); + if (!(((((_la - 871)) & ~0x1F) === 0 && ((1 << (_la - 871)) & 20495) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + fileSizeLiteral() { + let localContext = new FileSizeLiteralContext(this.context, this.state); + this.enterRule(localContext, 710, MySqlParser.RULE_fileSizeLiteral); + try { + this.state = 7010; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.FILESIZE_LITERAL: + this.enterOuterAlt(localContext, 1); + { + this.state = 7008; + this.match(MySqlParser.FILESIZE_LITERAL); + } + break; + case MySqlParser.ZERO_DECIMAL: + case MySqlParser.ONE_DECIMAL: + case MySqlParser.TWO_DECIMAL: + case MySqlParser.THREE_DECIMAL: + case MySqlParser.DECIMAL_LITERAL: + case MySqlParser.REAL_LITERAL: + this.enterOuterAlt(localContext, 2); + { + this.state = 7009; + this.decimalLiteral(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + stringLiteral() { + let localContext = new StringLiteralContext(this.context, this.state); + this.enterRule(localContext, 712, MySqlParser.RULE_stringLiteral); + let _la; + try { + let alternative; + this.state = 7035; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1018, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7017; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + case MySqlParser.STRING_CHARSET_NAME: + { + this.state = 7013; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 888) { + { + this.state = 7012; + this.match(MySqlParser.STRING_CHARSET_NAME); + } + } + this.state = 7015; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.START_NATIONAL_STRING_LITERAL: + { + this.state = 7016; + this.match(MySqlParser.START_NATIONAL_STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7020; + this.errorHandler.sync(this); + alternative = 1; + do { + switch (alternative) { + case 1: + { + { + this.state = 7019; + this.match(MySqlParser.STRING_LITERAL); + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7022; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1014, this.context); + } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7029; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.STRING_LITERAL: + case MySqlParser.STRING_CHARSET_NAME: + { + this.state = 7025; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 888) { + { + this.state = 7024; + this.match(MySqlParser.STRING_CHARSET_NAME); + } + } + this.state = 7027; + this.match(MySqlParser.STRING_LITERAL); + } + break; + case MySqlParser.START_NATIONAL_STRING_LITERAL: + { + this.state = 7028; + this.match(MySqlParser.START_NATIONAL_STRING_LITERAL); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7033; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1017, this.context)) { + case 1: + { + this.state = 7031; + this.match(MySqlParser.KW_COLLATE); + this.state = 7032; + this.collationName(); + } + break; + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + booleanLiteral() { + let localContext = new BooleanLiteralContext(this.context, this.state); + this.enterRule(localContext, 714, MySqlParser.RULE_booleanLiteral); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7037; + _la = this.tokenStream.LA(1); + if (!(_la === 63 || _la === 179)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + hexadecimalLiteral() { + let localContext = new HexadecimalLiteralContext(this.context, this.state); + this.enterRule(localContext, 716, MySqlParser.RULE_hexadecimalLiteral); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7040; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 888) { + { + this.state = 7039; + this.match(MySqlParser.STRING_CHARSET_NAME); + } + } + this.state = 7042; + this.match(MySqlParser.HEXADECIMAL_LITERAL); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + nullNotnull() { + let localContext = new NullNotnullContext(this.context, this.state); + this.enterRule(localContext, 718, MySqlParser.RULE_nullNotnull); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7045; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7044; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7047; + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 886)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + constant() { + let localContext = new ConstantContext(this.context, this.state); + this.enterRule(localContext, 720, MySqlParser.RULE_constant); + let _la; + try { + this.state = 7061; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1022, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7049; + this.stringLiteral(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7050; + this.decimalLiteral(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7051; + this.match(MySqlParser.MINUS); + this.state = 7052; + this.decimalLiteral(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7053; + this.hexadecimalLiteral(); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 7054; + this.booleanLiteral(); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 7055; + this.match(MySqlParser.REAL_LITERAL); + } + break; + case 7: + this.enterOuterAlt(localContext, 7); + { + this.state = 7056; + this.match(MySqlParser.BIT_STRING); + } + break; + case 8: + this.enterOuterAlt(localContext, 8); + { + this.state = 7058; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7057; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7060; + localContext._nullLiteral = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 116 || _la === 886)) { + localContext._nullLiteral = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dataType() { + let localContext = new DataTypeContext(this.context, this.state); + this.enterRule(localContext, 722, MySqlParser.RULE_dataType); + let _la; + try { + this.state = 7189; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1051, this.context)) { + case 1: + localContext = new StringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7063; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 26 || ((((_la - 224)) & ~0x1F) === 0 && ((1 << (_la - 224)) & 31239) !== 0) || _la === 498)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7065; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 240) { + { + this.state = 7064; + this.match(MySqlParser.KW_VARYING); + } + } + this.state = 7068; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1024, this.context)) { + case 1: + { + this.state = 7067; + this.lengthOneDimension(); + } + break; + } + this.state = 7071; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1025, this.context)) { + case 1: + { + this.state = 7070; + this.match(MySqlParser.KW_BINARY); + } + break; + } + this.state = 7076; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7073; + this.charSet(); + this.state = 7074; + this.charsetName(); + } + } + this.state = 7081; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1027, this.context)) { + case 1: + { + this.state = 7078; + this.match(MySqlParser.KW_COLLATE); + this.state = 7079; + this.collationName(); + } + break; + case 2: + { + this.state = 7080; + this.match(MySqlParser.KW_BINARY); + } + break; + } + } + break; + case 2: + localContext = new NationalVaryingStringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7083; + this.match(MySqlParser.KW_NATIONAL); + this.state = 7084; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 26 || _la === 224)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7085; + this.match(MySqlParser.KW_VARYING); + this.state = 7087; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1028, this.context)) { + case 1: + { + this.state = 7086; + this.lengthOneDimension(); + } + break; + } + this.state = 7090; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7089; + this.match(MySqlParser.KW_BINARY); + } + } + } + break; + case 3: + localContext = new NationalStringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 7092; + this.match(MySqlParser.KW_NATIONAL); + this.state = 7093; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 26 || _la === 224 || _la === 225)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7095; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1030, this.context)) { + case 1: + { + this.state = 7094; + this.lengthOneDimension(); + } + break; + } + this.state = 7098; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7097; + this.match(MySqlParser.KW_BINARY); + } + } + } + break; + case 4: + localContext = new NationalStringDataTypeContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 7100; + this.match(MySqlParser.KW_NCHAR); + this.state = 7101; + localContext._typeName = this.match(MySqlParser.KW_VARCHAR); + this.state = 7103; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1032, this.context)) { + case 1: + { + this.state = 7102; + this.lengthOneDimension(); + } + break; + } + this.state = 7106; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7105; + this.match(MySqlParser.KW_BINARY); + } + } + } + break; + case 5: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 7108; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 198)) & ~0x1F) === 0 && ((1 << (_la - 198)) & 4095) !== 0))) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7110; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1034, this.context)) { + case 1: + { + this.state = 7109; + this.lengthOneDimension(); + } + break; + } + this.state = 7115; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7112; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7117; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 6: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 7118; + localContext._typeName = this.match(MySqlParser.KW_REAL); + this.state = 7120; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1036, this.context)) { + case 1: + { + this.state = 7119; + this.lengthTwoDimension(); + } + break; + } + this.state = 7125; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7122; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7127; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 7: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 7128; + localContext._typeName = this.match(MySqlParser.KW_DOUBLE); + this.state = 7130; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 212) { + { + this.state = 7129; + this.match(MySqlParser.KW_PRECISION); + } + } + this.state = 7133; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1039, this.context)) { + case 1: + { + this.state = 7132; + this.lengthTwoDimension(); + } + break; + } + this.state = 7138; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7135; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7140; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 8: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 7141; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 213)) & ~0x1F) === 0 && ((1 << (_la - 213)) & 63) !== 0) || _la === 403)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7143; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1041, this.context)) { + case 1: + { + this.state = 7142; + this.lengthTwoOptionalDimension(); + } + break; + } + this.state = 7148; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 184 || _la === 197 || _la === 596) { + { + { + this.state = 7145; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 197 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + this.state = 7150; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 9: + localContext = new SimpleDataTypeContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 7151; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 4237313) !== 0) || _la === 321 || _la === 322)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 10: + localContext = new DimensionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 7152; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 220)) & ~0x1F) === 0 && ((1 << (_la - 220)) & 2831) !== 0) || _la === 319)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7154; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1043, this.context)) { + case 1: + { + this.state = 7153; + this.lengthOneDimension(); + } + break; + } + } + break; + case 11: + localContext = new CollectionDataTypeContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 7156; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 155 || _la === 239)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7157; + this.collectionOptions(); + this.state = 7159; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7158; + this.match(MySqlParser.KW_BINARY); + } + } + this.state = 7164; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7161; + this.charSet(); + this.state = 7162; + this.charsetName(); + } + } + } + break; + case 12: + localContext = new SpatialDataTypeContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 7166; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 442 || ((((_la - 813)) & ~0x1F) === 0 && ((1 << (_la - 813)) & 511) !== 0))) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7169; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 834) { + { + this.state = 7167; + this.match(MySqlParser.KW_SRID); + this.state = 7168; + this.decimalLiteral(); + } + } + } + break; + case 13: + localContext = new LongVarcharDataTypeContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 7171; + localContext._typeName = this.match(MySqlParser.KW_LONG); + this.state = 7173; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 225) { + { + this.state = 7172; + this.match(MySqlParser.KW_VARCHAR); + } + } + this.state = 7176; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 228) { + { + this.state = 7175; + this.match(MySqlParser.KW_BINARY); + } + } + this.state = 7181; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7178; + this.charSet(); + this.state = 7179; + this.charsetName(); + } + } + this.state = 7185; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1050, this.context)) { + case 1: + { + this.state = 7183; + this.match(MySqlParser.KW_COLLATE); + this.state = 7184; + this.collationName(); + } + break; + } + } + break; + case 14: + localContext = new LongVarbinaryDataTypeContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 7187; + this.match(MySqlParser.KW_LONG); + this.state = 7188; + this.match(MySqlParser.KW_VARBINARY); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + collectionOptions() { + let localContext = new CollectionOptionsContext(this.context, this.state); + this.enterRule(localContext, 724, MySqlParser.RULE_collectionOptions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7191; + this.match(MySqlParser.LR_BRACKET); + this.state = 7192; + this.match(MySqlParser.STRING_LITERAL); + this.state = 7197; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7193; + this.match(MySqlParser.COMMA); + this.state = 7194; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 7199; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7200; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + convertedDataType() { + let localContext = new ConvertedDataTypeContext(this.context, this.state); + this.enterRule(localContext, 726, MySqlParser.RULE_convertedDataType); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7224; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_BINARY: + case MySqlParser.KW_NCHAR: + { + this.state = 7202; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 228 || _la === 498)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7204; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 7203; + this.lengthOneDimension(); + } + } + } + break; + case MySqlParser.KW_CHAR: + { + this.state = 7206; + localContext._typeName = this.match(MySqlParser.KW_CHAR); + this.state = 7208; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 7207; + this.lengthOneDimension(); + } + } + this.state = 7213; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 26 || _la === 224 || _la === 823) { + { + this.state = 7210; + this.charSet(); + this.state = 7211; + this.charsetName(); + } + } + } + break; + case MySqlParser.KW_INT: + case MySqlParser.KW_INTEGER: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_JSON: + { + this.state = 7215; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 202)) & ~0x1F) === 0 && ((1 << (_la - 202)) & 1441857) !== 0) || _la === 442)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case MySqlParser.KW_DECIMAL: + case MySqlParser.KW_DEC: + { + this.state = 7216; + localContext._typeName = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 216 || _la === 217)) { + localContext._typeName = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7218; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 866) { + { + this.state = 7217; + this.lengthTwoOptionalDimension(); + } + } + } + break; + case MySqlParser.KW_UNSIGNED: + case MySqlParser.KW_SIGNED: + { + this.state = 7220; + _la = this.tokenStream.LA(1); + if (!(_la === 184 || _la === 596)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7222; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 202 || _la === 208) { + { + this.state = 7221; + _la = this.tokenStream.LA(1); + if (!(_la === 202 || _la === 208)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + break; + default: + throw new antlr.NoViableAltException(this); + } + this.state = 7227; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 12) { + { + this.state = 7226; + this.match(MySqlParser.KW_ARRAY); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lengthOneDimension() { + let localContext = new LengthOneDimensionContext(this.context, this.state); + this.enterRule(localContext, 728, MySqlParser.RULE_lengthOneDimension); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7229; + this.match(MySqlParser.LR_BRACKET); + this.state = 7230; + this.decimalLiteral(); + this.state = 7231; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lengthTwoDimension() { + let localContext = new LengthTwoDimensionContext(this.context, this.state); + this.enterRule(localContext, 730, MySqlParser.RULE_lengthTwoDimension); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7233; + this.match(MySqlParser.LR_BRACKET); + this.state = 7234; + this.decimalLiteral(); + this.state = 7235; + this.match(MySqlParser.COMMA); + this.state = 7236; + this.decimalLiteral(); + this.state = 7237; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + lengthTwoOptionalDimension() { + let localContext = new LengthTwoOptionalDimensionContext(this.context, this.state); + this.enterRule(localContext, 732, MySqlParser.RULE_lengthTwoOptionalDimension); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7239; + this.match(MySqlParser.LR_BRACKET); + this.state = 7240; + this.decimalLiteral(); + this.state = 7243; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 7241; + this.match(MySqlParser.COMMA); + this.state = 7242; + this.decimalLiteral(); + } + } + this.state = 7245; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + indexColumnNames() { + let localContext = new IndexColumnNamesContext(this.context, this.state); + this.enterRule(localContext, 734, MySqlParser.RULE_indexColumnNames); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7247; + this.match(MySqlParser.LR_BRACKET); + this.state = 7248; + this.indexColumnName(); + this.state = 7253; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7249; + this.match(MySqlParser.COMMA); + this.state = 7250; + this.indexColumnName(); + } + } + this.state = 7255; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7256; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expressions() { + let localContext = new ExpressionsContext(this.context, this.state); + this.enterRule(localContext, 736, MySqlParser.RULE_expressions); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7258; + this.expression(0); + this.state = 7263; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7259; + this.match(MySqlParser.COMMA); + this.state = 7260; + this.expression(0); + } + } + this.state = 7265; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + valuesOrValueList() { + let localContext = new ValuesOrValueListContext(this.context, this.state); + this.enterRule(localContext, 738, MySqlParser.RULE_valuesOrValueList); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7266; + _la = this.tokenStream.LA(1); + if (!(_la === 189 || _la === 682)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7267; + this.expressionsWithDefaults(); + this.state = 7272; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7268; + this.match(MySqlParser.COMMA); + this.state = 7269; + this.expressionsWithDefaults(); + } + } + this.state = 7274; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expressionsWithDefaults() { + let localContext = new ExpressionsWithDefaultsContext(this.context, this.state); + this.enterRule(localContext, 740, MySqlParser.RULE_expressionsWithDefaults); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7275; + this.match(MySqlParser.LR_BRACKET); + this.state = 7276; + this.expressionOrDefault(); + this.state = 7281; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7277; + this.match(MySqlParser.COMMA); + this.state = 7278; + this.expressionOrDefault(); + } + } + this.state = 7283; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7284; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expressionOrDefault() { + let localContext = new ExpressionOrDefaultContext(this.context, this.state); + this.enterRule(localContext, 742, MySqlParser.RULE_expressionOrDefault); + try { + this.state = 7288; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1065, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7286; + this.expression(0); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7287; + this.match(MySqlParser.KW_DEFAULT); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + constants() { + let localContext = new ConstantsContext(this.context, this.state); + this.enterRule(localContext, 744, MySqlParser.RULE_constants); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7290; + this.constant(); + this.state = 7295; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7291; + this.match(MySqlParser.COMMA); + this.state = 7292; + this.constant(); + } + } + this.state = 7297; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + simpleStrings() { + let localContext = new SimpleStringsContext(this.context, this.state); + this.enterRule(localContext, 746, MySqlParser.RULE_simpleStrings); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7298; + this.match(MySqlParser.STRING_LITERAL); + this.state = 7303; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7299; + this.match(MySqlParser.COMMA); + this.state = 7300; + this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 7305; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + userVariables() { + let localContext = new UserVariablesContext(this.context, this.state); + this.enterRule(localContext, 748, MySqlParser.RULE_userVariables); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7306; + this.match(MySqlParser.LOCAL_ID); + this.state = 7311; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7307; + this.match(MySqlParser.COMMA); + this.state = 7308; + this.match(MySqlParser.LOCAL_ID); + } + } + this.state = 7313; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + defaultValue() { + let localContext = new DefaultValueContext(this.context, this.state); + this.enterRule(localContext, 750, MySqlParser.RULE_defaultValue); + try { + this.state = 7340; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1071, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7314; + this.match(MySqlParser.KW_NULL_LITERAL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7315; + this.match(MySqlParser.KW_CAST); + this.state = 7316; + this.match(MySqlParser.LR_BRACKET); + this.state = 7317; + this.expression(0); + this.state = 7318; + this.match(MySqlParser.KW_AS); + this.state = 7319; + this.convertedDataType(); + this.state = 7320; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7323; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1069, this.context)) { + case 1: + { + this.state = 7322; + this.unaryOperator(); + } + break; + } + this.state = 7325; + this.constant(); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7326; + this.currentTimestamp(); + this.state = 7330; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1070, this.context)) { + case 1: + { + this.state = 7327; + this.match(MySqlParser.KW_ON); + this.state = 7328; + this.match(MySqlParser.KW_UPDATE); + this.state = 7329; + this.currentTimestamp(); + } + break; + } + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 7332; + this.match(MySqlParser.LR_BRACKET); + this.state = 7333; + this.expression(0); + this.state = 7334; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 6: + this.enterOuterAlt(localContext, 6); + { + this.state = 7336; + this.match(MySqlParser.LR_BRACKET); + this.state = 7337; + this.fullId(); + this.state = 7338; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + currentTimestamp() { + let localContext = new CurrentTimestampContext(this.context, this.state); + this.enterRule(localContext, 752, MySqlParser.RULE_currentTimestamp); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7356; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_LOCALTIMESTAMP: + { + this.state = 7342; + _la = this.tokenStream.LA(1); + if (!(((((_la - 287)) & ~0x1F) === 0 && ((1 << (_la - 287)) & 131) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7348; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1073, this.context)) { + case 1: + { + this.state = 7343; + this.match(MySqlParser.LR_BRACKET); + this.state = 7345; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 871)) & ~0x1F) === 0 && ((1 << (_la - 871)) & 20495) !== 0)) { + { + this.state = 7344; + this.decimalLiteral(); + } + } + this.state = 7347; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case MySqlParser.KW_NOW: + { + this.state = 7350; + this.match(MySqlParser.KW_NOW); + this.state = 7351; + this.match(MySqlParser.LR_BRACKET); + this.state = 7353; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (((((_la - 871)) & ~0x1F) === 0 && ((1 << (_la - 871)) & 20495) !== 0)) { + { + this.state = 7352; + this.decimalLiteral(); + } + } + this.state = 7355; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ifExists() { + let localContext = new IfExistsContext(this.context, this.state); + this.enterRule(localContext, 754, MySqlParser.RULE_ifExists); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7358; + this.match(MySqlParser.KW_IF); + this.state = 7359; + this.match(MySqlParser.KW_EXISTS); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + ifNotExists() { + let localContext = new IfNotExistsContext(this.context, this.state); + this.enterRule(localContext, 756, MySqlParser.RULE_ifNotExists); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7361; + this.match(MySqlParser.KW_IF); + this.state = 7362; + this.match(MySqlParser.KW_NOT); + this.state = 7363; + this.match(MySqlParser.KW_EXISTS); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + orReplace() { + let localContext = new OrReplaceContext(this.context, this.state); + this.enterRule(localContext, 758, MySqlParser.RULE_orReplace); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7365; + this.match(MySqlParser.KW_OR); + this.state = 7366; + this.match(MySqlParser.KW_REPLACE); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionCall() { + let localContext = new FunctionCallContext(this.context, this.state); + this.enterRule(localContext, 760, MySqlParser.RULE_functionCall); + try { + this.state = 7390; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1078, this.context)) { + case 1: + localContext = new SpecificFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7368; + this.specificFunction(); + } + break; + case 2: + localContext = new AggregateFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7369; + this.aggregateWindowedFunction(); + } + break; + case 3: + localContext = new NonAggregateFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 7370; + this.nonAggregateWindowedFunction(); + } + break; + case 4: + localContext = new ScalarFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 7371; + this.scalarFunctionName(); + this.state = 7378; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1076, this.context)) { + case 1: + { + this.state = 7372; + this.match(MySqlParser.LR_BRACKET); + this.state = 7373; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 7374; + this.match(MySqlParser.LR_BRACKET); + this.state = 7375; + this.functionArgs(); + this.state = 7376; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 5: + localContext = new UdfFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 7380; + this.functionName(); + this.state = 7387; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1077, this.context)) { + case 1: + { + this.state = 7381; + this.match(MySqlParser.LR_BRACKET); + this.state = 7382; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 7383; + this.match(MySqlParser.LR_BRACKET); + this.state = 7384; + this.functionArgs(); + this.state = 7385; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 6: + localContext = new PasswordFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 7389; + this.passwordFunctionClause(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + specificFunction() { + let localContext = new SpecificFunctionContext(this.context, this.state); + this.enterRule(localContext, 762, MySqlParser.RULE_specificFunction); + let _la; + try { + this.state = 7571; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1102, this.context)) { + case 1: + localContext = new SimpleFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7392; + _la = this.tokenStream.LA(1); + if (!(_la === 152 || ((((_la - 285)) & ~0x1F) === 0 && ((1 << (_la - 285)) & 262159) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7395; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1079, this.context)) { + case 1: + { + this.state = 7393; + this.match(MySqlParser.LR_BRACKET); + this.state = 7394; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + break; + case 2: + localContext = new CurrentUserContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7397; + this.currentUserExpression(); + } + break; + case 3: + localContext = new DataTypeFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 3); + { + this.state = 7398; + this.match(MySqlParser.KW_CONVERT); + this.state = 7399; + this.match(MySqlParser.LR_BRACKET); + this.state = 7400; + this.expression(0); + this.state = 7401; + localContext._separator = this.match(MySqlParser.COMMA); + this.state = 7402; + this.convertedDataType(); + this.state = 7403; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 4: + localContext = new DataTypeFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 4); + { + this.state = 7405; + this.match(MySqlParser.KW_CONVERT); + this.state = 7406; + this.match(MySqlParser.LR_BRACKET); + this.state = 7407; + this.expression(0); + this.state = 7408; + this.match(MySqlParser.KW_USING); + this.state = 7409; + this.charsetName(); + this.state = 7410; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 5: + localContext = new DataTypeFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 5); + { + this.state = 7412; + this.match(MySqlParser.KW_CAST); + this.state = 7413; + this.match(MySqlParser.LR_BRACKET); + this.state = 7414; + this.expression(0); + this.state = 7415; + this.match(MySqlParser.KW_AS); + this.state = 7416; + this.convertedDataType(); + this.state = 7417; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 6: + localContext = new ValuesFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 6); + { + this.state = 7419; + this.match(MySqlParser.KW_VALUES); + this.state = 7420; + this.match(MySqlParser.LR_BRACKET); + this.state = 7421; + this.columnName(); + this.state = 7422; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 7: + localContext = new CaseFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 7); + { + this.state = 7424; + this.match(MySqlParser.KW_CASE); + this.state = 7426; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 7425; + this.caseFuncAlternative(); + } + } + this.state = 7428; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 191); + this.state = 7432; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 7430; + this.match(MySqlParser.KW_ELSE); + this.state = 7431; + localContext._elseArg = this.functionArg(); + } + } + this.state = 7434; + this.match(MySqlParser.KW_END); + } + break; + case 8: + localContext = new CaseExpressionFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 8); + { + this.state = 7436; + this.match(MySqlParser.KW_CASE); + this.state = 7437; + this.expression(0); + this.state = 7439; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 7438; + this.caseFuncAlternative(); + } + } + this.state = 7441; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 191); + this.state = 7445; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 53) { + { + this.state = 7443; + this.match(MySqlParser.KW_ELSE); + this.state = 7444; + localContext._elseArg = this.functionArg(); + } + } + this.state = 7447; + this.match(MySqlParser.KW_END); + } + break; + case 9: + localContext = new CharFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 9); + { + this.state = 7449; + this.match(MySqlParser.KW_CHAR); + this.state = 7450; + this.match(MySqlParser.LR_BRACKET); + this.state = 7451; + this.functionArgs(); + this.state = 7454; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 188) { + { + this.state = 7452; + this.match(MySqlParser.KW_USING); + this.state = 7453; + this.charsetName(); + } + } + this.state = 7456; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 10: + localContext = new PositionFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 10); + { + this.state = 7458; + this.match(MySqlParser.KW_POSITION); + this.state = 7459; + this.match(MySqlParser.LR_BRACKET); + this.state = 7462; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1085, this.context)) { + case 1: + { + this.state = 7460; + localContext._positionString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7461; + localContext._positionExpression = this.expression(0); + } + break; + } + this.state = 7464; + this.match(MySqlParser.KW_IN); + this.state = 7467; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1086, this.context)) { + case 1: + { + this.state = 7465; + localContext._inString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7466; + localContext._inExpression = this.expression(0); + } + break; + } + this.state = 7469; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 11: + localContext = new SubstrFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 11); + { + this.state = 7471; + _la = this.tokenStream.LA(1); + if (!(_la === 297 || _la === 298)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7472; + this.match(MySqlParser.LR_BRACKET); + this.state = 7475; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1087, this.context)) { + case 1: + { + this.state = 7473; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7474; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7477; + this.match(MySqlParser.KW_FROM); + this.state = 7480; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1088, this.context)) { + case 1: + { + this.state = 7478; + localContext._fromDecimal = this.decimalLiteral(); + } + break; + case 2: + { + this.state = 7479; + localContext._fromExpression = this.expression(0); + } + break; + } + this.state = 7487; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 65) { + { + this.state = 7482; + this.match(MySqlParser.KW_FOR); + this.state = 7485; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1089, this.context)) { + case 1: + { + this.state = 7483; + localContext._forDecimal = this.decimalLiteral(); + } + break; + case 2: + { + this.state = 7484; + localContext._forExpression = this.expression(0); + } + break; + } + } + } + this.state = 7489; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 12: + localContext = new TrimFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 12); + { + this.state = 7491; + this.match(MySqlParser.KW_TRIM); + this.state = 7492; + this.match(MySqlParser.LR_BRACKET); + this.state = 7493; + localContext._positioinForm = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 18 || _la === 96 || _la === 177)) { + localContext._positioinForm = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7496; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1091, this.context)) { + case 1: + { + this.state = 7494; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7495; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7498; + this.match(MySqlParser.KW_FROM); + this.state = 7501; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1092, this.context)) { + case 1: + { + this.state = 7499; + localContext._fromString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7500; + localContext._fromExpression = this.expression(0); + } + break; + } + this.state = 7503; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 13: + localContext = new TrimFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 13); + { + this.state = 7505; + this.match(MySqlParser.KW_TRIM); + this.state = 7506; + this.match(MySqlParser.LR_BRACKET); + this.state = 7509; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1093, this.context)) { + case 1: + { + this.state = 7507; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7508; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7511; + this.match(MySqlParser.KW_FROM); + this.state = 7514; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1094, this.context)) { + case 1: + { + this.state = 7512; + localContext._fromString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7513; + localContext._fromExpression = this.expression(0); + } + break; + } + this.state = 7516; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 14: + localContext = new WeightFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 14); + { + this.state = 7518; + this.match(MySqlParser.KW_WEIGHT_STRING); + this.state = 7519; + this.match(MySqlParser.LR_BRACKET); + this.state = 7522; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1095, this.context)) { + case 1: + { + this.state = 7520; + this.stringLiteral(); + } + break; + case 2: + { + this.state = 7521; + this.expression(0); + } + break; + } + this.state = 7530; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 13) { + { + this.state = 7524; + this.match(MySqlParser.KW_AS); + this.state = 7525; + localContext._stringFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 224 || _la === 228)) { + localContext._stringFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7526; + this.match(MySqlParser.LR_BRACKET); + this.state = 7527; + this.decimalLiteral(); + this.state = 7528; + this.match(MySqlParser.RR_BRACKET); + } + } + this.state = 7533; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 448) { + { + this.state = 7532; + this.levelsInWeightString(); + } + } + this.state = 7535; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 15: + localContext = new ExtractFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 15); + { + this.state = 7537; + this.match(MySqlParser.KW_EXTRACT); + this.state = 7538; + this.match(MySqlParser.LR_BRACKET); + this.state = 7539; + this.intervalType(); + this.state = 7540; + this.match(MySqlParser.KW_FROM); + this.state = 7543; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1098, this.context)) { + case 1: + { + this.state = 7541; + localContext._sourceString = this.stringLiteral(); + } + break; + case 2: + { + this.state = 7542; + localContext._sourceExpression = this.expression(0); + } + break; + } + this.state = 7545; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 16: + localContext = new GetFormatFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 16); + { + this.state = 7547; + this.match(MySqlParser.KW_GET_FORMAT); + this.state = 7548; + this.match(MySqlParser.LR_BRACKET); + this.state = 7549; + localContext._datetimeFormat = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 11) !== 0))) { + localContext._datetimeFormat = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7550; + this.match(MySqlParser.COMMA); + this.state = 7551; + this.stringLiteral(); + this.state = 7552; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 17: + localContext = new JsonValueFunctionCallContext(localContext); + this.enterOuterAlt(localContext, 17); + { + this.state = 7554; + this.match(MySqlParser.KW_JSON_VALUE); + this.state = 7555; + this.match(MySqlParser.LR_BRACKET); + this.state = 7556; + this.expression(0); + this.state = 7557; + this.match(MySqlParser.COMMA); + this.state = 7558; + this.expression(0); + this.state = 7561; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 579) { + { + this.state = 7559; + this.match(MySqlParser.KW_RETURNING); + this.state = 7560; + this.convertedDataType(); + } + } + this.state = 7564; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1100, this.context)) { + case 1: + { + this.state = 7563; + this.jsonOnEmpty(); + } + break; + } + this.state = 7567; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 42 || _la === 116 || _la === 382) { + { + this.state = 7566; + this.jsonOnError(); + } + } + this.state = 7569; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + caseFuncAlternative() { + let localContext = new CaseFuncAlternativeContext(this.context, this.state); + this.enterRule(localContext, 764, MySqlParser.RULE_caseFuncAlternative); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7573; + this.match(MySqlParser.KW_WHEN); + this.state = 7574; + localContext._condition = this.functionArg(); + this.state = 7575; + this.match(MySqlParser.KW_THEN); + this.state = 7576; + localContext._consequent = this.functionArg(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + levelsInWeightString() { + let localContext = new LevelsInWeightStringContext(this.context, this.state); + this.enterRule(localContext, 766, MySqlParser.RULE_levelsInWeightString); + let _la; + try { + this.state = 7592; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1104, this.context)) { + case 1: + localContext = new LevelWeightListContext(localContext); + this.enterOuterAlt(localContext, 1); + { + this.state = 7578; + this.match(MySqlParser.KW_LEVEL); + this.state = 7579; + this.levelInWeightListElement(); + this.state = 7584; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7580; + this.match(MySqlParser.COMMA); + this.state = 7581; + this.levelInWeightListElement(); + } + } + this.state = 7586; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + break; + case 2: + localContext = new LevelWeightRangeContext(localContext); + this.enterOuterAlt(localContext, 2); + { + this.state = 7587; + this.match(MySqlParser.KW_LEVEL); + this.state = 7588; + localContext._firstLevel = this.decimalLiteral(); + this.state = 7589; + this.match(MySqlParser.MINUS); + this.state = 7590; + localContext._lastLevel = this.decimalLiteral(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + levelInWeightListElement() { + let localContext = new LevelInWeightListElementContext(this.context, this.state); + this.enterRule(localContext, 768, MySqlParser.RULE_levelInWeightListElement); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7594; + this.decimalLiteral(); + this.state = 7596; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 14 || _la === 45 || _la === 830) { + { + this.state = 7595; + localContext._orderType = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 14 || _la === 45 || _la === 830)) { + localContext._orderType = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + aggregateWindowedFunction() { + let localContext = new AggregateWindowedFunctionContext(this.context, this.state); + this.enterRule(localContext, 770, MySqlParser.RULE_aggregateWindowedFunction); + let _la; + try { + this.state = 7657; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AVG: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_SUM: + this.enterOuterAlt(localContext, 1); + { + this.state = 7598; + _la = this.tokenStream.LA(1); + if (!(((((_la - 258)) & ~0x1F) === 0 && ((1 << (_la - 258)) & 8400897) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7599; + this.match(MySqlParser.LR_BRACKET); + this.state = 7601; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1106, this.context)) { + case 1: + { + this.state = 7600; + localContext._aggregator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 49)) { + localContext._aggregator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + this.state = 7603; + this.functionArg(); + this.state = 7604; + this.match(MySqlParser.RR_BRACKET); + this.state = 7606; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1107, this.context)) { + case 1: + { + this.state = 7605; + this.overClause(); + } + break; + } + } + break; + case MySqlParser.KW_COUNT: + this.enterOuterAlt(localContext, 2); + { + this.state = 7608; + this.match(MySqlParser.KW_COUNT); + this.state = 7609; + this.match(MySqlParser.LR_BRACKET); + this.state = 7617; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1109, this.context)) { + case 1: + { + this.state = 7610; + localContext._starArg = this.match(MySqlParser.STAR); + } + break; + case 2: + { + this.state = 7612; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1108, this.context)) { + case 1: + { + this.state = 7611; + localContext._aggregator = this.match(MySqlParser.KW_ALL); + } + break; + } + this.state = 7614; + this.functionArg(); + } + break; + case 3: + { + this.state = 7615; + localContext._aggregator = this.match(MySqlParser.KW_DISTINCT); + this.state = 7616; + this.functionArgs(); + } + break; + } + this.state = 7619; + this.match(MySqlParser.RR_BRACKET); + this.state = 7621; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1110, this.context)) { + case 1: + { + this.state = 7620; + this.overClause(); + } + break; + } + } + break; + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + this.enterOuterAlt(localContext, 3); + { + this.state = 7623; + _la = this.tokenStream.LA(1); + if (!(((((_la - 259)) & ~0x1F) === 0 && ((1 << (_la - 259)) & 62652423) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7624; + this.match(MySqlParser.LR_BRACKET); + this.state = 7626; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1111, this.context)) { + case 1: + { + this.state = 7625; + localContext._aggregator = this.match(MySqlParser.KW_ALL); + } + break; + } + this.state = 7628; + this.functionArg(); + this.state = 7629; + this.match(MySqlParser.RR_BRACKET); + this.state = 7631; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1112, this.context)) { + case 1: + { + this.state = 7630; + this.overClause(); + } + break; + } + } + break; + case MySqlParser.KW_GROUP_CONCAT: + this.enterOuterAlt(localContext, 4); + { + this.state = 7633; + this.match(MySqlParser.KW_GROUP_CONCAT); + this.state = 7634; + this.match(MySqlParser.LR_BRACKET); + this.state = 7636; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1113, this.context)) { + case 1: + { + this.state = 7635; + localContext._aggregator = this.match(MySqlParser.KW_DISTINCT); + } + break; + } + this.state = 7638; + this.functionArgs(); + this.state = 7649; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 7639; + this.match(MySqlParser.KW_ORDER); + this.state = 7640; + this.match(MySqlParser.KW_BY); + this.state = 7641; + this.orderByExpression(); + this.state = 7646; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7642; + this.match(MySqlParser.COMMA); + this.state = 7643; + this.orderByExpression(); + } + } + this.state = 7648; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + this.state = 7653; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 156) { + { + this.state = 7651; + this.match(MySqlParser.KW_SEPARATOR); + this.state = 7652; + localContext._separator = this.match(MySqlParser.STRING_LITERAL); + } + } + this.state = 7655; + this.match(MySqlParser.RR_BRACKET); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + nonAggregateWindowedFunction() { + let localContext = new NonAggregateWindowedFunctionContext(this.context, this.state); + this.enterRule(localContext, 772, MySqlParser.RULE_nonAggregateWindowedFunction); + let _la; + try { + this.state = 7697; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_LAG: + case MySqlParser.KW_LEAD: + this.enterOuterAlt(localContext, 1); + { + this.state = 7659; + _la = this.tokenStream.LA(1); + if (!(_la === 267 || _la === 269)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7660; + this.match(MySqlParser.LR_BRACKET); + this.state = 7661; + this.expression(0); + this.state = 7664; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1118, this.context)) { + case 1: + { + this.state = 7662; + this.match(MySqlParser.COMMA); + this.state = 7663; + this.decimalLiteral(); + } + break; + } + this.state = 7668; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 868) { + { + this.state = 7666; + this.match(MySqlParser.COMMA); + this.state = 7667; + this.decimalLiteral(); + } + } + this.state = 7670; + this.match(MySqlParser.RR_BRACKET); + this.state = 7671; + this.overClause(); + } + break; + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_LAST_VALUE: + this.enterOuterAlt(localContext, 2); + { + this.state = 7673; + _la = this.tokenStream.LA(1); + if (!(_la === 265 || _la === 268)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7674; + this.match(MySqlParser.LR_BRACKET); + this.state = 7675; + this.expression(0); + this.state = 7676; + this.match(MySqlParser.RR_BRACKET); + this.state = 7677; + this.overClause(); + } + break; + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + this.enterOuterAlt(localContext, 3); + { + this.state = 7679; + _la = this.tokenStream.LA(1); + if (!(((((_la - 263)) & ~0x1F) === 0 && ((1 << (_la - 263)) & 14339) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7680; + this.match(MySqlParser.LR_BRACKET); + this.state = 7681; + this.match(MySqlParser.RR_BRACKET); + this.state = 7682; + this.overClause(); + } + break; + case MySqlParser.KW_NTH_VALUE: + this.enterOuterAlt(localContext, 4); + { + this.state = 7683; + this.match(MySqlParser.KW_NTH_VALUE); + this.state = 7684; + this.match(MySqlParser.LR_BRACKET); + this.state = 7685; + this.expression(0); + this.state = 7686; + this.match(MySqlParser.COMMA); + this.state = 7687; + this.decimalLiteral(); + this.state = 7688; + this.match(MySqlParser.RR_BRACKET); + this.state = 7689; + this.overClause(); + } + break; + case MySqlParser.KW_NTILE: + this.enterOuterAlt(localContext, 5); + { + this.state = 7691; + this.match(MySqlParser.KW_NTILE); + this.state = 7692; + this.match(MySqlParser.LR_BRACKET); + this.state = 7693; + this.decimalLiteral(); + this.state = 7694; + this.match(MySqlParser.RR_BRACKET); + this.state = 7695; + this.overClause(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + overClause() { + let localContext = new OverClauseContext(this.context, this.state); + this.enterRule(localContext, 774, MySqlParser.RULE_overClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7699; + this.match(MySqlParser.KW_OVER); + this.state = 7705; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LR_BRACKET: + { + this.state = 7700; + this.match(MySqlParser.LR_BRACKET); + this.state = 7701; + this.windowSpec(); + this.state = 7702; + this.match(MySqlParser.RR_BRACKET); + } + break; + case MySqlParser.KW_ARRAY: + case MySqlParser.KW_ATTRIBUTE: + case MySqlParser.KW_BUCKETS: + case MySqlParser.KW_CONDITION: + case MySqlParser.KW_CURRENT: + case MySqlParser.KW_CURRENT_USER: + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_DEFAULT: + case MySqlParser.KW_DIAGNOSTICS: + case MySqlParser.KW_EMPTY: + case MySqlParser.KW_ENFORCED: + case MySqlParser.KW_EXCEPT: + case MySqlParser.KW_GROUP: + case MySqlParser.KW_IF: + case MySqlParser.KW_INSERT: + case MySqlParser.KW_LATERAL: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_NUMBER: + case MySqlParser.KW_OPTIONAL: + case MySqlParser.KW_ORDER: + case MySqlParser.KW_PRIMARY: + case MySqlParser.KW_REPEAT: + case MySqlParser.KW_REPLACE: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_SKIP_QUERY_REWRITE: + case MySqlParser.KW_STACKED: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_DATETIME: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_BINARY: + case MySqlParser.KW_TEXT: + case MySqlParser.KW_ENUM: + case MySqlParser.KW_SERIAL: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_NESTED: + case MySqlParser.KW_ORDINALITY: + case MySqlParser.KW_PATH: + case MySqlParser.KW_AVG: + case MySqlParser.KW_BIT_AND: + case MySqlParser.KW_BIT_OR: + case MySqlParser.KW_BIT_XOR: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_GROUP_CONCAT: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_MAX: + case MySqlParser.KW_MIN: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_STD: + case MySqlParser.KW_STDDEV: + case MySqlParser.KW_STDDEV_POP: + case MySqlParser.KW_STDDEV_SAMP: + case MySqlParser.KW_SUM: + case MySqlParser.KW_VAR_POP: + case MySqlParser.KW_VAR_SAMP: + case MySqlParser.KW_VARIANCE: + case MySqlParser.KW_CURRENT_DATE: + case MySqlParser.KW_CURRENT_TIME: + case MySqlParser.KW_CURRENT_TIMESTAMP: + case MySqlParser.KW_LOCALTIME: + case MySqlParser.KW_CURDATE: + case MySqlParser.KW_CURTIME: + case MySqlParser.KW_DATE_ADD: + case MySqlParser.KW_DATE_SUB: + case MySqlParser.KW_LOCALTIMESTAMP: + case MySqlParser.KW_NOW: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_SUBSTR: + case MySqlParser.KW_SUBSTRING: + case MySqlParser.KW_SYSDATE: + case MySqlParser.KW_TRIM: + case MySqlParser.KW_UTC_DATE: + case MySqlParser.KW_UTC_TIME: + case MySqlParser.KW_UTC_TIMESTAMP: + case MySqlParser.KW_ACCOUNT: + case MySqlParser.KW_ACTION: + case MySqlParser.KW_AFTER: + case MySqlParser.KW_AGGREGATE: + case MySqlParser.KW_ALGORITHM: + case MySqlParser.KW_ANY: + case MySqlParser.KW_AT: + case MySqlParser.KW_AUTHORS: + case MySqlParser.KW_AUTOCOMMIT: + case MySqlParser.KW_AUTOEXTEND_SIZE: + case MySqlParser.KW_AUTO_INCREMENT: + case MySqlParser.KW_AVG_ROW_LENGTH: + case MySqlParser.KW_BEGIN: + case MySqlParser.KW_BINLOG: + case MySqlParser.KW_BIT: + case MySqlParser.KW_BLOCK: + case MySqlParser.KW_BOOL: + case MySqlParser.KW_BOOLEAN: + case MySqlParser.KW_BTREE: + case MySqlParser.KW_CACHE: + case MySqlParser.KW_CASCADED: + case MySqlParser.KW_CHAIN: + case MySqlParser.KW_CHANGED: + case MySqlParser.KW_CHANNEL: + case MySqlParser.KW_CHECKSUM: + case MySqlParser.KW_CIPHER: + case MySqlParser.KW_CLASS_ORIGIN: + case MySqlParser.KW_CLIENT: + case MySqlParser.KW_CLOSE: + case MySqlParser.KW_COALESCE: + case MySqlParser.KW_CODE: + case MySqlParser.KW_COLUMNS: + case MySqlParser.KW_COLUMN_FORMAT: + case MySqlParser.KW_COLUMN_NAME: + case MySqlParser.KW_COMMENT: + case MySqlParser.KW_COMMIT: + case MySqlParser.KW_COMPACT: + case MySqlParser.KW_COMPLETION: + case MySqlParser.KW_COMPRESSED: + case MySqlParser.KW_COMPRESSION: + case MySqlParser.KW_CONCURRENT: + case MySqlParser.KW_CONNECT: + case MySqlParser.KW_CONNECTION: + case MySqlParser.KW_CONSISTENT: + case MySqlParser.KW_CONSTRAINT_CATALOG: + case MySqlParser.KW_CONSTRAINT_SCHEMA: + case MySqlParser.KW_CONSTRAINT_NAME: + case MySqlParser.KW_CONTAINS: + case MySqlParser.KW_CONTEXT: + case MySqlParser.KW_CONTRIBUTORS: + case MySqlParser.KW_COPY: + case MySqlParser.KW_CPU: + case MySqlParser.KW_CURSOR_NAME: + case MySqlParser.KW_DATA: + case MySqlParser.KW_DATAFILE: + case MySqlParser.KW_DEALLOCATE: + case MySqlParser.KW_DEFAULT_AUTH: + case MySqlParser.KW_DEFINER: + case MySqlParser.KW_DELAY_KEY_WRITE: + case MySqlParser.KW_DES_KEY_FILE: + case MySqlParser.KW_DIRECTORY: + case MySqlParser.KW_DISABLE: + case MySqlParser.KW_DISCARD: + case MySqlParser.KW_DISK: + case MySqlParser.KW_DO: + case MySqlParser.KW_DUMPFILE: + case MySqlParser.KW_DUPLICATE: + case MySqlParser.KW_DYNAMIC: + case MySqlParser.KW_ENABLE: + case MySqlParser.KW_ENCRYPTION: + case MySqlParser.KW_END: + case MySqlParser.KW_ENDS: + case MySqlParser.KW_ENGINE: + case MySqlParser.KW_ENGINES: + case MySqlParser.KW_ERROR: + case MySqlParser.KW_ERRORS: + case MySqlParser.KW_ESCAPE: + case MySqlParser.KW_EVENT: + case MySqlParser.KW_EVENTS: + case MySqlParser.KW_EVERY: + case MySqlParser.KW_EXCHANGE: + case MySqlParser.KW_EXCLUSIVE: + case MySqlParser.KW_EXPIRE: + case MySqlParser.KW_EXPORT: + case MySqlParser.KW_EXTENDED: + case MySqlParser.KW_EXTENT_SIZE: + case MySqlParser.KW_FAILED_LOGIN_ATTEMPTS: + case MySqlParser.KW_FAST: + case MySqlParser.KW_FAULTS: + case MySqlParser.KW_FIELDS: + case MySqlParser.KW_FILE_BLOCK_SIZE: + case MySqlParser.KW_FILTER: + case MySqlParser.KW_FIRST: + case MySqlParser.KW_FIXED: + case MySqlParser.KW_FLUSH: + case MySqlParser.KW_FOLLOWS: + case MySqlParser.KW_FOUND: + case MySqlParser.KW_FULL: + case MySqlParser.KW_FUNCTION: + case MySqlParser.KW_GENERAL: + case MySqlParser.KW_GLOBAL: + case MySqlParser.KW_GRANTS: + case MySqlParser.KW_GROUP_REPLICATION: + case MySqlParser.KW_HANDLER: + case MySqlParser.KW_HASH: + case MySqlParser.KW_HELP: + case MySqlParser.KW_HISTORY: + case MySqlParser.KW_HOST: + case MySqlParser.KW_HOSTS: + case MySqlParser.KW_IDENTIFIED: + case MySqlParser.KW_IGNORE_SERVER_IDS: + case MySqlParser.KW_IMPORT: + case MySqlParser.KW_INDEXES: + case MySqlParser.KW_INITIAL_SIZE: + case MySqlParser.KW_INPLACE: + case MySqlParser.KW_INSERT_METHOD: + case MySqlParser.KW_INSTALL: + case MySqlParser.KW_INSTANCE: + case MySqlParser.KW_INSTANT: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_INVOKER: + case MySqlParser.KW_IO: + case MySqlParser.KW_IO_THREAD: + case MySqlParser.KW_IPC: + case MySqlParser.KW_ISOLATION: + case MySqlParser.KW_ISSUER: + case MySqlParser.KW_JSON: + case MySqlParser.KW_KEY_BLOCK_SIZE: + case MySqlParser.KW_LANGUAGE: + case MySqlParser.KW_LAST: + case MySqlParser.KW_LEAVES: + case MySqlParser.KW_LESS: + case MySqlParser.KW_LEVEL: + case MySqlParser.KW_LIST: + case MySqlParser.KW_LOCAL: + case MySqlParser.KW_LOGFILE: + case MySqlParser.KW_LOGS: + case MySqlParser.KW_MASTER: + case MySqlParser.KW_MASTER_AUTO_POSITION: + case MySqlParser.KW_MASTER_CONNECT_RETRY: + case MySqlParser.KW_MASTER_DELAY: + case MySqlParser.KW_MASTER_HEARTBEAT_PERIOD: + case MySqlParser.KW_MASTER_HOST: + case MySqlParser.KW_MASTER_LOG_FILE: + case MySqlParser.KW_MASTER_LOG_POS: + case MySqlParser.KW_MASTER_PASSWORD: + case MySqlParser.KW_MASTER_PORT: + case MySqlParser.KW_MASTER_RETRY_COUNT: + case MySqlParser.KW_MASTER_SSL: + case MySqlParser.KW_MASTER_SSL_CA: + case MySqlParser.KW_MASTER_SSL_CAPATH: + case MySqlParser.KW_MASTER_SSL_CERT: + case MySqlParser.KW_MASTER_SSL_CIPHER: + case MySqlParser.KW_MASTER_SSL_CRL: + case MySqlParser.KW_MASTER_SSL_CRLPATH: + case MySqlParser.KW_MASTER_SSL_KEY: + case MySqlParser.KW_MASTER_TLS_VERSION: + case MySqlParser.KW_MASTER_USER: + case MySqlParser.KW_MAX_CONNECTIONS_PER_HOUR: + case MySqlParser.KW_MAX_QUERIES_PER_HOUR: + case MySqlParser.KW_MAX_ROWS: + case MySqlParser.KW_MAX_SIZE: + case MySqlParser.KW_MAX_UPDATES_PER_HOUR: + case MySqlParser.KW_MAX_USER_CONNECTIONS: + case MySqlParser.KW_MEDIUM: + case MySqlParser.KW_MEMBER: + case MySqlParser.KW_MERGE: + case MySqlParser.KW_MESSAGE_TEXT: + case MySqlParser.KW_MID: + case MySqlParser.KW_MIGRATE: + case MySqlParser.KW_MIN_ROWS: + case MySqlParser.KW_MODE: + case MySqlParser.KW_MODIFY: + case MySqlParser.KW_MUTEX: + case MySqlParser.KW_MYSQL: + case MySqlParser.KW_MYSQL_ERRNO: + case MySqlParser.KW_NAME: + case MySqlParser.KW_NAMES: + case MySqlParser.KW_NCHAR: + case MySqlParser.KW_NEVER: + case MySqlParser.KW_NEXT: + case MySqlParser.KW_NO: + case MySqlParser.KW_NOWAIT: + case MySqlParser.KW_NODEGROUP: + case MySqlParser.KW_NONE: + case MySqlParser.KW_ODBC: + case MySqlParser.KW_OFFLINE: + case MySqlParser.KW_OFFSET: + case MySqlParser.KW_OF: + case MySqlParser.KW_OLD_PASSWORD: + case MySqlParser.KW_ONE: + case MySqlParser.KW_ONLINE: + case MySqlParser.KW_ONLY: + case MySqlParser.KW_OPEN: + case MySqlParser.KW_OPTIMIZER_COSTS: + case MySqlParser.KW_OPTIONS: + case MySqlParser.KW_OWNER: + case MySqlParser.KW_PACK_KEYS: + case MySqlParser.KW_PAGE: + case MySqlParser.KW_PAGE_CHECKSUM: + case MySqlParser.KW_PARSER: + case MySqlParser.KW_PARTIAL: + case MySqlParser.KW_PARTITIONING: + case MySqlParser.KW_PARTITIONS: + case MySqlParser.KW_PASSWORD: + case MySqlParser.KW_PASSWORD_LOCK_TIME: + case MySqlParser.KW_PHASE: + case MySqlParser.KW_PLUGIN: + case MySqlParser.KW_PLUGIN_DIR: + case MySqlParser.KW_PLUGINS: + case MySqlParser.KW_PORT: + case MySqlParser.KW_PRECEDES: + case MySqlParser.KW_PREPARE: + case MySqlParser.KW_PRESERVE: + case MySqlParser.KW_PREV: + case MySqlParser.KW_PROCESSLIST: + case MySqlParser.KW_PROFILE: + case MySqlParser.KW_PROFILES: + case MySqlParser.KW_PROXY: + case MySqlParser.KW_QUERY: + case MySqlParser.KW_QUICK: + case MySqlParser.KW_REBUILD: + case MySqlParser.KW_RECOVER: + case MySqlParser.KW_RECURSIVE: + case MySqlParser.KW_REDO_BUFFER_SIZE: + case MySqlParser.KW_REDUNDANT: + case MySqlParser.KW_RELAY: + case MySqlParser.KW_RELAY_LOG_FILE: + case MySqlParser.KW_RELAY_LOG_POS: + case MySqlParser.KW_RELAYLOG: + case MySqlParser.KW_REMOVE: + case MySqlParser.KW_REORGANIZE: + case MySqlParser.KW_REPAIR: + case MySqlParser.KW_REPLICATE_DO_DB: + case MySqlParser.KW_REPLICATE_DO_TABLE: + case MySqlParser.KW_REPLICATE_IGNORE_DB: + case MySqlParser.KW_REPLICATE_IGNORE_TABLE: + case MySqlParser.KW_REPLICATE_REWRITE_DB: + case MySqlParser.KW_REPLICATE_WILD_DO_TABLE: + case MySqlParser.KW_REPLICATE_WILD_IGNORE_TABLE: + case MySqlParser.KW_REPLICATION: + case MySqlParser.KW_RESET: + case MySqlParser.KW_RESUME: + case MySqlParser.KW_RETURNED_SQLSTATE: + case MySqlParser.KW_RETURNS: + case MySqlParser.KW_REUSE: + case MySqlParser.KW_ROLE: + case MySqlParser.KW_ROLLBACK: + case MySqlParser.KW_ROLLUP: + case MySqlParser.KW_ROTATE: + case MySqlParser.KW_ROW: + case MySqlParser.KW_ROWS: + case MySqlParser.KW_ROW_FORMAT: + case MySqlParser.KW_SAVEPOINT: + case MySqlParser.KW_SCHEDULE: + case MySqlParser.KW_SECURITY: + case MySqlParser.KW_SERVER: + case MySqlParser.KW_SESSION: + case MySqlParser.KW_SHARE: + case MySqlParser.KW_SHARED: + case MySqlParser.KW_SIGNED: + case MySqlParser.KW_SIMPLE: + case MySqlParser.KW_SLAVE: + case MySqlParser.KW_SLOW: + case MySqlParser.KW_SNAPSHOT: + case MySqlParser.KW_SOCKET: + case MySqlParser.KW_SOME: + case MySqlParser.KW_SONAME: + case MySqlParser.KW_SOUNDS: + case MySqlParser.KW_SOURCE: + case MySqlParser.KW_SQL_AFTER_GTIDS: + case MySqlParser.KW_SQL_AFTER_MTS_GAPS: + case MySqlParser.KW_SQL_BEFORE_GTIDS: + case MySqlParser.KW_SQL_BUFFER_RESULT: + case MySqlParser.KW_SQL_CACHE: + case MySqlParser.KW_SQL_NO_CACHE: + case MySqlParser.KW_SQL_THREAD: + case MySqlParser.KW_START: + case MySqlParser.KW_STARTS: + case MySqlParser.KW_STATS_AUTO_RECALC: + case MySqlParser.KW_STATS_PERSISTENT: + case MySqlParser.KW_STATS_SAMPLE_PAGES: + case MySqlParser.KW_STATUS: + case MySqlParser.KW_STOP: + case MySqlParser.KW_STORAGE: + case MySqlParser.KW_STRING: + case MySqlParser.KW_SUBCLASS_ORIGIN: + case MySqlParser.KW_SUBJECT: + case MySqlParser.KW_SUBPARTITION: + case MySqlParser.KW_SUBPARTITIONS: + case MySqlParser.KW_SUSPEND: + case MySqlParser.KW_SWAPS: + case MySqlParser.KW_SWITCHES: + case MySqlParser.KW_TABLE_NAME: + case MySqlParser.KW_TABLESPACE: + case MySqlParser.KW_TABLE_TYPE: + case MySqlParser.KW_TEMPORARY: + case MySqlParser.KW_TEMPTABLE: + case MySqlParser.KW_THAN: + case MySqlParser.KW_TRADITIONAL: + case MySqlParser.KW_TRANSACTION: + case MySqlParser.KW_TRANSACTIONAL: + case MySqlParser.KW_TRIGGERS: + case MySqlParser.KW_TRUNCATE: + case MySqlParser.KW_UNBOUNDED: + case MySqlParser.KW_UNDEFINED: + case MySqlParser.KW_UNDOFILE: + case MySqlParser.KW_UNDO_BUFFER_SIZE: + case MySqlParser.KW_UNINSTALL: + case MySqlParser.KW_UNKNOWN: + case MySqlParser.KW_UNTIL: + case MySqlParser.KW_UPGRADE: + case MySqlParser.KW_USER: + case MySqlParser.KW_USE_FRM: + case MySqlParser.KW_USER_RESOURCES: + case MySqlParser.KW_VALIDATION: + case MySqlParser.KW_VALUE: + case MySqlParser.KW_VARIABLES: + case MySqlParser.KW_VIEW: + case MySqlParser.KW_VIRTUAL: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_WAIT: + case MySqlParser.KW_WARNINGS: + case MySqlParser.KW_WITHOUT: + case MySqlParser.KW_WORK: + case MySqlParser.KW_WRAPPER: + case MySqlParser.KW_X509: + case MySqlParser.KW_XA: + case MySqlParser.KW_XML: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_ADMIN: + case MySqlParser.KW_AUDIT_ABORT_EXEMPT: + case MySqlParser.KW_AUDIT_ADMIN: + case MySqlParser.KW_AUTHENTICATION_POLICY_ADMIN: + case MySqlParser.KW_BACKUP_ADMIN: + case MySqlParser.KW_BINLOG_ADMIN: + case MySqlParser.KW_BINLOG_ENCRYPTION_ADMIN: + case MySqlParser.KW_CLONE_ADMIN: + case MySqlParser.KW_CONNECTION_ADMIN: + case MySqlParser.KW_ENCRYPTION_KEY_ADMIN: + case MySqlParser.KW_EXECUTE: + case MySqlParser.KW_FILE: + case MySqlParser.KW_FIREWALL_ADMIN: + case MySqlParser.KW_FIREWALL_EXEMPT: + case MySqlParser.KW_FIREWALL_USER: + case MySqlParser.KW_GROUP_REPLICATION_ADMIN: + case MySqlParser.KW_INNODB_REDO_LOG_ARCHIVE: + case MySqlParser.KW_INVOKE: + case MySqlParser.KW_LAMBDA: + case MySqlParser.KW_NDB_STORED_USER: + case MySqlParser.KW_PASSWORDLESS_USER_ADMIN: + case MySqlParser.KW_PERSIST_RO_VARIABLES_ADMIN: + case MySqlParser.KW_PRIVILEGES: + case MySqlParser.KW_PROCESS: + case MySqlParser.KW_RELOAD: + case MySqlParser.KW_REPLICATION_APPLIER: + case MySqlParser.KW_REPLICATION_SLAVE_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_ADMIN: + case MySqlParser.KW_RESOURCE_GROUP_USER: + case MySqlParser.KW_ROLE_ADMIN: + case MySqlParser.KW_ROUTINE: + case MySqlParser.KW_S3: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_SET_USER_ID: + case MySqlParser.KW_SHOW_ROUTINE: + case MySqlParser.KW_SHUTDOWN: + case MySqlParser.KW_SUPER: + case MySqlParser.KW_SYSTEM_VARIABLES_ADMIN: + case MySqlParser.KW_TABLES: + case MySqlParser.KW_TABLE_ENCRYPTION_ADMIN: + case MySqlParser.KW_VERSION_TOKEN_ADMIN: + case MySqlParser.KW_XA_RECOVER_ADMIN: + case MySqlParser.KW_ARMSCII8: + case MySqlParser.KW_ASCII: + case MySqlParser.KW_BIG5: + case MySqlParser.KW_CP1250: + case MySqlParser.KW_CP1251: + case MySqlParser.KW_CP1256: + case MySqlParser.KW_CP1257: + case MySqlParser.KW_CP850: + case MySqlParser.KW_CP852: + case MySqlParser.KW_CP866: + case MySqlParser.KW_CP932: + case MySqlParser.KW_DEC8: + case MySqlParser.KW_EUCJPMS: + case MySqlParser.KW_EUCKR: + case MySqlParser.KW_GB18030: + case MySqlParser.KW_GB2312: + case MySqlParser.KW_GBK: + case MySqlParser.KW_GEOSTD8: + case MySqlParser.KW_GREEK: + case MySqlParser.KW_HEBREW: + case MySqlParser.KW_HP8: + case MySqlParser.KW_KEYBCS2: + case MySqlParser.KW_KOI8R: + case MySqlParser.KW_KOI8U: + case MySqlParser.KW_LATIN1: + case MySqlParser.KW_LATIN2: + case MySqlParser.KW_LATIN5: + case MySqlParser.KW_LATIN7: + case MySqlParser.KW_MACCE: + case MySqlParser.KW_MACROMAN: + case MySqlParser.KW_SJIS: + case MySqlParser.KW_SWE7: + case MySqlParser.KW_TIS620: + case MySqlParser.KW_UCS2: + case MySqlParser.KW_UJIS: + case MySqlParser.KW_UTF16: + case MySqlParser.KW_UTF16LE: + case MySqlParser.KW_UTF32: + case MySqlParser.KW_UTF8: + case MySqlParser.KW_UTF8MB3: + case MySqlParser.KW_UTF8MB4: + case MySqlParser.KW_ARCHIVE: + case MySqlParser.KW_BLACKHOLE: + case MySqlParser.KW_CSV: + case MySqlParser.KW_FEDERATED: + case MySqlParser.KW_INNODB: + case MySqlParser.KW_MEMORY: + case MySqlParser.KW_MRG_MYISAM: + case MySqlParser.KW_MYISAM: + case MySqlParser.KW_NDB: + case MySqlParser.KW_NDBCLUSTER: + case MySqlParser.KW_PERFORMANCE_SCHEMA: + case MySqlParser.KW_TOKUDB: + case MySqlParser.KW_REPEATABLE: + case MySqlParser.KW_COMMITTED: + case MySqlParser.KW_UNCOMMITTED: + case MySqlParser.KW_SERIALIZABLE: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CATALOG_NAME: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_ENGINE_ATTRIBUTE: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SCHEMA_NAME: + case MySqlParser.KW_SECONDARY_ENGINE_ATTRIBUTE: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_TP_CONNECTION_ADMIN: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + case MySqlParser.CHARSET_REVERSE_QOUTE_STRING: + case MySqlParser.STRING_LITERAL: + case MySqlParser.ID: + { + this.state = 7704; + this.windowName(); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + windowSpec() { + let localContext = new WindowSpecContext(this.context, this.state); + this.enterRule(localContext, 776, MySqlParser.RULE_windowSpec); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7708; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1122, this.context)) { + case 1: + { + this.state = 7707; + this.windowName(); + } + break; + } + this.state = 7711; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 130) { + { + this.state = 7710; + this.partitionClause(); + } + } + this.state = 7714; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 125) { + { + this.state = 7713; + this.orderByClause(); + } + } + this.state = 7717; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 134 || _la === 587) { + { + this.state = 7716; + this.frameClause(); + } + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + windowName() { + let localContext = new WindowNameContext(this.context, this.state); + this.enterRule(localContext, 778, MySqlParser.RULE_windowName); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7719; + this.uid(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameClause() { + let localContext = new FrameClauseContext(this.context, this.state); + this.enterRule(localContext, 780, MySqlParser.RULE_frameClause); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7721; + this.frameUnits(); + this.state = 7722; + this.frameExtent(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameUnits() { + let localContext = new FrameUnitsContext(this.context, this.state); + this.enterRule(localContext, 782, MySqlParser.RULE_frameUnits); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7724; + _la = this.tokenStream.LA(1); + if (!(_la === 134 || _la === 587)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameExtent() { + let localContext = new FrameExtentContext(this.context, this.state); + this.enterRule(localContext, 784, MySqlParser.RULE_frameExtent); + try { + this.state = 7728; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1126, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7726; + this.frameRange(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7727; + this.frameBetween(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameBetween() { + let localContext = new FrameBetweenContext(this.context, this.state); + this.enterRule(localContext, 786, MySqlParser.RULE_frameBetween); + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7730; + this.match(MySqlParser.KW_BETWEEN); + this.state = 7731; + this.frameRange(); + this.state = 7732; + this.match(MySqlParser.KW_AND); + this.state = 7733; + this.frameRange(); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + frameRange() { + let localContext = new FrameRangeContext(this.context, this.state); + this.enterRule(localContext, 788, MySqlParser.RULE_frameRange); + let _la; + try { + this.state = 7742; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1127, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7735; + this.match(MySqlParser.KW_CURRENT); + this.state = 7736; + this.match(MySqlParser.KW_ROW); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7737; + this.match(MySqlParser.KW_UNBOUNDED); + this.state = 7738; + _la = this.tokenStream.LA(1); + if (!(_la === 405 || _la === 539)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7739; + this.expression(0); + this.state = 7740; + _la = this.tokenStream.LA(1); + if (!(_la === 405 || _la === 539)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + partitionClause() { + let localContext = new PartitionClauseContext(this.context, this.state); + this.enterRule(localContext, 790, MySqlParser.RULE_partitionClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7744; + this.match(MySqlParser.KW_PARTITION); + this.state = 7745; + this.match(MySqlParser.KW_BY); + this.state = 7746; + this.expression(0); + this.state = 7751; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7747; + this.match(MySqlParser.COMMA); + this.state = 7748; + this.expression(0); + } + } + this.state = 7753; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + scalarFunctionName() { + let localContext = new ScalarFunctionNameContext(this.context, this.state); + this.enterRule(localContext, 792, MySqlParser.RULE_scalarFunctionName); + try { + this.state = 7778; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_DATABASE: + case MySqlParser.KW_LEFT: + case MySqlParser.KW_RIGHT: + case MySqlParser.KW_SCHEMA: + case MySqlParser.KW_DATE: + case MySqlParser.KW_TIME: + case MySqlParser.KW_TIMESTAMP: + case MySqlParser.KW_YEAR: + case MySqlParser.KW_JSON_TABLE: + case MySqlParser.KW_JSON_VALUE: + case MySqlParser.KW_COUNT: + case MySqlParser.KW_CUME_DIST: + case MySqlParser.KW_DENSE_RANK: + case MySqlParser.KW_FIRST_VALUE: + case MySqlParser.KW_LAG: + case MySqlParser.KW_LAST_VALUE: + case MySqlParser.KW_LEAD: + case MySqlParser.KW_NTILE: + case MySqlParser.KW_NTH_VALUE: + case MySqlParser.KW_PERCENT_RANK: + case MySqlParser.KW_RANK: + case MySqlParser.KW_ROW_NUMBER: + case MySqlParser.KW_POSITION: + case MySqlParser.KW_INVISIBLE: + case MySqlParser.KW_VISIBLE: + case MySqlParser.KW_QUARTER: + case MySqlParser.KW_MONTH: + case MySqlParser.KW_DAY: + case MySqlParser.KW_HOUR: + case MySqlParser.KW_MINUTE: + case MySqlParser.KW_WEEK: + case MySqlParser.KW_SECOND: + case MySqlParser.KW_MICROSECOND: + case MySqlParser.KW_SESSION_VARIABLES_ADMIN: + case MySqlParser.KW_GEOMETRYCOLLECTION: + case MySqlParser.KW_LINESTRING: + case MySqlParser.KW_MULTILINESTRING: + case MySqlParser.KW_MULTIPOINT: + case MySqlParser.KW_MULTIPOLYGON: + case MySqlParser.KW_POINT: + case MySqlParser.KW_POLYGON: + case MySqlParser.KW_CHARSET: + case MySqlParser.KW_COLLATION: + case MySqlParser.KW_FORMAT: + case MySqlParser.KW_GET_FORMAT: + case MySqlParser.KW_RANDOM: + case MySqlParser.KW_REVERSE: + case MySqlParser.KW_ROW_COUNT: + case MySqlParser.KW_SRID: + case MySqlParser.KW_SYSTEM_USER: + case MySqlParser.KW_WEIGHT_STRING: + case MySqlParser.MOD: + this.enterOuterAlt(localContext, 1); + { + this.state = 7754; + this.functionNameBase(); + } + break; + case MySqlParser.KW_ASCII: + this.enterOuterAlt(localContext, 2); + { + this.state = 7755; + this.match(MySqlParser.KW_ASCII); + } + break; + case MySqlParser.KW_CURDATE: + this.enterOuterAlt(localContext, 3); + { + this.state = 7756; + this.match(MySqlParser.KW_CURDATE); + } + break; + case MySqlParser.KW_CURRENT_DATE: + this.enterOuterAlt(localContext, 4); + { + this.state = 7757; + this.match(MySqlParser.KW_CURRENT_DATE); + } + break; + case MySqlParser.KW_CURRENT_TIME: + this.enterOuterAlt(localContext, 5); + { + this.state = 7758; + this.match(MySqlParser.KW_CURRENT_TIME); + } + break; + case MySqlParser.KW_CURRENT_TIMESTAMP: + this.enterOuterAlt(localContext, 6); + { + this.state = 7759; + this.match(MySqlParser.KW_CURRENT_TIMESTAMP); + } + break; + case MySqlParser.KW_CURTIME: + this.enterOuterAlt(localContext, 7); + { + this.state = 7760; + this.match(MySqlParser.KW_CURTIME); + } + break; + case MySqlParser.KW_DATE_ADD: + this.enterOuterAlt(localContext, 8); + { + this.state = 7761; + this.match(MySqlParser.KW_DATE_ADD); + } + break; + case MySqlParser.KW_DATE_SUB: + this.enterOuterAlt(localContext, 9); + { + this.state = 7762; + this.match(MySqlParser.KW_DATE_SUB); + } + break; + case MySqlParser.KW_IF: + this.enterOuterAlt(localContext, 10); + { + this.state = 7763; + this.match(MySqlParser.KW_IF); + } + break; + case MySqlParser.KW_INSERT: + this.enterOuterAlt(localContext, 11); + { + this.state = 7764; + this.match(MySqlParser.KW_INSERT); + } + break; + case MySqlParser.KW_LOCALTIME: + this.enterOuterAlt(localContext, 12); + { + this.state = 7765; + this.match(MySqlParser.KW_LOCALTIME); + } + break; + case MySqlParser.KW_LOCALTIMESTAMP: + this.enterOuterAlt(localContext, 13); + { + this.state = 7766; + this.match(MySqlParser.KW_LOCALTIMESTAMP); + } + break; + case MySqlParser.KW_MID: + this.enterOuterAlt(localContext, 14); + { + this.state = 7767; + this.match(MySqlParser.KW_MID); + } + break; + case MySqlParser.KW_NOW: + this.enterOuterAlt(localContext, 15); + { + this.state = 7768; + this.match(MySqlParser.KW_NOW); + } + break; + case MySqlParser.KW_REPEAT: + this.enterOuterAlt(localContext, 16); + { + this.state = 7769; + this.match(MySqlParser.KW_REPEAT); + } + break; + case MySqlParser.KW_REPLACE: + this.enterOuterAlt(localContext, 17); + { + this.state = 7770; + this.match(MySqlParser.KW_REPLACE); + } + break; + case MySqlParser.KW_SUBSTR: + this.enterOuterAlt(localContext, 18); + { + this.state = 7771; + this.match(MySqlParser.KW_SUBSTR); + } + break; + case MySqlParser.KW_SUBSTRING: + this.enterOuterAlt(localContext, 19); + { + this.state = 7772; + this.match(MySqlParser.KW_SUBSTRING); + } + break; + case MySqlParser.KW_SYSDATE: + this.enterOuterAlt(localContext, 20); + { + this.state = 7773; + this.match(MySqlParser.KW_SYSDATE); + } + break; + case MySqlParser.KW_TRIM: + this.enterOuterAlt(localContext, 21); + { + this.state = 7774; + this.match(MySqlParser.KW_TRIM); + } + break; + case MySqlParser.KW_UTC_DATE: + this.enterOuterAlt(localContext, 22); + { + this.state = 7775; + this.match(MySqlParser.KW_UTC_DATE); + } + break; + case MySqlParser.KW_UTC_TIME: + this.enterOuterAlt(localContext, 23); + { + this.state = 7776; + this.match(MySqlParser.KW_UTC_TIME); + } + break; + case MySqlParser.KW_UTC_TIMESTAMP: + this.enterOuterAlt(localContext, 24); + { + this.state = 7777; + this.match(MySqlParser.KW_UTC_TIMESTAMP); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + passwordFunctionClause() { + let localContext = new PasswordFunctionClauseContext(this.context, this.state); + this.enterRule(localContext, 794, MySqlParser.RULE_passwordFunctionClause); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7780; + _la = this.tokenStream.LA(1); + if (!(_la === 512 || _la === 529)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7781; + this.match(MySqlParser.LR_BRACKET); + this.state = 7782; + this.functionArg(); + this.state = 7783; + this.match(MySqlParser.RR_BRACKET); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionArgs() { + let localContext = new FunctionArgsContext(this.context, this.state); + this.enterRule(localContext, 796, MySqlParser.RULE_functionArgs); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7785; + this.functionArg(); + this.state = 7790; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7786; + this.match(MySqlParser.COMMA); + this.state = 7787; + this.functionArg(); + } + } + this.state = 7792; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionArg() { + let localContext = new FunctionArgContext(this.context, this.state); + this.enterRule(localContext, 798, MySqlParser.RULE_functionArg); + try { + this.state = 7796; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1131, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7793; + this.constant(); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7794; + this.functionCall(); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7795; + this.expression(0); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + expression(_p) { + let parentContext = this.context; + let parentState = this.state; + let localContext = new ExpressionContext(this.context, parentState); + let previousContext = localContext; + let _startState = 800; + this.enterRecursionRule(localContext, 800, MySqlParser.RULE_expression, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 7809; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1133, this.context)) { + case 1: + { + localContext = new NotExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7799; + localContext._notOperator = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 114 || _la === 860)) { + localContext._notOperator = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7800; + this.expression(4); + } + break; + case 2: + { + localContext = new IsExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7801; + this.predicate(0); + this.state = 7802; + this.match(MySqlParser.KW_IS); + this.state = 7804; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7803; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7806; + localContext._testValue = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 63 || _la === 179 || _la === 674)) { + localContext._testValue = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + break; + case 3: + { + localContext = new PredicateExpressionContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7808; + this.predicate(0); + } + break; + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 7817; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1134, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + { + localContext = new LogicalExpressionContext(new ExpressionContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expression); + this.state = 7811; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 7812; + this.logicalOperator(); + this.state = 7813; + this.expression(4); + } + } + } + this.state = 7819; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1134, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + predicate(_p) { + let parentContext = this.context; + let parentState = this.state; + let localContext = new PredicateContext(this.context, parentState); + let previousContext = localContext; + let _startState = 802; + this.enterRecursionRule(localContext, 802, MySqlParser.RULE_predicate, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + { + localContext = new ExpressionAtomPredicateContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7821; + this.expressionAtom(0); + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 7886; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1143, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 7884; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1142, this.context)) { + case 1: + { + localContext = new BetweenPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7823; + if (!(this.precpred(this.context, 6))) { + throw this.createFailedPredicateException("this.precpred(this.context, 6)"); + } + this.state = 7825; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7824; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7827; + this.match(MySqlParser.KW_BETWEEN); + this.state = 7828; + this.predicate(0); + this.state = 7829; + this.match(MySqlParser.KW_AND); + this.state = 7830; + this.predicate(7); + } + break; + case 2: + { + localContext = new SoundsLikePredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7832; + if (!(this.precpred(this.context, 5))) { + throw this.createFailedPredicateException("this.precpred(this.context, 5)"); + } + this.state = 7833; + this.match(MySqlParser.KW_SOUNDS); + this.state = 7834; + this.match(MySqlParser.KW_LIKE); + this.state = 7835; + this.predicate(6); + } + break; + case 3: + { + localContext = new RegexpPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7836; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 7838; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7837; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7840; + localContext._regex = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 139 || _la === 151)) { + localContext._regex = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7841; + this.predicate(4); + } + break; + case 4: + { + localContext = new InPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7842; + if (!(this.precpred(this.context, 9))) { + throw this.createFailedPredicateException("this.precpred(this.context, 9)"); + } + this.state = 7844; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7843; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7846; + this.match(MySqlParser.KW_IN); + this.state = 7847; + this.match(MySqlParser.LR_BRACKET); + this.state = 7850; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1138, this.context)) { + case 1: + { + this.state = 7848; + this.selectStatement(); + } + break; + case 2: + { + this.state = 7849; + this.expressions(); + } + break; + } + this.state = 7852; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 5: + { + localContext = new IsNullPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7854; + if (!(this.precpred(this.context, 8))) { + throw this.createFailedPredicateException("this.precpred(this.context, 8)"); + } + this.state = 7855; + this.match(MySqlParser.KW_IS); + this.state = 7856; + this.nullNotnull(); + } + break; + case 6: + { + localContext = new BinaryComparisonPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7857; + if (!(this.precpred(this.context, 7))) { + throw this.createFailedPredicateException("this.precpred(this.context, 7)"); + } + this.state = 7858; + this.comparisonOperator(); + this.state = 7865; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1139, this.context)) { + case 1: + { + this.state = 7859; + localContext._quantifier = this.tokenStream.LT(1); + _la = this.tokenStream.LA(1); + if (!(_la === 7 || _la === 309 || _la === 602)) { + localContext._quantifier = this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + this.state = 7860; + this.match(MySqlParser.LR_BRACKET); + this.state = 7861; + localContext._subQuery = this.selectStatement(); + this.state = 7862; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 2: + { + this.state = 7864; + localContext._right = this.predicate(0); + } + break; + } + } + break; + case 7: + { + localContext = new LikePredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7867; + if (!(this.precpred(this.context, 4))) { + throw this.createFailedPredicateException("this.precpred(this.context, 4)"); + } + this.state = 7869; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + if (_la === 114) { + { + this.state = 7868; + this.match(MySqlParser.KW_NOT); + } + } + this.state = 7871; + this.match(MySqlParser.KW_LIKE); + this.state = 7872; + this.predicate(0); + this.state = 7875; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1141, this.context)) { + case 1: + { + this.state = 7873; + this.match(MySqlParser.KW_ESCAPE); + this.state = 7874; + this.match(MySqlParser.STRING_LITERAL); + } + break; + } + } + break; + case 8: + { + localContext = new JsonMemberOfPredicateContext(new PredicateContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_predicate); + this.state = 7877; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 7878; + this.match(MySqlParser.KW_MEMBER); + this.state = 7879; + this.match(MySqlParser.KW_OF); + this.state = 7880; + this.match(MySqlParser.LR_BRACKET); + this.state = 7881; + this.predicate(0); + this.state = 7882; + this.match(MySqlParser.RR_BRACKET); + } + break; + } + } + } + this.state = 7888; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1143, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + expressionAtom(_p) { + let parentContext = this.context; + let parentState = this.state; + let localContext = new ExpressionAtomContext(this.context, parentState); + let previousContext = localContext; + let _startState = 804; + this.enterRecursionRule(localContext, 804, MySqlParser.RULE_expressionAtom, _p); + let _la; + try { + let alternative; + this.enterOuterAlt(localContext, 1); + { + this.state = 7937; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1146, this.context)) { + case 1: + { + localContext = new ConstantExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7890; + this.constant(); + } + break; + case 2: + { + localContext = new FunctionCallExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7891; + this.functionCall(); + } + break; + case 3: + { + localContext = new MysqlVariableExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7892; + this.mysqlVariable(); + } + break; + case 4: + { + localContext = new UnaryExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7893; + this.unaryOperator(); + this.state = 7894; + this.expressionAtom(12); + } + break; + case 5: + { + localContext = new BinaryExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7896; + this.match(MySqlParser.KW_BINARY); + this.state = 7897; + this.expressionAtom(11); + } + break; + case 6: + { + localContext = new VariableAssignExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7898; + this.match(MySqlParser.LOCAL_ID); + this.state = 7899; + this.match(MySqlParser.VAR_ASSIGN); + this.state = 7900; + this.expressionAtom(10); + } + break; + case 7: + { + localContext = new NestedExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7901; + this.match(MySqlParser.LR_BRACKET); + this.state = 7902; + this.expression(0); + this.state = 7907; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + while (_la === 868) { + { + { + this.state = 7903; + this.match(MySqlParser.COMMA); + this.state = 7904; + this.expression(0); + } + } + this.state = 7909; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } + this.state = 7910; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 8: + { + localContext = new NestedRowExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7912; + this.match(MySqlParser.KW_ROW); + this.state = 7913; + this.match(MySqlParser.LR_BRACKET); + this.state = 7914; + this.expression(0); + this.state = 7917; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + do { + { + { + this.state = 7915; + this.match(MySqlParser.COMMA); + this.state = 7916; + this.expression(0); + } + } + this.state = 7919; + this.errorHandler.sync(this); + _la = this.tokenStream.LA(1); + } while (_la === 868); + this.state = 7921; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 9: + { + localContext = new ExistsExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7923; + this.match(MySqlParser.KW_EXISTS); + this.state = 7924; + this.match(MySqlParser.LR_BRACKET); + this.state = 7925; + this.selectStatement(); + this.state = 7926; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 10: + { + localContext = new SubqueryExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7928; + this.match(MySqlParser.LR_BRACKET); + this.state = 7929; + this.selectStatement(); + this.state = 7930; + this.match(MySqlParser.RR_BRACKET); + } + break; + case 11: + { + localContext = new IntervalExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7932; + this.match(MySqlParser.KW_INTERVAL); + this.state = 7933; + this.expression(0); + this.state = 7934; + this.intervalType(); + } + break; + case 12: + { + localContext = new ColumnNameExpressionAtomContext(localContext); + this.context = localContext; + previousContext = localContext; + this.state = 7936; + this.columnName(); + } + break; + } + this.context.stop = this.tokenStream.LT(-1); + this.state = 7956; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1148, this.context); + while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER) { + if (alternative === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + previousContext = localContext; + { + this.state = 7954; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1147, this.context)) { + case 1: + { + localContext = new JsonExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + localContext._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7939; + if (!(this.precpred(this.context, 4))) { + throw this.createFailedPredicateException("this.precpred(this.context, 4)"); + } + this.state = 7940; + this.jsonOperator(); + this.state = 7941; + localContext._right = this.expressionAtom(5); + } + break; + case 2: + { + localContext = new BitExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + localContext._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7943; + if (!(this.precpred(this.context, 3))) { + throw this.createFailedPredicateException("this.precpred(this.context, 3)"); + } + this.state = 7944; + this.bitOperator(); + this.state = 7945; + localContext._right = this.expressionAtom(4); + } + break; + case 3: + { + localContext = new MathExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + localContext._left = previousContext; + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7947; + if (!(this.precpred(this.context, 2))) { + throw this.createFailedPredicateException("this.precpred(this.context, 2)"); + } + this.state = 7948; + this.mathOperator(); + this.state = 7949; + localContext._right = this.expressionAtom(3); + } + break; + case 4: + { + localContext = new CollateExpressionAtomContext(new ExpressionAtomContext(parentContext, parentState)); + this.pushNewRecursionContext(localContext, _startState, MySqlParser.RULE_expressionAtom); + this.state = 7951; + if (!(this.precpred(this.context, 14))) { + throw this.createFailedPredicateException("this.precpred(this.context, 14)"); + } + this.state = 7952; + this.match(MySqlParser.KW_COLLATE); + this.state = 7953; + this.collationName(); + } + break; + } + } + } + this.state = 7958; + this.errorHandler.sync(this); + alternative = this.interpreter.adaptivePredict(this.tokenStream, 1148, this.context); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.unrollRecursionContexts(parentContext); + } + return localContext; + } + unaryOperator() { + let localContext = new UnaryOperatorContext(this.context, this.state); + this.enterRule(localContext, 806, MySqlParser.RULE_unaryOperator); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7959; + _la = this.tokenStream.LA(1); + if (!(_la === 114 || ((((_la - 853)) & ~0x1F) === 0 && ((1 << (_la - 853)) & 387) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + comparisonOperator() { + let localContext = new ComparisonOperatorContext(this.context, this.state); + this.enterRule(localContext, 808, MySqlParser.RULE_comparisonOperator); + try { + this.state = 7969; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1149, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7961; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7962; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7963; + this.match(MySqlParser.EXCLAMATION_SYMBOL); + this.state = 7964; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7965; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7966; + this.match(MySqlParser.EQUAL_SYMBOL); + this.state = 7967; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7968; + this.comparisonBase(); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + comparisonBase() { + let localContext = new ComparisonBaseContext(this.context, this.state); + this.enterRule(localContext, 810, MySqlParser.RULE_comparisonBase); + try { + this.state = 7978; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1150, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 7971; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7972; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 7973; + this.match(MySqlParser.GREATER_SYMBOL); + this.state = 7974; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 3: + this.enterOuterAlt(localContext, 3); + { + this.state = 7975; + this.match(MySqlParser.EQUAL_SYMBOL); + } + break; + case 4: + this.enterOuterAlt(localContext, 4); + { + this.state = 7976; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 5: + this.enterOuterAlt(localContext, 5); + { + this.state = 7977; + this.match(MySqlParser.LESS_SYMBOL); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + logicalOperator() { + let localContext = new LogicalOperatorContext(this.context, this.state); + this.enterRule(localContext, 812, MySqlParser.RULE_logicalOperator); + try { + this.state = 7987; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.KW_AND: + this.enterOuterAlt(localContext, 1); + { + this.state = 7980; + this.match(MySqlParser.KW_AND); + } + break; + case MySqlParser.BIT_AND_OP: + this.enterOuterAlt(localContext, 2); + { + this.state = 7981; + this.match(MySqlParser.BIT_AND_OP); + this.state = 7982; + this.match(MySqlParser.BIT_AND_OP); + } + break; + case MySqlParser.KW_XOR: + this.enterOuterAlt(localContext, 3); + { + this.state = 7983; + this.match(MySqlParser.KW_XOR); + } + break; + case MySqlParser.KW_OR: + this.enterOuterAlt(localContext, 4); + { + this.state = 7984; + this.match(MySqlParser.KW_OR); + } + break; + case MySqlParser.BIT_OR_OP: + this.enterOuterAlt(localContext, 5); + { + this.state = 7985; + this.match(MySqlParser.BIT_OR_OP); + this.state = 7986; + this.match(MySqlParser.BIT_OR_OP); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + bitOperator() { + let localContext = new BitOperatorContext(this.context, this.state); + this.enterRule(localContext, 814, MySqlParser.RULE_bitOperator); + try { + this.state = 7996; + this.errorHandler.sync(this); + switch (this.tokenStream.LA(1)) { + case MySqlParser.LESS_SYMBOL: + this.enterOuterAlt(localContext, 1); + { + this.state = 7989; + this.match(MySqlParser.LESS_SYMBOL); + this.state = 7990; + this.match(MySqlParser.LESS_SYMBOL); + } + break; + case MySqlParser.GREATER_SYMBOL: + this.enterOuterAlt(localContext, 2); + { + this.state = 7991; + this.match(MySqlParser.GREATER_SYMBOL); + this.state = 7992; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case MySqlParser.BIT_AND_OP: + this.enterOuterAlt(localContext, 3); + { + this.state = 7993; + this.match(MySqlParser.BIT_AND_OP); + } + break; + case MySqlParser.BIT_XOR_OP: + this.enterOuterAlt(localContext, 4); + { + this.state = 7994; + this.match(MySqlParser.BIT_XOR_OP); + } + break; + case MySqlParser.BIT_OR_OP: + this.enterOuterAlt(localContext, 5); + { + this.state = 7995; + this.match(MySqlParser.BIT_OR_OP); + } + break; + default: + throw new antlr.NoViableAltException(this); + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + mathOperator() { + let localContext = new MathOperatorContext(this.context, this.state); + this.enterRule(localContext, 816, MySqlParser.RULE_mathOperator); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 7998; + _la = this.tokenStream.LA(1); + if (!(((((_la - 850)) & ~0x1F) === 0 && ((1 << (_la - 850)) & 127) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + jsonOperator() { + let localContext = new JsonOperatorContext(this.context, this.state); + this.enterRule(localContext, 818, MySqlParser.RULE_jsonOperator); + try { + this.state = 8005; + this.errorHandler.sync(this); + switch (this.interpreter.adaptivePredict(this.tokenStream, 1153, this.context)) { + case 1: + this.enterOuterAlt(localContext, 1); + { + this.state = 8000; + this.match(MySqlParser.MINUS); + this.state = 8001; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + case 2: + this.enterOuterAlt(localContext, 2); + { + this.state = 8002; + this.match(MySqlParser.MINUS); + this.state = 8003; + this.match(MySqlParser.GREATER_SYMBOL); + this.state = 8004; + this.match(MySqlParser.GREATER_SYMBOL); + } + break; + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + charsetNameBase() { + let localContext = new CharsetNameBaseContext(this.context, this.state); + this.enterRule(localContext, 820, MySqlParser.RULE_charsetNameBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8007; + _la = this.tokenStream.LA(1); + if (!(_la === 228 || ((((_la - 756)) & ~0x1F) === 0 && ((1 << (_la - 756)) & 4294967295) !== 0) || ((((_la - 788)) & ~0x1F) === 0 && ((1 << (_la - 788)) & 511) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + transactionLevelBase() { + let localContext = new TransactionLevelBaseContext(this.context, this.state); + this.enterRule(localContext, 822, MySqlParser.RULE_transactionLevelBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8009; + _la = this.tokenStream.LA(1); + if (!(((((_la - 809)) & ~0x1F) === 0 && ((1 << (_la - 809)) & 15) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + privilegesBase() { + let localContext = new PrivilegesBaseContext(this.context, this.state); + this.enterRule(localContext, 824, MySqlParser.RULE_privilegesBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8011; + _la = this.tokenStream.LA(1); + if (!(((((_la - 717)) & ~0x1F) === 0 && ((1 << (_la - 717)) & 68026371) !== 0) || ((((_la - 749)) & ~0x1F) === 0 && ((1 << (_la - 749)) & 11) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + intervalTypeBase() { + let localContext = new IntervalTypeBaseContext(this.context, this.state); + this.enterRule(localContext, 826, MySqlParser.RULE_intervalTypeBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8013; + _la = this.tokenStream.LA(1); + if (!(((((_la - 696)) & ~0x1F) === 0 && ((1 << (_la - 696)) & 255) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + dataTypeBase() { + let localContext = new DataTypeBaseContext(this.context, this.state); + this.enterRule(localContext, 828, MySqlParser.RULE_dataTypeBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8015; + _la = this.tokenStream.LA(1); + if (!(((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 1179679) !== 0))) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + keywordsCanBeId() { + let localContext = new KeywordsCanBeIdContext(this.context, this.state); + this.enterRule(localContext, 830, MySqlParser.RULE_keywordsCanBeId); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8017; + _la = this.tokenStream.LA(1); + if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & 1074302976) !== 0) || ((((_la - 36)) & ~0x1F) === 0 && ((1 << (_la - 36)) & 11014211) !== 0) || _la === 74 || _la === 95 || ((((_la - 117)) & ~0x1F) === 0 && ((1 << (_la - 117)) & 16673) !== 0) || _la === 160 || _la === 170 || ((((_la - 241)) & ~0x1F) === 0 && ((1 << (_la - 241)) & 1648345089) !== 0) || ((((_la - 277)) & ~0x1F) === 0 && ((1 << (_la - 277)) & 4160749823) !== 0) || ((((_la - 309)) & ~0x1F) === 0 && ((1 << (_la - 309)) & 4292870141) !== 0) || ((((_la - 341)) & ~0x1F) === 0 && ((1 << (_la - 341)) & 4294967287) !== 0) || ((((_la - 373)) & ~0x1F) === 0 && ((1 << (_la - 373)) & 4024434671) !== 0) || ((((_la - 406)) & ~0x1F) === 0 && ((1 << (_la - 406)) & 3747609503) !== 0) || ((((_la - 438)) & ~0x1F) === 0 && ((1 << (_la - 438)) & 4227727359) !== 0) || ((((_la - 470)) & ~0x1F) === 0 && ((1 << (_la - 470)) & 3758096239) !== 0) || ((((_la - 502)) & ~0x1F) === 0 && ((1 << (_la - 502)) & 2678062559) !== 0) || ((((_la - 534)) & ~0x1F) === 0 && ((1 << (_la - 534)) & 2682256863) !== 0) || ((((_la - 566)) & ~0x1F) === 0 && ((1 << (_la - 566)) & 4294957695) !== 0) || ((((_la - 598)) & ~0x1F) === 0 && ((1 << (_la - 598)) & 255) !== 0) || ((((_la - 633)) & ~0x1F) === 0 && ((1 << (_la - 633)) & 4294934527) !== 0) || ((((_la - 665)) & ~0x1F) === 0 && ((1 << (_la - 665)) & 2128608253) !== 0) || ((((_la - 704)) & ~0x1F) === 0 && ((1 << (_la - 704)) & 1053007341) !== 0) || ((((_la - 737)) & ~0x1F) === 0 && ((1 << (_la - 737)) & 478907) !== 0) || ((((_la - 802)) & ~0x1F) === 0 && ((1 << (_la - 802)) & 3230662657) !== 0) || _la === 838)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + functionNameBase() { + let localContext = new FunctionNameBaseContext(this.context, this.state); + this.enterRule(localContext, 832, MySqlParser.RULE_functionNameBase); + let _la; + try { + this.enterOuterAlt(localContext, 1); + { + this.state = 8019; + _la = this.tokenStream.LA(1); + if (!(_la === 39 || _la === 98 || _la === 150 || _la === 152 || ((((_la - 219)) & ~0x1F) === 0 && ((1 << (_la - 219)) & 23) !== 0) || ((((_la - 253)) & ~0x1F) === 0 && ((1 << (_la - 253)) & 16375299) !== 0) || _la === 296 || _la === 435 || ((((_la - 686)) & ~0x1F) === 0 && ((1 << (_la - 686)) & 261121) !== 0) || _la === 746 || ((((_la - 813)) & ~0x1F) === 0 && ((1 << (_la - 813)) & 145190393) !== 0) || _la === 856)) { + this.errorHandler.recoverInline(this); + } + else { + this.errorHandler.reportMatch(this); + this.consume(); + } + } + } + catch (re) { + if (re instanceof antlr.RecognitionException) { + localContext.exception = re; + this.errorHandler.reportError(this, re); + this.errorHandler.recover(this, re); + } + else { + throw re; + } + } + finally { + this.exitRule(); + } + return localContext; + } + sempred(localContext, ruleIndex, predIndex) { + switch (ruleIndex) { + case 104: + return this.queryExpressionBody_sempred(localContext, predIndex); + case 105: + return this.queryItem_sempred(localContext, predIndex); + case 329: + return this.columnName_sempred(localContext, predIndex); + case 400: + return this.expression_sempred(localContext, predIndex); + case 401: + return this.predicate_sempred(localContext, predIndex); + case 402: + return this.expressionAtom_sempred(localContext, predIndex); + } + return true; + } + queryExpressionBody_sempred(localContext, predIndex) { + switch (predIndex) { + case 0: + return this.precpred(this.context, 2); + case 1: + return this.precpred(this.context, 1); + } + return true; + } + queryItem_sempred(localContext, predIndex) { + switch (predIndex) { + case 2: + return this.precpred(this.context, 1); + } + return true; + } + columnName_sempred(localContext, predIndex) { + switch (predIndex) { + case 3: + return this.shouldMatchEmpty(); + } + return true; + } + expression_sempred(localContext, predIndex) { + switch (predIndex) { + case 4: + return this.precpred(this.context, 3); + } + return true; + } + predicate_sempred(localContext, predIndex) { + switch (predIndex) { + case 5: + return this.precpred(this.context, 6); + case 6: + return this.precpred(this.context, 5); + case 7: + return this.precpred(this.context, 3); + case 8: + return this.precpred(this.context, 9); + case 9: + return this.precpred(this.context, 8); + case 10: + return this.precpred(this.context, 7); + case 11: + return this.precpred(this.context, 4); + case 12: + return this.precpred(this.context, 2); + } + return true; + } + expressionAtom_sempred(localContext, predIndex) { + switch (predIndex) { + case 13: + return this.precpred(this.context, 4); + case 14: + return this.precpred(this.context, 3); + case 15: + return this.precpred(this.context, 2); + case 16: + return this.precpred(this.context, 14); + } + return true; + } + static get _ATN() { + if (!MySqlParser.__ATN) { + MySqlParser.__ATN = new antlr.ATNDeserializer().deserialize(MySqlParser._serializedATN); + } + return MySqlParser.__ATN; + } + get vocabulary() { + return MySqlParser.vocabulary; + } +} + +export { MySqlParser }; diff --git a/test/form/samples/object-tree-shaking-issue-5734/main.js b/test/form/samples/object-tree-shaking-issue-5734/main.js new file mode 100644 index 00000000000..314988654fc --- /dev/null +++ b/test/form/samples/object-tree-shaking-issue-5734/main.js @@ -0,0 +1 @@ +export { MySqlParser } from './module.js'; diff --git a/test/function/samples/object-tree-shaking-issue-5734/module.js b/test/form/samples/object-tree-shaking-issue-5734/module.js similarity index 100% rename from test/function/samples/object-tree-shaking-issue-5734/module.js rename to test/form/samples/object-tree-shaking-issue-5734/module.js diff --git a/test/function/samples/object-tree-shaking-issue-5734/_config.js b/test/function/samples/object-tree-shaking-issue-5734/_config.js deleted file mode 100644 index 1afab9cecf1..00000000000 --- a/test/function/samples/object-tree-shaking-issue-5734/_config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = defineTest({ - description: 'Maximum call stack size exceeded', - solo: true -}); diff --git a/test/function/samples/object-tree-shaking-issue-5734/main.js b/test/function/samples/object-tree-shaking-issue-5734/main.js deleted file mode 100644 index d2d5cdeb728..00000000000 --- a/test/function/samples/object-tree-shaking-issue-5734/main.js +++ /dev/null @@ -1,2 +0,0 @@ -import { MySqlParser } from './module.js'; -console.log(new MySqlParser()); From 907ae7776fc05af8348d260aeeb401335a1855d8 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 8 Dec 2024 07:58:15 +0100 Subject: [PATCH 07/32] Split includePath into include, includeNode, includePath - include is for re-including on every pass - includePath is only for including specific non-empty paths once - includeNode is for triggering logic on first include, like includePath. --- src/Module.ts | 45 ++++---- src/ast/nodes/ArrowFunctionExpression.ts | 19 ++-- src/ast/nodes/AssignmentExpression.ts | 15 +-- src/ast/nodes/AssignmentPattern.ts | 2 +- src/ast/nodes/AwaitExpression.ts | 42 +++++--- src/ast/nodes/BlockStatement.ts | 15 ++- src/ast/nodes/BreakStatement.ts | 13 +-- src/ast/nodes/CallExpression.ts | 19 ++-- src/ast/nodes/ClassBody.ts | 15 +-- src/ast/nodes/ConditionalExpression.ts | 37 +++++-- src/ast/nodes/ContinueStatement.ts | 13 +-- src/ast/nodes/DoWhileStatement.ts | 13 +-- src/ast/nodes/ExportDefaultDeclaration.ts | 22 ++-- src/ast/nodes/ExpressionStatement.ts | 4 + src/ast/nodes/ForInStatement.ts | 16 +-- src/ast/nodes/ForOfStatement.ts | 16 +-- src/ast/nodes/ForStatement.ts | 19 ++-- src/ast/nodes/Identifier.ts | 4 +- src/ast/nodes/IfStatement.ts | 33 +++--- src/ast/nodes/ImportExpression.ts | 32 +++--- src/ast/nodes/JSXOpeningFragment.ts | 53 +++++---- src/ast/nodes/LabeledStatement.ts | 25 ++--- src/ast/nodes/Literal.ts | 4 + src/ast/nodes/LogicalExpression.ts | 101 ++++++++++-------- src/ast/nodes/MemberExpression.ts | 84 ++++++++------- src/ast/nodes/MetaProperty.ts | 28 ++--- src/ast/nodes/NewExpression.ts | 17 +-- src/ast/nodes/ObjectExpression.ts | 20 ++-- src/ast/nodes/ObjectPattern.ts | 4 + src/ast/nodes/Program.ts | 15 ++- src/ast/nodes/Property.ts | 23 ++-- src/ast/nodes/RestElement.ts | 14 +-- src/ast/nodes/ReturnStatement.ts | 11 +- src/ast/nodes/SequenceExpression.ts | 22 ++-- src/ast/nodes/StaticBlock.ts | 15 ++- src/ast/nodes/Super.ts | 15 +-- src/ast/nodes/SwitchCase.ts | 17 ++- src/ast/nodes/SwitchStatement.ts | 19 ++-- src/ast/nodes/TaggedTemplateExpression.ts | 23 ++-- src/ast/nodes/TemplateElement.ts | 4 - src/ast/nodes/ThisExpression.ts | 12 ++- src/ast/nodes/ThrowStatement.ts | 11 +- src/ast/nodes/TryStatement.ts | 16 +-- src/ast/nodes/UnknownNode.ts | 5 +- src/ast/nodes/UpdateExpression.ts | 12 +-- src/ast/nodes/VariableDeclaration.ts | 23 ++-- src/ast/nodes/VariableDeclarator.ts | 16 +-- src/ast/nodes/WhileStatement.ts | 17 ++- src/ast/nodes/shared/ClassNode.ts | 23 ++-- src/ast/nodes/shared/Expression.ts | 20 +++- src/ast/nodes/shared/FunctionBase.ts | 15 +-- src/ast/nodes/shared/FunctionNode.ts | 28 ++--- src/ast/nodes/shared/IdentifierBase.ts | 15 ++- src/ast/nodes/shared/JSXElementBase.ts | 37 +++---- src/ast/nodes/shared/Node.ts | 55 +++++++--- src/ast/nodes/shared/ObjectEntity.ts | 57 +++++----- src/ast/nodes/shared/Pattern.ts | 2 + src/ast/nodes/shared/jsxHelpers.ts | 9 +- src/ast/nodes/shared/loops.ts | 3 +- src/ast/scopes/FunctionScope.ts | 6 +- src/ast/scopes/ParameterScope.ts | 13 ++- src/ast/utils/PathTracker.ts | 4 +- src/ast/variables/LocalVariable.ts | 14 +-- .../variables/SyntheticNamedExportVariable.ts | 2 +- .../transpiles-empty-fragment/_expected.js | 2 +- .../side-effect-default-reexport/_expected.js | 6 +- 66 files changed, 717 insertions(+), 614 deletions(-) diff --git a/src/Module.ts b/src/Module.ts index 7d6dd0cc1be..0e2ee6631f6 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -3,6 +3,7 @@ import { locate } from 'locate-character'; import MagicString from 'magic-string'; import { parseAsync } from '../native'; import { convertProgram } from './ast/bufferParsers'; +import type { InclusionContext } from './ast/ExecutionContext'; import { createInclusionContext } from './ast/ExecutionContext'; import { nodeConstructors } from './ast/nodes'; import ExportAllDeclaration from './ast/nodes/ExportAllDeclaration'; @@ -20,12 +21,8 @@ import type Program from './ast/nodes/Program'; import type { NodeBase } from './ast/nodes/shared/Node'; import VariableDeclaration from './ast/nodes/VariableDeclaration'; import ModuleScope from './ast/scopes/ModuleScope'; -import { - EMPTY_PATH, - type EntityPathTracker, - type ObjectPath, - UNKNOWN_PATH -} from './ast/utils/PathTracker'; +import type { ObjectPath } from './ast/utils/PathTracker'; +import { type EntityPathTracker, UNKNOWN_PATH } from './ast/utils/PathTracker'; import ExportDefaultVariable from './ast/variables/ExportDefaultVariable'; import ExportShimVariable from './ast/variables/ExportShimVariable'; import ExternalVariable from './ast/variables/ExternalVariable'; @@ -133,7 +130,11 @@ export interface AstContext { importDescriptions: Map; includeAllExports: () => void; includeDynamicImport: (node: ImportExpression) => void; - includeVariableInModule: (variable: Variable, path: ObjectPath) => void; + includeVariableInModule: ( + variable: Variable, + path: ObjectPath, + context: InclusionContext + ) => void; log: (level: LogLevel, properties: RollupLog, pos: number) => void; magicString: MagicString; manualPureFunctions: PureFunctions; @@ -704,7 +705,7 @@ export default class Module { include(): void { const context = createInclusionContext(); - if (this.ast!.shouldBeIncluded(context)) this.ast!.includePath(EMPTY_PATH, context, false); + if (this.ast!.shouldBeIncluded(context)) this.ast!.include(context, false); } includeAllExports(includeNamespaceMembers: boolean): void { @@ -713,14 +714,15 @@ export default class Module { this.graph.needsTreeshakingPass = true; } + const inclusionContext = createInclusionContext(); for (const exportName of this.exports.keys()) { if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) { const variable = this.getVariableForExportName(exportName)[0]; if (!variable) { return error(logMissingEntryExport(exportName, this.id)); } + this.includeVariable(variable, UNKNOWN_PATH, inclusionContext); variable.deoptimizePath(UNKNOWN_PATH); - this.includeVariable(variable, UNKNOWN_PATH); } } @@ -729,7 +731,7 @@ export default class Module { if (variable) { variable.deoptimizePath(UNKNOWN_PATH); if (!variable.included) { - this.includeVariable(variable, UNKNOWN_PATH); + this.includeVariable(variable, UNKNOWN_PATH, inclusionContext); } if (variable instanceof ExternalVariable) { variable.module.reexported = true; @@ -743,7 +745,7 @@ export default class Module { } includeAllInBundle(): void { - this.ast!.includePath(UNKNOWN_PATH, createInclusionContext(), true); + this.ast!.include(createInclusionContext(), true); this.includeAllExports(false); } @@ -755,13 +757,12 @@ export default class Module { let includeNamespaceMembers = false; + const inclusionContext = createInclusionContext(); for (const name of names) { const variable = this.getVariableForExportName(name)[0]; if (variable) { variable.deoptimizePath(UNKNOWN_PATH); - if (!variable.included) { - this.includeVariable(variable, UNKNOWN_PATH); - } + this.includeVariable(variable, UNKNOWN_PATH, inclusionContext); } if (!this.exports.has(name) && !this.reexportDescriptions.has(name)) { @@ -1374,9 +1375,10 @@ export default class Module { } } - private includeVariable(variable: Variable, path: ObjectPath): void { - const variableModule = variable.module; - if (variable.included) { + private includeVariable(variable: Variable, path: ObjectPath, context: InclusionContext): void { + const { included, module: variableModule } = variable; + variable.includePath(path, context); + if (included) { if (variableModule instanceof Module && variableModule !== this) { getAndExtendSideEffectModules(variable, this); } @@ -1396,11 +1398,14 @@ export default class Module { } } } - variable.includePath(path, createInclusionContext()); } - private includeVariableInModule(variable: Variable, path: ObjectPath): void { - this.includeVariable(variable, path); + private includeVariableInModule( + variable: Variable, + path: ObjectPath, + context: InclusionContext + ): void { + this.includeVariable(variable, path, context); const variableModule = variable.module; if (variableModule && variableModule !== this) { this.includedImports.add(variable); diff --git a/src/ast/nodes/ArrowFunctionExpression.ts b/src/ast/nodes/ArrowFunctionExpression.ts index 649d10e4a6b..e9eaffbe470 100644 --- a/src/ast/nodes/ArrowFunctionExpression.ts +++ b/src/ast/nodes/ArrowFunctionExpression.ts @@ -75,15 +75,20 @@ export default class ArrowFunctionExpression extends FunctionBase { return isIIFE || super.onlyFunctionCallUsed(); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - super.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + super.include(context, includeChildrenRecursively); for (const parameter of this.params) { if (!(parameter instanceof Identifier)) { - parameter.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + parameter.include(context, includeChildrenRecursively); + } + } + } + + includeNode(context: InclusionContext) { + super.includeNode(context); + for (const parameter of this.params) { + if (!(parameter instanceof Identifier)) { + parameter.includePath(UNKNOWN_PATH, context); } } } diff --git a/src/ast/nodes/AssignmentExpression.ts b/src/ast/nodes/AssignmentExpression.ts index bce594178cb..1a3f3ec1a0b 100644 --- a/src/ast/nodes/AssignmentExpression.ts +++ b/src/ast/nodes/AssignmentExpression.ts @@ -69,14 +69,10 @@ export default class AssignmentExpression extends NodeBase { return this.right.hasEffectsOnInteractionAtPath(path, interaction, context); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { const { deoptimized, left, right, operator } = this; if (!deoptimized) this.applyDeoptimizations(); - this.included = true; + if (!this.included) this.includeNode(context); const hasEffectsContext = createHasEffectsContext(); if ( includeChildrenRecursively || @@ -87,7 +83,12 @@ export default class AssignmentExpression extends NodeBase { ) { left.includeAsAssignmentTarget(context, includeChildrenRecursively, operator !== '='); } - right.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + right.include(context, includeChildrenRecursively); + } + + includeNode(context: InclusionContext) { + this.included = true; + this.right.includePath(UNKNOWN_PATH, context); } initialise(): void { diff --git a/src/ast/nodes/AssignmentPattern.ts b/src/ast/nodes/AssignmentPattern.ts index e071fe980fe..acd7d7d7587 100644 --- a/src/ast/nodes/AssignmentPattern.ts +++ b/src/ast/nodes/AssignmentPattern.ts @@ -69,7 +69,7 @@ export default class AssignmentPattern extends NodeBase implements DeclarationPa this.left.includeDestructuredIfNecessary(context, destructuredInitPath, init) || this.included; if ((included ||= this.right.shouldBeIncluded(context))) { - this.right.includePath(UNKNOWN_PATH, context, false); + this.right.include(context, false); if (!this.left.included) { this.left.included = true; // Unfortunately, we need to include the left side again now, so that diff --git a/src/ast/nodes/AwaitExpression.ts b/src/ast/nodes/AwaitExpression.ts index 55585f265d0..ee4cf08b854 100644 --- a/src/ast/nodes/AwaitExpression.ts +++ b/src/ast/nodes/AwaitExpression.ts @@ -1,5 +1,5 @@ import type { InclusionContext } from '../ExecutionContext'; -import { type ObjectPath } from '../utils/PathTracker'; +import type { ObjectPath } from '../utils/PathTracker'; import ArrowFunctionExpression from './ArrowFunctionExpression'; import type * as NodeType from './NodeType'; import FunctionNode from './shared/FunctionNode'; @@ -14,23 +14,31 @@ export default class AwaitExpression extends NodeBase { return true; } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); - if (!this.included) { - this.included = true; - checkTopLevelAwait: if (!this.scope.context.usesTopLevelAwait) { - let parent = this.parent; - do { - if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression) - break checkTopLevelAwait; - } while ((parent = (parent as Node).parent as Node)); - this.scope.context.usesTopLevelAwait = true; - } + if (!this.included) this.includeNode(context); + this.argument.include(context, includeChildrenRecursively); + } + + includeNode(context: InclusionContext): void { + this.included = true; + checkTopLevelAwait: if (!this.scope.context.usesTopLevelAwait) { + let parent = this.parent; + do { + if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression) + break checkTopLevelAwait; + } while ((parent = (parent as Node).parent as Node)); + this.scope.context.usesTopLevelAwait = true; } - this.argument.includePath(path, context, includeChildrenRecursively); + // Thenables need to be included + this.argument.includePath(THEN_PATH, context); + } + + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.deoptimized) this.applyDeoptimizations(); + if (!this.included) this.includeNode(context); + this.argument.includePath(path, context); } } + +const THEN_PATH = ['then']; diff --git a/src/ast/nodes/BlockStatement.ts b/src/ast/nodes/BlockStatement.ts index ff6baa33180..f96c743081e 100644 --- a/src/ast/nodes/BlockStatement.ts +++ b/src/ast/nodes/BlockStatement.ts @@ -3,7 +3,6 @@ import { type RenderOptions, renderStatementList } from '../../utils/renderHelpe import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import ExpressionStatement from './ExpressionStatement'; import * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; @@ -50,22 +49,22 @@ export default class BlockStatement extends StatementBase { return false; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!(this.deoptimizeBody && this.directlyIncluded)) { - this.included = true; + if (!this.included) this.includeNode(); this.directlyIncluded = true; if (this.deoptimizeBody) includeChildrenRecursively = true; for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) - node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + node.include(context, includeChildrenRecursively); } } } + includeNode() { + this.included = true; + } + initialise(): void { super.initialise(); const firstBodyStatement = this.body[0]; diff --git a/src/ast/nodes/BreakStatement.ts b/src/ast/nodes/BreakStatement.ts index b3e783e84ea..78d08154465 100644 --- a/src/ast/nodes/BreakStatement.ts +++ b/src/ast/nodes/BreakStatement.ts @@ -1,9 +1,4 @@ -import { - createInclusionContext, - type HasEffectsContext, - type InclusionContext -} from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; +import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; import { StatementBase } from './shared/Node'; @@ -24,10 +19,10 @@ export default class BreakStatement extends StatementBase { return false; } - includePath(_: ObjectPath, context: InclusionContext): void { - this.included = true; + include(context: InclusionContext): void { + if (!this.included) this.includeNode(context); if (this.label) { - this.label.includePath(UNKNOWN_PATH, createInclusionContext()); + this.label.include(context); context.includedLabels.add(this.label.name); } else { context.hasBreak = true; diff --git a/src/ast/nodes/CallExpression.ts b/src/ast/nodes/CallExpression.ts index 531a9c5d25e..ccc8b77fedd 100644 --- a/src/ast/nodes/CallExpression.ts +++ b/src/ast/nodes/CallExpression.ts @@ -111,14 +111,10 @@ export default class CallExpression ); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { - super.includePath(path, context, includeChildrenRecursively); + super.include(context, includeChildrenRecursively); if ( includeChildrenRecursively === INCLUDE_PARAMETERS && this.callee instanceof Identifier && @@ -127,20 +123,25 @@ export default class CallExpression this.callee.variable.markCalledFromTryStatement(); } } else { - this.included = true; + if (!this.included) this.includeNode(context); // If the callee is a member expression and does not have a variable, its // object will already be included via the first argument of the // interaction in includeCallArguments. Including it again can lead to // severe performance problems. if (this.callee instanceof MemberExpression && !this.callee.variable) { - this.callee.property.includePath(UNKNOWN_PATH, context, false); + this.callee.property.include(context, false); } else { - this.callee.includePath(UNKNOWN_PATH, context, false); + this.callee.include(context, false); } this.callee.includeCallArguments(context, this.interaction); } } + includeNode(context: InclusionContext) { + this.included = true; + this.callee.includePath(UNKNOWN_PATH, context); + } + initialise() { super.initialise(); if ( diff --git a/src/ast/nodes/ClassBody.ts b/src/ast/nodes/ClassBody.ts index ee9c85e04a0..e30d6ae693f 100644 --- a/src/ast/nodes/ClassBody.ts +++ b/src/ast/nodes/ClassBody.ts @@ -1,7 +1,7 @@ import type { InclusionContext } from '../ExecutionContext'; import type ChildScope from '../scopes/ChildScope'; import ClassBodyScope from '../scopes/ClassBodyScope'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type MethodDefinition from './MethodDefinition'; import type * as NodeType from './NodeType'; @@ -19,16 +19,11 @@ export default class ClassBody extends NodeBase { this.scope = new ClassBodyScope(parentScope, this.parent as ClassNode); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - if (this.included) return; - this.included = true; - this.scope.context.includeVariableInModule(this.scope.thisVariable, UNKNOWN_PATH); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); + this.scope.context.includeVariableInModule(this.scope.thisVariable, UNKNOWN_PATH, context); for (const definition of this.body) { - definition.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + definition.include(context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/ConditionalExpression.ts b/src/ast/nodes/ConditionalExpression.ts index eac39c2b357..9e9ec40f665 100644 --- a/src/ast/nodes/ConditionalExpression.ts +++ b/src/ast/nodes/ConditionalExpression.ts @@ -8,6 +8,7 @@ import { } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { createInclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; @@ -50,6 +51,9 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz const unusedBranch = this.usedBranch === this.consequent ? this.alternate : this.consequent; this.usedBranch = null; unusedBranch.deoptimizePath(UNKNOWN_PATH); + if (this.included) { + unusedBranch.includePath(UNKNOWN_PATH, createInclusionContext()); + } const { expressionsToBeDeoptimized } = this; this.expressionsToBeDeoptimized = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; for (const expression of expressionsToBeDeoptimized) { @@ -137,19 +141,30 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz return usedBranch.hasEffectsOnInteractionAtPath(path, interaction, context); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); + const usedBranch = this.getUsedBranch(); + if (usedBranch === null || includeChildrenRecursively || this.test.shouldBeIncluded(context)) { + this.test.include(context, includeChildrenRecursively); + this.consequent.include(context, includeChildrenRecursively); + this.alternate.include(context, includeChildrenRecursively); + } else { + usedBranch.include(context, includeChildrenRecursively); + } + } + + includeNode() { this.included = true; + } + + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.included) this.includeNode(); const usedBranch = this.getUsedBranch(); - if (includeChildrenRecursively || this.test.shouldBeIncluded(context) || usedBranch === null) { - this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - this.consequent.includePath(path, context, includeChildrenRecursively); - this.alternate.includePath(path, context, includeChildrenRecursively); + if (usedBranch === null || this.test.shouldBeIncluded(context)) { + this.consequent.includePath(path, context); + this.alternate.includePath(path, context); } else { - usedBranch.includePath(path, context, includeChildrenRecursively); + usedBranch.includePath(path, context); } } @@ -177,12 +192,12 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz renderedSurroundingElement }: NodeRenderOptions = BLANK ): void { - const usedBranch = this.getUsedBranch(); if (this.test.included) { this.test.render(code, options, { renderedSurroundingElement }); this.consequent.render(code, options); this.alternate.render(code, options); } else { + const usedBranch = this.getUsedBranch(); const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end); const inclusionStart = findNonWhiteSpace( code.original, diff --git a/src/ast/nodes/ContinueStatement.ts b/src/ast/nodes/ContinueStatement.ts index 16c4f8c7ad2..1f03f6493ae 100644 --- a/src/ast/nodes/ContinueStatement.ts +++ b/src/ast/nodes/ContinueStatement.ts @@ -1,9 +1,4 @@ -import { - createInclusionContext, - type HasEffectsContext, - type InclusionContext -} from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; +import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; import { StatementBase } from './shared/Node'; @@ -24,10 +19,10 @@ export default class ContinueStatement extends StatementBase { return false; } - includePath(_: ObjectPath, context: InclusionContext): void { - this.included = true; + include(context: InclusionContext): void { + if (!this.included) this.includeNode(context); if (this.label) { - this.label.includePath(UNKNOWN_PATH, createInclusionContext()); + this.label.include(context); context.includedLabels.add(this.label.name); } else { context.hasContinue = true; diff --git a/src/ast/nodes/DoWhileStatement.ts b/src/ast/nodes/DoWhileStatement.ts index 829aaae340c..8f53a47d348 100644 --- a/src/ast/nodes/DoWhileStatement.ts +++ b/src/ast/nodes/DoWhileStatement.ts @@ -1,13 +1,12 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; +import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; -import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; export default class DoWhileStatement extends StatementBase { declare body: StatementNode; @@ -19,13 +18,9 @@ export default class DoWhileStatement extends StatementBase { return hasLoopBodyEffects(context, this.body); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); + this.test.include(context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } } diff --git a/src/ast/nodes/ExportDefaultDeclaration.ts b/src/ast/nodes/ExportDefaultDeclaration.ts index bb0ad2ee540..36cf0ac7581 100644 --- a/src/ast/nodes/ExportDefaultDeclaration.ts +++ b/src/ast/nodes/ExportDefaultDeclaration.ts @@ -10,6 +10,7 @@ import { treeshakeNode } from '../../utils/treeshakeNode'; import type { InclusionContext } from '../ExecutionContext'; import type ModuleScope from '../scopes/ModuleScope'; import type { ObjectPath } from '../utils/PathTracker'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type ExportDefaultVariable from '../variables/ExportDefaultVariable'; import ClassDeclaration from './ClassDeclaration'; import FunctionDeclaration from './FunctionDeclaration'; @@ -42,18 +43,23 @@ export default class ExportDefaultDeclaration extends NodeBase { declare private declarationName: string | undefined; - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.declaration.includePath(path, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); + this.declaration.include(context, includeChildrenRecursively); if (includeChildrenRecursively) { - this.scope.context.includeVariableInModule(this.variable, path); + this.scope.context.includeVariableInModule(this.variable, UNKNOWN_PATH, context); } } + includeNode() { + this.included = true; + } + + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.included) this.includeNode(); + this.declaration.includePath(path, context); + } + initialise(): void { super.initialise(); const declaration = this.declaration as FunctionDeclaration | ClassDeclaration; diff --git a/src/ast/nodes/ExpressionStatement.ts b/src/ast/nodes/ExpressionStatement.ts index cf1880e9470..1a6471293e4 100644 --- a/src/ast/nodes/ExpressionStatement.ts +++ b/src/ast/nodes/ExpressionStatement.ts @@ -10,6 +10,10 @@ export default class ExpressionStatement extends StatementBase { declare directive?: string; declare expression: ExpressionNode; + includeNode() { + this.included = true; + } + initialise(): void { super.initialise(); if ( diff --git a/src/ast/nodes/ForInStatement.ts b/src/ast/nodes/ForInStatement.ts index 0cdb33b66ae..8e66f3f88a9 100644 --- a/src/ast/nodes/ForInStatement.ts +++ b/src/ast/nodes/ForInStatement.ts @@ -3,7 +3,6 @@ import { NO_SEMICOLON, type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import type { ObjectPath } from '../utils/PathTracker'; import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; @@ -34,19 +33,20 @@ export default class ForInStatement extends StatementBase { return hasLoopBodyEffects(context, body); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { const { body, deoptimized, left, right } = this; if (!deoptimized) this.applyDeoptimizations(); - this.included = true; + if (!this.included) this.includeNode(context); left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false); - right.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + right.include(context, includeChildrenRecursively); includeLoopBody(context, body, includeChildrenRecursively); } + includeNode(context: InclusionContext) { + this.included = true; + this.right.includePath(UNKNOWN_PATH, context); + } + initialise() { super.initialise(); this.left.setAssignedValue(UNKNOWN_EXPRESSION); diff --git a/src/ast/nodes/ForOfStatement.ts b/src/ast/nodes/ForOfStatement.ts index 17fc07b0209..c1ce7e86e4a 100644 --- a/src/ast/nodes/ForOfStatement.ts +++ b/src/ast/nodes/ForOfStatement.ts @@ -3,7 +3,6 @@ import { NO_SEMICOLON, type RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import type { ObjectPath } from '../utils/PathTracker'; import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; @@ -41,19 +40,20 @@ export default class ForOfStatement extends StatementBase { return true; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { const { body, deoptimized, left, right } = this; if (!deoptimized) this.applyDeoptimizations(); - this.included = true; + if (!this.included) this.includeNode(context); left.includeAsAssignmentTarget(context, includeChildrenRecursively || true, false); - right.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + right.include(context, includeChildrenRecursively); includeLoopBody(context, body, includeChildrenRecursively); } + includeNode(context: InclusionContext) { + this.included = true; + this.right.includePath(UNKNOWN_PATH, context); + } + initialise() { super.initialise(); this.left.setAssignedValue(UNKNOWN_EXPRESSION); diff --git a/src/ast/nodes/ForStatement.ts b/src/ast/nodes/ForStatement.ts index 6f94edcc970..ca2f6b0c2c5 100644 --- a/src/ast/nodes/ForStatement.ts +++ b/src/ast/nodes/ForStatement.ts @@ -3,16 +3,15 @@ import { NO_SEMICOLON, type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; -import type VariableDeclaration from './VariableDeclaration'; +import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; -import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; +import type VariableDeclaration from './VariableDeclaration'; export default class ForStatement extends StatementBase { declare body: StatementNode; @@ -36,17 +35,13 @@ export default class ForStatement extends StatementBase { return hasLoopBodyEffects(context, this.body); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.init?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively, { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); + this.init?.include(context, includeChildrenRecursively, { asSingleStatement: true }); - this.test?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - this.update?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.test?.include(context, includeChildrenRecursively); + this.update?.include(context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } diff --git a/src/ast/nodes/Identifier.ts b/src/ast/nodes/Identifier.ts index 75a27641a1c..b74e063eaff 100644 --- a/src/ast/nodes/Identifier.ts +++ b/src/ast/nodes/Identifier.ts @@ -127,9 +127,9 @@ export default class Identifier extends IdentifierBase implements DeclarationPat ))) ) { if (this.variable && !this.variable.included) { - this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH); + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } - init.includePath(destructuredInitPath, context, false); + init.includePath(destructuredInitPath, context); return true; } return false; diff --git a/src/ast/nodes/IfStatement.ts b/src/ast/nodes/IfStatement.ts index 4a2f8d57938..690c84ab91e 100644 --- a/src/ast/nodes/IfStatement.ts +++ b/src/ast/nodes/IfStatement.ts @@ -3,8 +3,7 @@ import type { RenderOptions } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import TrackingScope from '../scopes/TrackingScope'; -import type { ObjectPath } from '../utils/PathTracker'; -import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; +import { EMPTY_PATH, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; import { tryCastLiteralValueToBoolean } from '../utils/tryCastLiteralValueToBoolean'; import BlockStatement from './BlockStatement'; import type Identifier from './Identifier'; @@ -52,12 +51,8 @@ export default class IfStatement extends StatementBase implements DeoptimizableE return testValue ? this.consequent.hasEffects(context) : !!this.alternate?.hasEffects(context); } - includePath( - _: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); if (includeChildrenRecursively) { this.includeRecursively(includeChildrenRecursively, context); } else { @@ -70,6 +65,10 @@ export default class IfStatement extends StatementBase implements DeoptimizableE } } + includeNode() { + this.included = true; + } + parseNode(esTreeNode: GenericEsTreeNode): this { this.consequent = new (this.scope.context.getNodeConstructor(esTreeNode.consequent.type))( this, @@ -139,13 +138,13 @@ export default class IfStatement extends StatementBase implements DeoptimizableE private includeKnownTest(context: InclusionContext, testValue: LiteralValueOrUnknown) { if (this.test.shouldBeIncluded(context)) { - this.test.includePath(UNKNOWN_PATH, context, false); + this.test.include(context, false); } if (testValue && this.consequent.shouldBeIncluded(context)) { - this.consequent.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); + this.consequent.include(context, false, { asSingleStatement: true }); } if (!testValue && this.alternate?.shouldBeIncluded(context)) { - this.alternate.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); + this.alternate.include(context, false, { asSingleStatement: true }); } } @@ -153,22 +152,22 @@ export default class IfStatement extends StatementBase implements DeoptimizableE includeChildrenRecursively: true | 'variables', context: InclusionContext ) { - this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - this.consequent.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - this.alternate?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.test.include(context, includeChildrenRecursively); + this.consequent.include(context, includeChildrenRecursively); + this.alternate?.include(context, includeChildrenRecursively); } private includeUnknownTest(context: InclusionContext) { - this.test.includePath(UNKNOWN_PATH, context, false); + this.test.include(context, false); const { brokenFlow } = context; let consequentBrokenFlow = false; if (this.consequent.shouldBeIncluded(context)) { - this.consequent.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); + this.consequent.include(context, false, { asSingleStatement: true }); consequentBrokenFlow = context.brokenFlow; context.brokenFlow = brokenFlow; } if (this.alternate?.shouldBeIncluded(context)) { - this.alternate.includePath(UNKNOWN_PATH, context, false, { asSingleStatement: true }); + this.alternate.include(context, false, { asSingleStatement: true }); context.brokenFlow = context.brokenFlow && consequentBrokenFlow; } } diff --git a/src/ast/nodes/ImportExpression.ts b/src/ast/nodes/ImportExpression.ts index 480dbcac51c..96fa42add56 100644 --- a/src/ast/nodes/ImportExpression.ts +++ b/src/ast/nodes/ImportExpression.ts @@ -12,7 +12,8 @@ import type { PluginDriver } from '../../utils/PluginDriver'; import { findFirstOccurrenceOutsideComment, type RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; import type ChildScope from '../scopes/ChildScope'; -import { type ObjectPath, UnknownKey } from '../utils/PathTracker'; +import type { ObjectPath } from '../utils/PathTracker'; +import { UnknownKey } from '../utils/PathTracker'; import type NamespaceVariable from '../variables/NamespaceVariable'; import ArrowFunctionExpression from './ArrowFunctionExpression'; import AwaitExpression from './AwaitExpression'; @@ -157,25 +158,28 @@ export default class ImportExpression extends NodeBase { return true; } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - if (!this.included) { - this.included = true; - this.scope.context.includeDynamicImport(this); - this.scope.addAccessedDynamicImport(this); - this.source.includePath(path, context, includeChildrenRecursively); - } + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); + this.source.include(context, includeChildrenRecursively); + } + + includeNode() { + this.included = true; + this.scope.context.includeDynamicImport(this); + this.scope.addAccessedDynamicImport(this); + } + + includePath(path: ObjectPath): void { + if (!this.included) this.includeNode(); + // Technically, this is not correct as dynamic imports return a Promise. if (this.hasUnknownAccessedKey) return; if (path[0] === UnknownKey) { this.hasUnknownAccessedKey = true; - this.scope.context.includeDynamicImport(this); } else if (typeof path[0] === 'string') { this.accessedPropKey.add(path[0]); - this.scope.context.includeDynamicImport(this); } + // Update included paths + this.scope.context.includeDynamicImport(this); } initialise(): void { diff --git a/src/ast/nodes/JSXOpeningFragment.ts b/src/ast/nodes/JSXOpeningFragment.ts index ee127b3881a..805a1762331 100644 --- a/src/ast/nodes/JSXOpeningFragment.ts +++ b/src/ast/nodes/JSXOpeningFragment.ts @@ -2,11 +2,10 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../rollup/types'; import type { RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; -import type { ObjectPath } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { getAndIncludeFactoryVariable } from './shared/jsxHelpers'; -import { type IncludeChildren, NodeBase } from './shared/Node'; +import { NodeBase } from './shared/Node'; export default class JSXOpeningFragment extends NodeBase { type!: NodeType.tJSXOpeningElement; @@ -16,35 +15,35 @@ export default class JSXOpeningFragment extends NodeBase { private fragment: string | null = null; private fragmentVariable: Variable | null = null; - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { - if (!this.included) { - const jsx = this.scope.context.options.jsx as NormalizedJsxOptions; - if (jsx.mode === 'automatic') { - this.fragment = 'Fragment'; + include(context: InclusionContext) { + if (!this.included) this.includeNode(context); + } + + includeNode(context: InclusionContext) { + this.included = true; + const jsx = this.scope.context.options.jsx as NormalizedJsxOptions; + if (jsx.mode === 'automatic') { + this.fragment = 'Fragment'; + this.fragmentVariable = getAndIncludeFactoryVariable( + 'Fragment', + false, + jsx.jsxImportSource, + this, + context + ); + } else { + const { fragment, importSource, mode } = jsx; + if (fragment != null) { + this.fragment = fragment; this.fragmentVariable = getAndIncludeFactoryVariable( - 'Fragment', - false, - jsx.jsxImportSource, - this + fragment, + mode === 'preserve', + importSource, + this, + context ); - } else { - const { fragment, importSource, mode } = jsx; - if (fragment != null) { - this.fragment = fragment; - this.fragmentVariable = getAndIncludeFactoryVariable( - fragment, - mode === 'preserve', - importSource, - this - ); - } } } - super.includePath(path, context, includeChildrenRecursively); } render(code: MagicString, options: RenderOptions): void { diff --git a/src/ast/nodes/LabeledStatement.ts b/src/ast/nodes/LabeledStatement.ts index bbdb401d14e..56dc6421132 100644 --- a/src/ast/nodes/LabeledStatement.ts +++ b/src/ast/nodes/LabeledStatement.ts @@ -4,12 +4,8 @@ import { findNonWhiteSpace, type RenderOptions } from '../../utils/renderHelpers'; -import { - createInclusionContext, - type HasEffectsContext, - type InclusionContext -} from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; +import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; import { type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; @@ -37,23 +33,24 @@ export default class LabeledStatement extends StatementBase { return bodyHasEffects; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); const { brokenFlow, includedLabels } = context; context.includedLabels = new Set(); - this.body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.body.include(context, includeChildrenRecursively); if (includeChildrenRecursively || context.includedLabels.has(this.label.name)) { - this.label.includePath(UNKNOWN_PATH, createInclusionContext()); + this.label.include(context); context.includedLabels.delete(this.label.name); context.brokenFlow = brokenFlow; } context.includedLabels = new Set([...includedLabels, ...context.includedLabels]); } + includeNode(context: InclusionContext) { + this.included = true; + this.body.includePath(UNKNOWN_PATH, context); + } + render(code: MagicString, options: RenderOptions): void { if (this.label.included) { this.label.render(code, options); diff --git a/src/ast/nodes/Literal.ts b/src/ast/nodes/Literal.ts index f5c12569a36..dc33f495c0f 100644 --- a/src/ast/nodes/Literal.ts +++ b/src/ast/nodes/Literal.ts @@ -90,6 +90,10 @@ export default class Literal< } } + includeNode() { + this.included = true; + } + initialise(): void { super.initialise(); this.members = getLiteralMembersForValue(this.value); diff --git a/src/ast/nodes/LogicalExpression.ts b/src/ast/nodes/LogicalExpression.ts index e70dd499770..d70072b873e 100644 --- a/src/ast/nodes/LogicalExpression.ts +++ b/src/ast/nodes/LogicalExpression.ts @@ -10,6 +10,7 @@ import { } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { createInclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { EMPTY_PATH, @@ -73,6 +74,10 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable const unusedBranch = this.usedBranch === this.left ? this.right : this.left; this.usedBranch = null; unusedBranch.deoptimizePath(UNKNOWN_PATH); + if (this.included) { + // As we are not tracking inclusions, we just include everything + unusedBranch.includePath(UNKNOWN_PATH, createInclusionContext()); + } } const { scope: { context }, @@ -131,31 +136,32 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable origin: DeoptimizableEntity ): [expression: ExpressionEntity, isPure: boolean] { const usedBranch = this.getUsedBranch(); - if (!usedBranch) - return [ - new MultiExpression([ - this.left.getReturnExpressionWhenCalledAtPath( - path, - interaction, - recursionTracker, - origin - )[0], - this.right.getReturnExpressionWhenCalledAtPath( - path, - interaction, - recursionTracker, - origin - )[0] - ]), - false - ]; - this.expressionsToBeDeoptimized.push(origin); - return usedBranch.getReturnExpressionWhenCalledAtPath( - path, - interaction, - recursionTracker, - origin - ); + if (usedBranch) { + this.expressionsToBeDeoptimized.push(origin); + return usedBranch.getReturnExpressionWhenCalledAtPath( + path, + interaction, + recursionTracker, + origin + ); + } + return [ + new MultiExpression([ + this.left.getReturnExpressionWhenCalledAtPath( + path, + interaction, + recursionTracker, + origin + )[0], + this.right.getReturnExpressionWhenCalledAtPath( + path, + interaction, + recursionTracker, + origin + )[0] + ]), + false + ]; } hasEffects(context: HasEffectsContext): boolean { @@ -174,34 +180,45 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable context: HasEffectsContext ): boolean { const usedBranch = this.getUsedBranch(); - if (!usedBranch) { - return ( - this.left.hasEffectsOnInteractionAtPath(path, interaction, context) || - this.right.hasEffectsOnInteractionAtPath(path, interaction, context) - ); + if (usedBranch) { + return usedBranch.hasEffectsOnInteractionAtPath(path, interaction, context); } - return usedBranch.hasEffectsOnInteractionAtPath(path, interaction, context); + return ( + this.left.hasEffectsOnInteractionAtPath(path, interaction, context) || + this.right.hasEffectsOnInteractionAtPath(path, interaction, context) + ); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); const usedBranch = this.getUsedBranch(); if ( includeChildrenRecursively || - (usedBranch === this.right && this.left.shouldBeIncluded(context)) || - !usedBranch + !usedBranch || + (usedBranch === this.right && this.left.shouldBeIncluded(context)) ) { - this.left.includePath(path, context, includeChildrenRecursively); - this.right.includePath(path, context, includeChildrenRecursively); + this.left.include(context, includeChildrenRecursively); + this.right.include(context, includeChildrenRecursively); + } else { + usedBranch.include(context, includeChildrenRecursively); + } + } + + includePath(path: ObjectPath, context: InclusionContext): void { + this.included = true; + const usedBranch = this.getUsedBranch(); + if (!usedBranch || (usedBranch === this.right && this.left.shouldBeIncluded(context))) { + this.left.includePath(path, context); + this.right.includePath(path, context); } else { - usedBranch.includePath(path, context, includeChildrenRecursively); + usedBranch.includePath(path, context); } } + includeNode() { + this.included = true; + } + removeAnnotations(code: MagicString) { this.left.removeAnnotations(code); } diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index 91e694e2518..411a4e11037 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -7,7 +7,7 @@ import { logIllegalImportReassignment, logMissingExport } from '../../utils/logs import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import { createHasEffectsContext } from '../ExecutionContext'; +import { createHasEffectsContext, createInclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionAccessed, @@ -198,6 +198,9 @@ export default class MemberExpression this.expressionsToBeDeoptimized = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; this.dynamicPropertyKey = this.propertyKey; object.deoptimizePath(UNKNOWN_PATH); + if (this.included) { + object.includePath(UNKNOWN_PATH, createInclusionContext()); + } for (const expression of expressionsToBeDeoptimized) { expression.deoptimizeCache(); } @@ -355,23 +358,38 @@ export default class MemberExpression ); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); - this.includeProperties( - path, - [ - this.propertyKey, - ...(path.length < MAX_PATH_DEPTH - ? path - : [...path.slice(0, MAX_PATH_DEPTH), UnknownKey as ObjectPathKey]) - ], - context, - includeChildrenRecursively - ); + if (!this.included) this.includeNode(context); + this.object.include(context, includeChildrenRecursively); + this.property.include(context, includeChildrenRecursively); + } + + includeNode(context: InclusionContext) { + this.included = true; + if (this.variable) { + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); + } else if (!this.isUndefined) { + this.object.includePath([this.propertyKey], context); + } + } + + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.deoptimized) this.applyDeoptimizations(); + if (!this.included) this.includeNode(context); + if (this.variable) { + this.variable?.includePath(path, context); + } else if (!this.isUndefined) { + this.object.includePath( + [ + this.propertyKey, + ...(path.length < MAX_PATH_DEPTH + ? path + : [...path.slice(0, MAX_PATH_DEPTH), UnknownKey as ObjectPathKey]) + ], + context + ); + } } includeAsAssignmentTarget( @@ -381,9 +399,11 @@ export default class MemberExpression ): void { if (!this.assignmentDeoptimized) this.applyAssignmentDeoptimization(); if (deoptimizeAccess) { - this.includePath([this.propertyKey], context, includeChildrenRecursively); + this.include(context, includeChildrenRecursively); } else { - this.includeProperties(EMPTY_PATH, [this.propertyKey], context, includeChildrenRecursively); + if (!this.included) this.includeNode(context); + this.object.include(context, includeChildrenRecursively); + this.property.include(context, includeChildrenRecursively); } } @@ -410,7 +430,7 @@ export default class MemberExpression createHasEffectsContext() )) ) { - init.includePath(destructuredInitPath, context, false); + init.include(context, false); return true; } return false; @@ -505,7 +525,11 @@ export default class MemberExpression const variable = this.scope.findVariable(this.object.name); if (variable.isNamespace) { if (this.variable) { - this.scope.context.includeVariableInModule(this.variable, UNKNOWN_PATH); + this.scope.context.includeVariableInModule( + this.variable, + UNKNOWN_PATH, + createInclusionContext() + ); } this.scope.context.log( LOGLEVEL_WARN, @@ -544,24 +568,6 @@ export default class MemberExpression )) ); } - - private includeProperties( - includedPath: ObjectPath, - objectPath: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { - if (!this.included) { - this.included = true; - if (this.variable) { - this.scope.context.includeVariableInModule(this.variable, includedPath); - } - } else if (includedPath.length > 0) { - this.variable?.includePath(includedPath, context); - } - this.object.includePath(objectPath, context, includeChildrenRecursively); - this.property.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - } } function resolveNamespaceVariables( diff --git a/src/ast/nodes/MetaProperty.ts b/src/ast/nodes/MetaProperty.ts index fa6bf8cefcd..5993f031fad 100644 --- a/src/ast/nodes/MetaProperty.ts +++ b/src/ast/nodes/MetaProperty.ts @@ -46,19 +46,21 @@ export default class MetaProperty extends NodeBase { return path.length > 1 || type !== INTERACTION_ACCESSED; } - includePath(): void { - if (!this.included) { - this.included = true; - if (this.meta.name === IMPORT) { - this.scope.context.addImportMeta(this); - const parent = this.parent; - const metaProperty = (this.metaProperty = - parent instanceof MemberExpression && typeof parent.propertyKey === 'string' - ? parent.propertyKey - : null); - if (metaProperty?.startsWith(FILE_PREFIX)) { - this.referenceId = metaProperty.slice(FILE_PREFIX.length); - } + include(): void { + if (!this.included) this.includeNode(); + } + + includeNode() { + this.included = true; + if (this.meta.name === IMPORT) { + this.scope.context.addImportMeta(this); + const parent = this.parent; + const metaProperty = (this.metaProperty = + parent instanceof MemberExpression && typeof parent.propertyKey === 'string' + ? parent.propertyKey + : null); + if (metaProperty?.startsWith(FILE_PREFIX)) { + this.referenceId = metaProperty.slice(FILE_PREFIX.length); } } } diff --git a/src/ast/nodes/NewExpression.ts b/src/ast/nodes/NewExpression.ts index 5c2c9ed8698..f95c1594571 100644 --- a/src/ast/nodes/NewExpression.ts +++ b/src/ast/nodes/NewExpression.ts @@ -41,21 +41,22 @@ export default class NewExpression extends NodeBase { return path.length > 0 || type !== INTERACTION_ACCESSED; } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { - super.includePath(path, context, includeChildrenRecursively); + super.include(context, includeChildrenRecursively); } else { - this.included = true; - this.callee.includePath(UNKNOWN_PATH, context, false); + if (!this.included) this.includeNode(context); + this.callee.include(context, false); } this.callee.includeCallArguments(context, this.interaction); } + includeNode(context: InclusionContext) { + this.included = true; + this.callee.includePath(UNKNOWN_PATH, context); + } + initialise(): void { super.initialise(); this.interaction = { diff --git a/src/ast/nodes/ObjectExpression.ts b/src/ast/nodes/ObjectExpression.ts index 4c9950b1ac1..99869491b6d 100644 --- a/src/ast/nodes/ObjectExpression.ts +++ b/src/ast/nodes/ObjectExpression.ts @@ -81,14 +81,20 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + if (!this.included) this.includeNode(context); + this.getObjectEntity().include(context, includeChildrenRecursively); + this.protoProp?.include(context, includeChildrenRecursively); + } + + includeNode(context: InclusionContext) { this.included = true; - this.getObjectEntity().includePath(path, context, includeChildrenRecursively); - this.protoProp?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.protoProp?.includePath(UNKNOWN_PATH, context); + } + + includePath(path: ObjectPath, context: InclusionContext) { + if (!this.included) this.includeNode(context); + this.getObjectEntity().includePath(path, context); } render( diff --git a/src/ast/nodes/ObjectPattern.ts b/src/ast/nodes/ObjectPattern.ts index dba5598e000..a5c7e63303a 100644 --- a/src/ast/nodes/ObjectPattern.ts +++ b/src/ast/nodes/ObjectPattern.ts @@ -95,6 +95,10 @@ export default class ObjectPattern extends NodeBase implements DeclarationPatter return (this.included ||= included); } + includeNode() { + this.included = true; + } + markDeclarationReached(): void { for (const property of this.properties) { property.markDeclarationReached(); diff --git a/src/ast/nodes/Program.ts b/src/ast/nodes/Program.ts index 0079db695e1..e06829e77d6 100644 --- a/src/ast/nodes/Program.ts +++ b/src/ast/nodes/Program.ts @@ -10,7 +10,6 @@ import { } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { createHasEffectsContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type IncludeChildren, NodeBase, type StatementNode } from './shared/Node'; @@ -50,19 +49,19 @@ export default class Program extends NodeBase { return false; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) { - node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + node.include(context, includeChildrenRecursively); } } } + includeNode() { + this.included = true; + } + initialise() { super.initialise(); if (this.invalidAnnotations) diff --git a/src/ast/nodes/Property.ts b/src/ast/nodes/Property.ts index b71f96a9be4..45823e59a63 100644 --- a/src/ast/nodes/Property.ts +++ b/src/ast/nodes/Property.ts @@ -3,7 +3,7 @@ import type { RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { createHasEffectsContext } from '../ExecutionContext'; import type { ObjectPath } from '../utils/PathTracker'; -import { EMPTY_PATH, UnknownKey } from '../utils/PathTracker'; +import { UnknownKey } from '../utils/PathTracker'; import type LocalVariable from '../variables/LocalVariable'; import Identifier from './Identifier'; import type Literal from './Literal'; @@ -82,7 +82,7 @@ export default class Property extends MethodBase implements DeclarationPatternNo (this.value as PatternNode).includeDestructuredIfNecessary(context, path, init) || this.included; if ((included ||= this.key.hasEffects(createHasEffectsContext()))) { - this.key.includePath(EMPTY_PATH, context, false); + this.key.include(context, false); if (!this.value.included) { this.value.included = true; // Unfortunately, we need to include the value again now, so that any @@ -93,14 +93,19 @@ export default class Property extends MethodBase implements DeclarationPatternNo return (this.included = included); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + if (!this.included) this.includeNode(); + this.key.include(context, includeChildrenRecursively); + this.value.include(context, includeChildrenRecursively); + } + + includeNode() { this.included = true; - this.key.includePath(EMPTY_PATH, context, includeChildrenRecursively); - this.value.includePath(path, context, includeChildrenRecursively); + } + + includePath(path: ObjectPath, context: InclusionContext) { + if (!this.included) this.includeNode(); + this.value.includePath(path, context); } markDeclarationReached(): void { diff --git a/src/ast/nodes/RestElement.ts b/src/ast/nodes/RestElement.ts index 02148edbe6d..76ed31ab6ef 100644 --- a/src/ast/nodes/RestElement.ts +++ b/src/ast/nodes/RestElement.ts @@ -81,15 +81,15 @@ export default class RestElement extends NodeBase implements DeclarationPatternN ) || this.included); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + if (!this.included) this.includeNode(); // This should just include the identifier, its properties should be // included where the variable is used. - this.argument.includePath(EMPTY_PATH, context, includeChildrenRecursively); + this.argument.include(context, includeChildrenRecursively); + } + + includeNode() { + this.included = true; } markDeclarationReached(): void { diff --git a/src/ast/nodes/ReturnStatement.ts b/src/ast/nodes/ReturnStatement.ts index 6f3d08a4147..801bdf63f44 100644 --- a/src/ast/nodes/ReturnStatement.ts +++ b/src/ast/nodes/ReturnStatement.ts @@ -1,7 +1,6 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; @@ -16,13 +15,9 @@ export default class ReturnStatement extends StatementBase { return false; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.argument?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); + this.argument?.include(context, includeChildrenRecursively); context.brokenFlow = true; } diff --git a/src/ast/nodes/SequenceExpression.ts b/src/ast/nodes/SequenceExpression.ts index a753b227ce4..0c36c27ea52 100644 --- a/src/ast/nodes/SequenceExpression.ts +++ b/src/ast/nodes/SequenceExpression.ts @@ -67,23 +67,29 @@ export default class SequenceExpression extends NodeBase { ); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); const lastExpression = this.expressions[this.expressions.length - 1]; for (const expression of this.expressions) { if ( includeChildrenRecursively || (expression === lastExpression && !(this.parent instanceof ExpressionStatement)) || expression.shouldBeIncluded(context) - ) - expression.includePath(path, context, includeChildrenRecursively); + ) { + expression.include(context, includeChildrenRecursively); + } } } + includeNode() { + this.included = true; + } + + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.included) this.includeNode(); + this.expressions[this.expressions.length - 1].includePath(path, context); + } + removeAnnotations(code: MagicString) { this.expressions[0].removeAnnotations(code); } diff --git a/src/ast/nodes/StaticBlock.ts b/src/ast/nodes/StaticBlock.ts index ff087897749..932365772a3 100644 --- a/src/ast/nodes/StaticBlock.ts +++ b/src/ast/nodes/StaticBlock.ts @@ -7,7 +7,6 @@ import { import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import * as NodeType from './NodeType'; import { type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; @@ -26,18 +25,18 @@ export default class StaticBlock extends StatementBase { return false; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) - node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + node.include(context, includeChildrenRecursively); } } + includeNode() { + this.included = true; + } + render(code: MagicString, options: RenderOptions): void { if (this.body.length > 0) { const bodyStartPos = diff --git a/src/ast/nodes/Super.ts b/src/ast/nodes/Super.ts index 470d4cac363..8cd486ac318 100644 --- a/src/ast/nodes/Super.ts +++ b/src/ast/nodes/Super.ts @@ -1,6 +1,7 @@ import type { InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { NodeBase } from './shared/Node'; @@ -25,12 +26,12 @@ export default class Super extends NodeBase { this.variable.deoptimizePath(path); } - includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) { - this.included = true; - this.scope.context.includeVariableInModule(this.variable, path); - } else if (path.length > 0) { - this.variable.includePath(path, context); - } + include(context: InclusionContext): void { + if (!this.included) this.includeNode(context); + } + + includeNode(context: InclusionContext) { + this.included = true; + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } } diff --git a/src/ast/nodes/SwitchCase.ts b/src/ast/nodes/SwitchCase.ts index 3437460b7b5..a48d729e7d3 100644 --- a/src/ast/nodes/SwitchCase.ts +++ b/src/ast/nodes/SwitchCase.ts @@ -6,7 +6,6 @@ import { renderStatementList } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, @@ -30,19 +29,19 @@ export default class SwitchCase extends NodeBase { return false; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.test?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); + this.test?.include(context, includeChildrenRecursively); for (const node of this.consequent) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) - node.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + node.include(context, includeChildrenRecursively); } } + includeNode() { + this.included = true; + } + render(code: MagicString, options: RenderOptions, nodeRenderOptions?: NodeRenderOptions): void { if (this.consequent.length > 0) { if (this.test) { diff --git a/src/ast/nodes/SwitchStatement.ts b/src/ast/nodes/SwitchStatement.ts index 490fb6b10a9..8d0d36014fd 100644 --- a/src/ast/nodes/SwitchStatement.ts +++ b/src/ast/nodes/SwitchStatement.ts @@ -7,11 +7,10 @@ import { } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; -import type SwitchCase from './SwitchCase'; import type { ExpressionNode, GenericEsTreeNode, IncludeChildren } from './shared/Node'; import { StatementBase } from './shared/Node'; +import type SwitchCase from './SwitchCase'; export default class SwitchStatement extends StatementBase { declare cases: readonly SwitchCase[]; @@ -47,13 +46,9 @@ export default class SwitchStatement extends StatementBase { return false; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.discriminant.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); + this.discriminant.include(context, includeChildrenRecursively); const { brokenFlow, hasBreak } = context; context.hasBreak = false; let onlyHasBrokenFlow = true; @@ -71,7 +66,7 @@ export default class SwitchStatement extends StatementBase { isCaseIncluded = switchCase.hasEffects(hasEffectsContext); } if (isCaseIncluded) { - switchCase.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + switchCase.include(context, includeChildrenRecursively); onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak; context.hasBreak = false; context.brokenFlow = brokenFlow; @@ -85,6 +80,10 @@ export default class SwitchStatement extends StatementBase { context.hasBreak = hasBreak; } + includeNode() { + this.included = true; + } + initialise(): void { super.initialise(); for (let caseIndex = 0; caseIndex < this.cases.length; caseIndex++) { diff --git a/src/ast/nodes/TaggedTemplateExpression.ts b/src/ast/nodes/TaggedTemplateExpression.ts index 9478cbde0b5..7108e955524 100644 --- a/src/ast/nodes/TaggedTemplateExpression.ts +++ b/src/ast/nodes/TaggedTemplateExpression.ts @@ -4,8 +4,8 @@ import { logCannotCallNamespace } from '../../utils/logs'; import { type RenderOptions } from '../../utils/renderHelpers'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { INTERACTION_CALLED } from '../NodeInteractions'; -import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; -import { EMPTY_PATH, SHARED_RECURSION_TRACKER, UNKNOWN_PATH } from '../utils/PathTracker'; +import type { EntityPathTracker } from '../utils/PathTracker'; +import { EMPTY_PATH, SHARED_RECURSION_TRACKER } from '../utils/PathTracker'; import type Identifier from './Identifier'; import MemberExpression from './MemberExpression'; import * as NodeType from './NodeType'; @@ -44,26 +44,27 @@ export default class TaggedTemplateExpression extends CallExpressionBase { ); } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); + if (!this.included) this.includeNode(); if (includeChildrenRecursively) { - super.includePath(path, context, includeChildrenRecursively); + super.include(context, includeChildrenRecursively); } else { this.included = true; - this.tag.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - this.quasi.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.tag.include(context, includeChildrenRecursively); + this.quasi.include(context, includeChildrenRecursively); } this.tag.includeCallArguments(context, this.interaction); const [returnExpression] = this.getReturnExpression(); if (!returnExpression.included) { - returnExpression.includePath(UNKNOWN_PATH, context, false); + returnExpression.include(context, false); } } + includeNode() { + this.included = true; + } + initialise(): void { super.initialise(); this.args = [UNKNOWN_EXPRESSION, ...this.quasi.expressions]; diff --git a/src/ast/nodes/TemplateElement.ts b/src/ast/nodes/TemplateElement.ts index 1489655d43f..3f894d0280c 100644 --- a/src/ast/nodes/TemplateElement.ts +++ b/src/ast/nodes/TemplateElement.ts @@ -23,10 +23,6 @@ export default class TemplateElement extends NodeBase { return false; } - includePath(): void { - this.included = true; - } - parseNode(esTreeNode: GenericEsTreeNode): this { this.value = esTreeNode.value; return super.parseNode(esTreeNode); diff --git a/src/ast/nodes/ThisExpression.ts b/src/ast/nodes/ThisExpression.ts index 371d0a87a22..dac38cc4bb1 100644 --- a/src/ast/nodes/ThisExpression.ts +++ b/src/ast/nodes/ThisExpression.ts @@ -6,6 +6,7 @@ import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import ModuleScope from '../scopes/ModuleScope'; import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { NodeBase } from './shared/Node'; @@ -42,10 +43,19 @@ export default class ThisExpression extends NodeBase { return this.variable.hasEffectsOnInteractionAtPath(path, interaction, context); } + include(context: InclusionContext): void { + if (!this.included) this.includeNode(context); + } + + includeNode(context: InclusionContext) { + this.included = true; + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); + } + includePath(path: ObjectPath, context: InclusionContext): void { if (!this.included) { this.included = true; - this.scope.context.includeVariableInModule(this.variable, path); + this.scope.context.includeVariableInModule(this.variable, path, context); } else if (path.length > 0) { this.variable.includePath(path, context); } diff --git a/src/ast/nodes/ThrowStatement.ts b/src/ast/nodes/ThrowStatement.ts index 7b64de077c4..3083671d652 100644 --- a/src/ast/nodes/ThrowStatement.ts +++ b/src/ast/nodes/ThrowStatement.ts @@ -1,7 +1,6 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; import { type InclusionContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; @@ -13,13 +12,9 @@ export default class ThrowStatement extends StatementBase { return true; } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.argument.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); + this.argument.include(context, includeChildrenRecursively); context.brokenFlow = true; } diff --git a/src/ast/nodes/TryStatement.ts b/src/ast/nodes/TryStatement.ts index 76fdfa4b6a6..3f6462dbcdb 100644 --- a/src/ast/nodes/TryStatement.ts +++ b/src/ast/nodes/TryStatement.ts @@ -1,6 +1,5 @@ import type { NormalizedTreeshakingOptions } from '../../rollup/types'; import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type BlockStatement from './BlockStatement'; import type CatchClause from './CatchClause'; import type * as NodeType from './NodeType'; @@ -23,20 +22,15 @@ export default class TryStatement extends StatementBase { ); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { const tryCatchDeoptimization = ( this.scope.context.options.treeshake as NormalizedTreeshakingOptions )?.tryCatchDeoptimization; const { brokenFlow, includedLabels } = context; if (!this.directlyIncluded || !tryCatchDeoptimization) { - this.included = true; + if (!this.included) this.includeNode(context); this.directlyIncluded = true; - this.block.includePath( - UNKNOWN_PATH, + this.block.include( context, tryCatchDeoptimization ? INCLUDE_PARAMETERS : includeChildrenRecursively ); @@ -50,9 +44,9 @@ export default class TryStatement extends StatementBase { } } if (this.handler !== null) { - this.handler.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.handler.include(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } - this.finalizer?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.finalizer?.include(context, includeChildrenRecursively); } } diff --git a/src/ast/nodes/UnknownNode.ts b/src/ast/nodes/UnknownNode.ts index 112eb1269c8..60ebf1360f4 100644 --- a/src/ast/nodes/UnknownNode.ts +++ b/src/ast/nodes/UnknownNode.ts @@ -1,5 +1,4 @@ import type { InclusionContext } from '../ExecutionContext'; -import type { ObjectPath } from '../utils/PathTracker'; import { NodeBase } from './shared/Node'; export default class UnknownNode extends NodeBase { @@ -7,7 +6,7 @@ export default class UnknownNode extends NodeBase { return true; } - includePath(path: ObjectPath, context: InclusionContext): void { - super.includePath(path, context, true); + include(context: InclusionContext): void { + super.include(context, true); } } diff --git a/src/ast/nodes/UpdateExpression.ts b/src/ast/nodes/UpdateExpression.ts index 1ef952bbd81..2d93d67b620 100644 --- a/src/ast/nodes/UpdateExpression.ts +++ b/src/ast/nodes/UpdateExpression.ts @@ -31,16 +31,16 @@ export default class UpdateExpression extends NodeBase { return path.length > 1 || type !== INTERACTION_ACCESSED; } - includePath( - _: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { if (!this.deoptimized) this.applyDeoptimizations(); - this.included = true; + if (!this.included) this.includeNode(); this.argument.includeAsAssignmentTarget(context, includeChildrenRecursively, true); } + includeNode() { + this.included = true; + } + initialise() { super.initialise(); this.argument.setAssignedValue(UNKNOWN_EXPRESSION); diff --git a/src/ast/nodes/VariableDeclaration.ts b/src/ast/nodes/VariableDeclaration.ts index 89be6e470c1..0c5e0d96d01 100644 --- a/src/ast/nodes/VariableDeclaration.ts +++ b/src/ast/nodes/VariableDeclaration.ts @@ -14,17 +14,16 @@ import { } from '../../utils/systemJsRendering'; import { treeshakeNode } from '../../utils/treeshakeNode'; import type { InclusionContext } from '../ExecutionContext'; -import type { ObjectPath } from '../utils/PathTracker'; -import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; +import { EMPTY_PATH } from '../utils/PathTracker'; import type Variable from '../variables/Variable'; import ArrayPattern from './ArrayPattern'; import Identifier, { type IdentifierWithVariable } from './Identifier'; import * as NodeType from './NodeType'; import ObjectPattern from './ObjectPattern'; -import type VariableDeclarator from './VariableDeclarator'; import type { InclusionOptions } from './shared/Expression'; import { type IncludeChildren, NodeBase } from './shared/Node'; import type { VariableDeclarationKind } from './shared/VariableKinds'; +import type VariableDeclarator from './VariableDeclarator'; function areAllDeclarationsIncludedAndNotExported( declarations: readonly VariableDeclarator[], @@ -59,19 +58,19 @@ export default class VariableDeclaration extends NodeBase { return false; } - includePath( - _path: ObjectPath, + include( context: InclusionContext, includeChildrenRecursively: IncludeChildren, { asSingleStatement }: InclusionOptions = BLANK ): void { - this.included = true; + if (!this.included) this.includeNode(); for (const declarator of this.declarations) { - if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) - declarator.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) { + declarator.include(context, includeChildrenRecursively); + } const { id, init } = declarator; if (asSingleStatement) { - id.includePath(EMPTY_PATH, context, includeChildrenRecursively); + id.include(context, includeChildrenRecursively); } if ( init && @@ -79,11 +78,15 @@ export default class VariableDeclaration extends NodeBase { !init.included && (id instanceof ObjectPattern || id instanceof ArrayPattern) ) { - init.includePath(EMPTY_PATH, context, includeChildrenRecursively); + init.include(context, includeChildrenRecursively); } } } + includeNode() { + this.included = true; + } + initialise(): void { super.initialise(); this.isUsingDeclaration = this.kind === 'await using' || this.kind === 'using'; diff --git a/src/ast/nodes/VariableDeclarator.ts b/src/ast/nodes/VariableDeclarator.ts index f48a97737e0..1c0288bf509 100644 --- a/src/ast/nodes/VariableDeclarator.ts +++ b/src/ast/nodes/VariableDeclarator.ts @@ -46,23 +46,23 @@ export default class VariableDeclarator extends NodeBase { ); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { const { deoptimized, id, init } = this; if (!deoptimized) this.applyDeoptimizations(); - this.included = true; - init?.includePath(EMPTY_PATH, context, includeChildrenRecursively); + if (!this.included) this.includeNode(); + init?.include(context, includeChildrenRecursively); id.markDeclarationReached(); if (includeChildrenRecursively) { - id.includePath(EMPTY_PATH, context, includeChildrenRecursively); + id.include(context, includeChildrenRecursively); } else { id.includeDestructuredIfNecessary(context, EMPTY_PATH, init || UNDEFINED_EXPRESSION); } } + includeNode() { + this.included = true; + } + removeAnnotations(code: MagicString) { this.init?.removeAnnotations(code); } diff --git a/src/ast/nodes/WhileStatement.ts b/src/ast/nodes/WhileStatement.ts index 65f1a8506c8..55818b63788 100644 --- a/src/ast/nodes/WhileStatement.ts +++ b/src/ast/nodes/WhileStatement.ts @@ -1,13 +1,12 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; -import { type ObjectPath, UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; +import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; -import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; export default class WhileStatement extends StatementBase { declare body: StatementNode; @@ -19,13 +18,13 @@ export default class WhileStatement extends StatementBase { return hasLoopBodyEffects(context, this.body); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - this.included = true; - this.test.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(); + this.test.include(context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } + + includeNode() { + this.included = true; + } } diff --git a/src/ast/nodes/shared/ClassNode.ts b/src/ast/nodes/shared/ClassNode.ts index abf9ff26e0b..bad31aa39b8 100644 --- a/src/ast/nodes/shared/ClassNode.ts +++ b/src/ast/nodes/shared/ClassNode.ts @@ -1,9 +1,5 @@ import type { DeoptimizableEntity } from '../../DeoptimizableEntity'; -import { - createInclusionContext, - type HasEffectsContext, - type InclusionContext -} from '../../ExecutionContext'; +import { type HasEffectsContext, type InclusionContext } from '../../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteractions'; import { INTERACTION_CALLED } from '../../NodeInteractions'; import ChildScope from '../../scopes/ChildScope'; @@ -103,20 +99,15 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { : this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context); } - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); - this.included = true; - this.superClass?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - this.body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); - for (const decorator of this.decorators) - decorator.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + if (!this.included) this.includeNode(context); + this.superClass?.include(context, includeChildrenRecursively); + this.body.include(context, includeChildrenRecursively); + for (const decorator of this.decorators) decorator.include(context, includeChildrenRecursively); if (this.id) { this.id.markDeclarationReached(); - this.id.includePath(UNKNOWN_PATH, createInclusionContext()); + this.id.include(context); } } diff --git a/src/ast/nodes/shared/Expression.ts b/src/ast/nodes/shared/Expression.ts index 5496e953ef2..7cd16f32ff2 100644 --- a/src/ast/nodes/shared/Expression.ts +++ b/src/ast/nodes/shared/Expression.ts @@ -77,18 +77,30 @@ export class ExpressionEntity implements WritableEntity { return true; } - includePath( - _path: ObjectPath, - _context: InclusionContext, + include( + context: InclusionContext, _includeChildrenRecursively: IncludeChildren, _options?: InclusionOptions ): void { + if (!this.included) this.includeNode(context); + } + + includeNode(_context: InclusionContext): void { this.included = true; } + includePath(_path: ObjectPath, context: InclusionContext): void { + if (!this.included) this.includeNode(context); + } + /* We are both including and including an unknown path here as the former + * ensures that nested nodes are included while the latter ensures that all + * paths of the expression are included. + * */ + includeCallArguments(context: InclusionContext, interaction: NodeInteractionCalled): void { for (const argument of interaction.args) { - argument?.includePath(UNKNOWN_PATH, context, false); + argument?.includePath(UNKNOWN_PATH, context); + argument?.include(context, false); } } diff --git a/src/ast/nodes/shared/FunctionBase.ts b/src/ast/nodes/shared/FunctionBase.ts index 5f363b6e6bb..47f2ece1445 100644 --- a/src/ast/nodes/shared/FunctionBase.ts +++ b/src/ast/nodes/shared/FunctionBase.ts @@ -187,23 +187,24 @@ export default abstract class FunctionBase extends NodeBase { private parameterVariableValuesDeoptimized = false; - includePath( - _path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!(this.parameterVariableValuesDeoptimized || this.onlyFunctionCallUsed())) { this.parameterVariableValuesDeoptimized = true; this.scope.reassignAllParameters(); } if (!this.deoptimized) this.applyDeoptimizations(); - this.included = true; + if (!this.included) this.includeNode(context); const { brokenFlow } = context; context.brokenFlow = false; - this.body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.body.include(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } + includeNode(context: InclusionContext) { + this.included = true; + this.body.includePath(UNKNOWN_PATH, context); + } + includeCallArguments = this.scope.includeCallArguments.bind(this.scope); initialise(): void { diff --git a/src/ast/nodes/shared/FunctionNode.ts b/src/ast/nodes/shared/FunctionNode.ts index 0ffa1225e96..766936ff4cb 100644 --- a/src/ast/nodes/shared/FunctionNode.ts +++ b/src/ast/nodes/shared/FunctionNode.ts @@ -1,8 +1,4 @@ -import { - createInclusionContext, - type HasEffectsContext, - type InclusionContext -} from '../../ExecutionContext'; +import { type HasEffectsContext, type InclusionContext } from '../../ExecutionContext'; import type { NodeInteraction } from '../../NodeInteractions'; import { INTERACTION_CALLED } from '../../NodeInteractions'; import type ChildScope from '../../scopes/ChildScope'; @@ -98,17 +94,23 @@ export default class FunctionNode extends FunctionBase { return false; } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ): void { - super.includePath(path, context, includeChildrenRecursively); - this.id?.includePath(UNKNOWN_PATH, createInclusionContext()); + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + super.include(context, includeChildrenRecursively); + this.id?.include(context); + const hasArguments = this.scope.argumentsVariable.included; + for (const parameter of this.params) { + if (!(parameter instanceof Identifier) || hasArguments) { + parameter.include(context, includeChildrenRecursively); + } + } + } + + includeNode(context: InclusionContext) { + super.includeNode(context); const hasArguments = this.scope.argumentsVariable.included; for (const parameter of this.params) { if (!(parameter instanceof Identifier) || hasArguments) { - parameter.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + parameter.includePath(UNKNOWN_PATH, context); } } } diff --git a/src/ast/nodes/shared/IdentifierBase.ts b/src/ast/nodes/shared/IdentifierBase.ts index 72241cc67cb..5043153ee0f 100644 --- a/src/ast/nodes/shared/IdentifierBase.ts +++ b/src/ast/nodes/shared/IdentifierBase.ts @@ -127,12 +127,23 @@ export default class IdentifierBase extends NodeBase { } } - includePath(path: ObjectPath, context: InclusionContext): void { + include(context: InclusionContext): void { if (!this.deoptimized) this.applyDeoptimizations(); + if (!this.included) this.includeNode(context); + } + + includeNode(context: InclusionContext) { + this.included = true; + if (this.variable !== null) { + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); + } + } + + includePath(path: ObjectPath, context: InclusionContext): void { if (!this.included) { this.included = true; if (this.variable !== null) { - this.scope.context.includeVariableInModule(this.variable, path); + this.scope.context.includeVariableInModule(this.variable, path, context); } } else if (path.length > 0) { this.variable?.includePath(path, context); diff --git a/src/ast/nodes/shared/JSXElementBase.ts b/src/ast/nodes/shared/JSXElementBase.ts index ee2f85cd7ec..ae4e7e6532f 100644 --- a/src/ast/nodes/shared/JSXElementBase.ts +++ b/src/ast/nodes/shared/JSXElementBase.ts @@ -3,7 +3,6 @@ import type { NormalizedJsxOptions } from '../../../rollup/types'; import { getRenderedJsxChildren } from '../../../utils/jsx'; import type { RenderOptions } from '../../../utils/renderHelpers'; import type { InclusionContext } from '../../ExecutionContext'; -import type { ObjectPath } from '../../utils/PathTracker'; import type Variable from '../../variables/Variable'; import JSXEmptyExpression from '../JSXEmptyExpression'; import JSXExpressionContainer from '../JSXExpressionContainer'; @@ -27,24 +26,26 @@ export default class JSXElementBase extends NodeBase { } } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { - if (!this.included) { - const { factory, importSource, mode } = this.jsxMode; - if (factory) { - this.factory = factory; - this.factoryVariable = getAndIncludeFactoryVariable( - factory, - mode === 'preserve', - importSource, - this - ); - } + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + if (!this.included) this.includeNode(context); + for (const child of this.children) { + child.include(context, includeChildrenRecursively); + } + } + + includeNode(context: InclusionContext) { + super.includeNode(context); + const { factory, importSource, mode } = this.jsxMode; + if (factory) { + this.factory = factory; + this.factoryVariable = getAndIncludeFactoryVariable( + factory, + mode === 'preserve', + importSource, + this, + context + ); } - super.includePath(path, context, includeChildrenRecursively); } protected applyDeoptimizations() {} diff --git a/src/ast/nodes/shared/Node.ts b/src/ast/nodes/shared/Node.ts index 44429b37cb0..bf0931b3b75 100644 --- a/src/ast/nodes/shared/Node.ts +++ b/src/ast/nodes/shared/Node.ts @@ -78,24 +78,29 @@ export interface Node extends Entity { hasEffectsAsAssignmentTarget(context: HasEffectsContext, checkAccess: boolean): boolean; /** - * Includes the given path of the Node in the bundle. If - * "includeChildrenRecursively" is true, children of this path are included - * unconditionally. Otherwise, including a given path means that the value of - * this path is needed, but not necessarily its children if it is an object. - * Example: - * if (x.a.b) { ... } - * would include the path ['a','b'] of the variable x but none of its children - * because those are not needed to get the literal value. - * On the other hand to include all children, we extend the path with - * "UnknownNode". + * Includes the node in the bundle. If the flag is not set, children are + * usually included if they are necessary for this node (e.g. a function body) + * or if they have effects. Necessary variables need to be included as well. + * This is called repeatedly for each tree-shaking pass. */ - includePath( - path: ObjectPath, + include( context: InclusionContext, includeChildrenRecursively: IncludeChildren, options?: InclusionOptions ): void; + /** + * Includes this node for the first time in the bundle and ensures that all + * paths that this node relies on are included as well. Does not include + * child nodes by default, though. + */ + includeNode(context: InclusionContext): void; + + /** + * Explicitly include a path of this Node. + */ + includePath(path: ObjectPath, context: InclusionContext): void; + /** * Special version of include for assignment left-hand sides which ensures * that accessors are handled correctly. This is necessary to do from the @@ -229,23 +234,39 @@ export class NodeBase extends ExpressionEntity implements ExpressionNode { ); } - includePath( - _path: ObjectPath, + include( context: InclusionContext, includeChildrenRecursively: IncludeChildren, _options?: InclusionOptions ): void { if (!this.deoptimized) this.applyDeoptimizations(); + if (!this.included) this.includeNode(context); + for (const key of childNodeKeys[this.type]) { + const value = (this as GenericEsTreeNode)[key]; + if (value === null) continue; + if (Array.isArray(value)) { + for (const child of value) { + child?.include(context, includeChildrenRecursively); + } + } else { + value.include(context, includeChildrenRecursively); + } + } + } + + includeNode(context: InclusionContext) { + // TODO Lukas remove + // console.log('NodeBase.includeNode', this.type, logNode(this)); this.included = true; for (const key of childNodeKeys[this.type]) { const value = (this as GenericEsTreeNode)[key]; if (value === null) continue; if (Array.isArray(value)) { for (const child of value) { - child?.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + child?.includePath(UNKNOWN_PATH, context); } } else { - value.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + value.includePath(UNKNOWN_PATH, context); } } } @@ -255,7 +276,7 @@ export class NodeBase extends ExpressionEntity implements ExpressionNode { includeChildrenRecursively: IncludeChildren, _deoptimizeAccess: boolean ) { - this.includePath(UNKNOWN_PATH, context, includeChildrenRecursively); + this.include(context, includeChildrenRecursively); } /** diff --git a/src/ast/nodes/shared/ObjectEntity.ts b/src/ast/nodes/shared/ObjectEntity.ts index 090cae740f3..b96741051dd 100644 --- a/src/ast/nodes/shared/ObjectEntity.ts +++ b/src/ast/nodes/shared/ObjectEntity.ts @@ -4,7 +4,6 @@ import type { NodeInteraction, NodeInteractionCalled } from '../../NodeInteracti import { INTERACTION_ACCESSED, INTERACTION_CALLED } from '../../NodeInteractions'; import type { EntityPathTracker, ObjectPath, ObjectPathKey } from '../../utils/PathTracker'; import { - EMPTY_PATH, UNKNOWN_INTEGER_PATH, UNKNOWN_PATH, UnknownInteger, @@ -352,38 +351,36 @@ export class ObjectEntity extends ExpressionEntity { return false; } - includePath( - path: ObjectPath, - context: InclusionContext, - includeChildrenRecursively: IncludeChildren - ) { + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { this.included = true; - const [key, ...subPath] = path; - if (key == null || includeChildrenRecursively) { - for (const property of this.allProperties) { - if (includeChildrenRecursively || property.shouldBeIncluded(context)) { - property.includePath(EMPTY_PATH, context, includeChildrenRecursively); - } + for (const property of this.allProperties) { + if (includeChildrenRecursively || property.shouldBeIncluded(context)) { + property.include(context, includeChildrenRecursively); } - this.prototypeExpression?.includePath(EMPTY_PATH, context, includeChildrenRecursively); - } else { - const [includedMembers, includedPath] = - typeof key === 'string' - ? [ - [ - ...new Set([ - ...(this.propertiesAndGettersByKey[key] || this.unmatchablePropertiesAndGetters), - ...(this.propertiesAndSettersByKey[key] || this.unmatchablePropertiesAndSetters) - ]) - ], - subPath - ] - : [this.allProperties, UNKNOWN_PATH]; - for (const property of includedMembers) { - property.includePath(includedPath, context, includeChildrenRecursively); - } - this.prototypeExpression?.includePath(path, context, includeChildrenRecursively); } + this.prototypeExpression?.include(context, includeChildrenRecursively); + } + + includePath(path: ObjectPath, context: InclusionContext) { + this.included = true; + if (path.length === 0) return; + const [key, ...subPath] = path; + const [includedMembers, includedPath] = + typeof key === 'string' + ? [ + [ + ...new Set([ + ...(this.propertiesAndGettersByKey[key] || this.unmatchablePropertiesAndGetters), + ...(this.propertiesAndSettersByKey[key] || this.unmatchablePropertiesAndSetters) + ]) + ], + subPath + ] + : [this.allProperties, UNKNOWN_PATH]; + for (const property of includedMembers) { + property.includePath(includedPath, context); + } + this.prototypeExpression?.includePath(path, context); } private buildPropertyMaps(properties: readonly ObjectProperty[]): void { diff --git a/src/ast/nodes/shared/Pattern.ts b/src/ast/nodes/shared/Pattern.ts index 4591bf46e30..040f5403fe7 100644 --- a/src/ast/nodes/shared/Pattern.ts +++ b/src/ast/nodes/shared/Pattern.ts @@ -21,6 +21,8 @@ export interface PatternNode extends WritableEntity, Node { destructuredInitPath: ObjectPath, init: ExpressionEntity ): boolean; + + includePath(path: ObjectPath, context: InclusionContext): void; } export interface DeclarationPatternNode extends PatternNode { diff --git a/src/ast/nodes/shared/jsxHelpers.ts b/src/ast/nodes/shared/jsxHelpers.ts index f90376e8228..5a840d22d43 100644 --- a/src/ast/nodes/shared/jsxHelpers.ts +++ b/src/ast/nodes/shared/jsxHelpers.ts @@ -1,4 +1,4 @@ -import { createInclusionContext } from '../../ExecutionContext'; +import type { InclusionContext } from '../../ExecutionContext'; import { UNKNOWN_PATH } from '../../utils/PathTracker'; import LocalVariable from '../../variables/LocalVariable'; import type Variable from '../../variables/Variable'; @@ -24,7 +24,8 @@ export function getAndIncludeFactoryVariable( factory: string, preserve: boolean, importSource: string | null, - node: JSXElementBase | JSXOpeningElement | JSXOpeningFragment + node: JSXElementBase | JSXOpeningElement | JSXOpeningFragment, + context: InclusionContext ): Variable { const [baseName, nestedName] = factory.split('.'); let factoryVariable: Variable; @@ -37,14 +38,14 @@ export function getAndIncludeFactoryVariable( if (preserve) { // This pretends we are accessing an included global variable of the same name const globalVariable = node.scope.findGlobal(baseName); - globalVariable.includePath(UNKNOWN_PATH, createInclusionContext()); + globalVariable.includePath(UNKNOWN_PATH, context); // This excludes this variable from renaming factoryVariable.globalName = baseName; } } else { factoryVariable = node.scope.findGlobal(baseName); } - node.scope.context.includeVariableInModule(factoryVariable, UNKNOWN_PATH); + node.scope.context.includeVariableInModule(factoryVariable, UNKNOWN_PATH, context); if (factoryVariable instanceof LocalVariable) { factoryVariable.consolidateInitializers(); factoryVariable.addUsedPlace(node); diff --git a/src/ast/nodes/shared/loops.ts b/src/ast/nodes/shared/loops.ts index 0782260def7..dcc2dc6b41d 100644 --- a/src/ast/nodes/shared/loops.ts +++ b/src/ast/nodes/shared/loops.ts @@ -1,5 +1,4 @@ import type { HasEffectsContext, InclusionContext } from '../../ExecutionContext'; -import { UNKNOWN_PATH } from '../../utils/PathTracker'; import type { StatementNode } from './Node'; export function hasLoopBodyEffects(context: HasEffectsContext, body: StatementNode): boolean { @@ -26,7 +25,7 @@ export function includeLoopBody( const { brokenFlow, hasBreak, hasContinue } = context; context.hasBreak = false; context.hasContinue = false; - body.includePath(UNKNOWN_PATH, context, includeChildrenRecursively, { asSingleStatement: true }); + body.include(context, includeChildrenRecursively, { asSingleStatement: true }); context.hasBreak = hasBreak; context.hasContinue = hasContinue; context.brokenFlow = brokenFlow; diff --git a/src/ast/scopes/FunctionScope.ts b/src/ast/scopes/FunctionScope.ts index b6bbd6cefc7..2898841f447 100644 --- a/src/ast/scopes/FunctionScope.ts +++ b/src/ast/scopes/FunctionScope.ts @@ -27,7 +27,11 @@ export default class FunctionScope extends ReturnValueScope { if (this.argumentsVariable.included) { const { args } = interaction; for (let argumentIndex = 1; argumentIndex < args.length; argumentIndex++) { - args[argumentIndex]?.includePath(UNKNOWN_PATH, context, false); + const argument = args[argumentIndex]; + if (argument) { + argument.includePath(UNKNOWN_PATH, context); + argument.include(context, false); + } } } } diff --git a/src/ast/scopes/ParameterScope.ts b/src/ast/scopes/ParameterScope.ts index de5ccdd74e4..82b5e4bd1c6 100644 --- a/src/ast/scopes/ParameterScope.ts +++ b/src/ast/scopes/ParameterScope.ts @@ -4,7 +4,7 @@ import type { NodeInteractionCalled } from '../NodeInteractions'; import type Identifier from '../nodes/Identifier'; import SpreadElement from '../nodes/SpreadElement'; import type { ObjectPath } from '../utils/PathTracker'; -import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import ParameterVariable from '../variables/ParameterVariable'; import CatchBodyScope from './CatchBodyScope'; import ChildScope from './ChildScope'; @@ -60,12 +60,14 @@ export default class ParameterScope extends ChildScope { // If there is a SpreadElement, we need to include all arguments after it // because we no longer know which argument corresponds to which parameter. for (let argumentIndex = 1; argumentIndex < args.length; argumentIndex++) { - if (args[argumentIndex] instanceof SpreadElement && !argumentIncluded) { + const argument = args[argumentIndex]; + if (argument instanceof SpreadElement && !argumentIncluded) { argumentIncluded = true; lastExplicitlyIncludedIndex = argumentIndex - 1; } if (argumentIncluded) { - args[argumentIndex]!.includePath(UNKNOWN_PATH, context, false); + argument!.includePath(UNKNOWN_PATH, context); + argument!.include(context, false); } } // Now we go backwards either starting from the last argument or before the @@ -86,8 +88,9 @@ export default class ParameterScope extends ChildScope { if (variable.included) { argumentIncluded = true; if (calledFromTryStatement) { - argument.includePath(UNKNOWN_PATH, context, true); + argument.include(context, true); } else { + argument.include(context, false); variable.includeArgumentPaths(argument, context); } } @@ -96,7 +99,7 @@ export default class ParameterScope extends ChildScope { } if (!argument.included && (argumentIncluded || argument.shouldBeIncluded(context))) { argumentIncluded = true; - argument.includePath(EMPTY_PATH, context, calledFromTryStatement); + argument.include(context, calledFromTryStatement); } } } diff --git a/src/ast/utils/PathTracker.ts b/src/ast/utils/PathTracker.ts index 3b70c4add12..e2eeff3b293 100644 --- a/src/ast/utils/PathTracker.ts +++ b/src/ast/utils/PathTracker.ts @@ -163,11 +163,11 @@ function includeAllPaths( currentPaths: IncludedPaths ): void { if (currentPaths[UnknownKey]) { - return entity.includePath([...basePath, UnknownKey], context, false); + return entity.includePath([...basePath, UnknownKey], context); } const keys = Object.keys(currentPaths); if (keys.length === 0) { - return entity.includePath(basePath, context, false); + return entity.includePath(basePath, context); } for (const key of keys) { includeAllPaths(entity, context, [...basePath, key], currentPaths[key]); diff --git a/src/ast/variables/LocalVariable.ts b/src/ast/variables/LocalVariable.ts index 97d262a4c2d..86133e360e6 100644 --- a/src/ast/variables/LocalVariable.ts +++ b/src/ast/variables/LocalVariable.ts @@ -23,7 +23,6 @@ import type { Node } from '../nodes/shared/Node'; import type { VariableKind } from '../nodes/shared/VariableKinds'; import { limitConcatenatedPathDepth, MAX_PATH_DEPTH } from '../utils/limitPathLength'; import { - EMPTY_PATH, type EntityPathTracker, IncludedPathTracker, type ObjectPath, @@ -206,21 +205,21 @@ export default class LocalVariable extends Variable { super.includePath(path, context); for (const declaration of this.declarations) { // If node is a default export, it can save a tree-shaking run to include the full declaration now - if (!declaration.included) declaration.includePath(EMPTY_PATH, context, false); + if (!declaration.included) declaration.include(context, false); let node = declaration.parent as Node; while (!node.included) { // We do not want to properly include parents in case they are part of a dead branch // in which case .include() might pull in more dead code - node.included = true; + node.includeNode(context); if (node.type === NodeType.Program) break; node = node.parent as Node; } } // We need to make sure we include the correct path of the init if (path.length > 0) { - this.init.includePath(limitConcatenatedPathDepth(this.initPath, path), context, false); + this.init.includePath(limitConcatenatedPathDepth(this.initPath, path), context); this.additionalInitializers?.forEach(initializer => - initializer.includePath(UNKNOWN_PATH, context, false) + initializer.includePath(UNKNOWN_PATH, context) ); } } @@ -235,7 +234,10 @@ export default class LocalVariable extends Variable { this.initPath.length > 0 ) { for (const argument of interaction.args) { - argument?.includePath(UNKNOWN_PATH, context, false); + if (argument) { + argument.includePath(UNKNOWN_PATH, context); + argument.include(context, false); + } } } else { context.includedCallArguments.add(this.init); diff --git a/src/ast/variables/SyntheticNamedExportVariable.ts b/src/ast/variables/SyntheticNamedExportVariable.ts index 685b4e78b3d..299d3a09676 100644 --- a/src/ast/variables/SyntheticNamedExportVariable.ts +++ b/src/ast/variables/SyntheticNamedExportVariable.ts @@ -48,7 +48,7 @@ export default class SyntheticNamedExportVariable extends Variable { includePath(path: ObjectPath, context: InclusionContext): void { super.includePath(path, context); - this.context.includeVariableInModule(this.syntheticNamespace, path); + this.context.includeVariableInModule(this.syntheticNamespace, path, context); } setRenderNames(baseName: string | null, name: string | null): void { diff --git a/test/form/samples/jsx/transpiles-empty-fragment/_expected.js b/test/form/samples/jsx/transpiles-empty-fragment/_expected.js index 5fd112f7f75..fd1687b4abe 100644 --- a/test/form/samples/jsx/transpiles-empty-fragment/_expected.js +++ b/test/form/samples/jsx/transpiles-empty-fragment/_expected.js @@ -1,3 +1,3 @@ -import { jsx, Fragment } from 'react/jsx-runtime'; +import { Fragment, jsx } from 'react/jsx-runtime'; console.log(/*#__PURE__*/jsx(Fragment, {})); diff --git a/test/form/samples/side-effect-default-reexport/_expected.js b/test/form/samples/side-effect-default-reexport/_expected.js index 6593edd35d0..4d9a62053eb 100644 --- a/test/form/samples/side-effect-default-reexport/_expected.js +++ b/test/form/samples/side-effect-default-reexport/_expected.js @@ -1,6 +1,5 @@ var Menu$1 = { - name: 'menu' -}; + }; var Item$2 = { name: 'item' @@ -13,8 +12,7 @@ Menu$1.Item1 = Item$2; Menu$1.Item2 = Item$2; var NamedExport = { - name: 'menu' -}; + }; var Item$1 = { name: 'item' From 070731f7a9386d048a0626bc00784b9f44a61ae5 Mon Sep 17 00:00:00 2001 From: TrickyPi <530257315@qq.com> Date: Sun, 8 Dec 2024 15:12:11 +0800 Subject: [PATCH 08/32] update test --- .../object-tree-shaking-issue-5734/_expected.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/form/samples/object-tree-shaking-issue-5734/_expected.js b/test/form/samples/object-tree-shaking-issue-5734/_expected.js index 48fb9b81a4a..46d40da7e35 100644 --- a/test/form/samples/object-tree-shaking-issue-5734/_expected.js +++ b/test/form/samples/object-tree-shaking-issue-5734/_expected.js @@ -16461,6 +16461,9 @@ class MySqlParser extends SQLParserBase { return localContext; } queryExpressionBody(_p) { + if (_p === undefined) { + _p = 0; + } let parentContext = this.context; let parentState = this.state; let localContext = new QueryExpressionBodyContext(this.context, parentState); @@ -16575,6 +16578,9 @@ class MySqlParser extends SQLParserBase { return localContext; } queryItem(_p) { + if (_p === undefined) { + _p = 0; + } let parentContext = this.context; let parentState = this.state; let localContext = new QueryItemContext(this.context, parentState); @@ -44195,6 +44201,9 @@ class MySqlParser extends SQLParserBase { return localContext; } expression(_p) { + if (_p === undefined) { + _p = 0; + } let parentContext = this.context; let parentState = this.state; let localContext = new ExpressionContext(this.context, parentState); @@ -44315,6 +44324,9 @@ class MySqlParser extends SQLParserBase { return localContext; } predicate(_p) { + if (_p === undefined) { + _p = 0; + } let parentContext = this.context; let parentState = this.state; let localContext = new PredicateContext(this.context, parentState); @@ -44598,6 +44610,9 @@ class MySqlParser extends SQLParserBase { return localContext; } expressionAtom(_p) { + if (_p === undefined) { + _p = 0; + } let parentContext = this.context; let parentState = this.state; let localContext = new ExpressionAtomContext(this.context, parentState); From 18056ebb6dbeb6565d356e6b4d8ba7a459eabb96 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 8 Dec 2024 17:25:06 +0100 Subject: [PATCH 09/32] Test if using a shared prototype function can improve performance --- src/ast/nodes/BlockStatement.ts | 16 ++++++++++------ src/ast/nodes/ConditionalExpression.ts | 12 +++++------- src/ast/nodes/ExportDefaultDeclaration.ts | 16 +++++++++------- src/ast/nodes/ExpressionStatement.ts | 8 +++----- src/ast/nodes/IfStatement.ts | 9 ++++----- src/ast/nodes/Literal.ts | 8 +++----- src/ast/nodes/LogicalExpression.ts | 15 +++++++++------ src/ast/nodes/ObjectPattern.ts | 8 +++----- src/ast/nodes/Program.ts | 10 ++++------ src/ast/nodes/Property.ts | 11 +++++------ src/ast/nodes/RestElement.ts | 10 ++++------ src/ast/nodes/SequenceExpression.ts | 17 ++++++++++------- src/ast/nodes/StaticBlock.ts | 15 +++++++++------ src/ast/nodes/SwitchCase.ts | 8 +++----- src/ast/nodes/SwitchStatement.ts | 10 ++++------ src/ast/nodes/TaggedTemplateExpression.ts | 9 ++++----- src/ast/nodes/UpdateExpression.ts | 10 ++++------ src/ast/nodes/VariableDeclaration.ts | 10 ++++------ src/ast/nodes/VariableDeclarator.ts | 15 +++++++++------ src/ast/nodes/WhileStatement.ts | 9 ++++----- src/ast/nodes/shared/Node.ts | 4 ++++ 21 files changed, 114 insertions(+), 116 deletions(-) diff --git a/src/ast/nodes/BlockStatement.ts b/src/ast/nodes/BlockStatement.ts index f96c743081e..7e48762cf6d 100644 --- a/src/ast/nodes/BlockStatement.ts +++ b/src/ast/nodes/BlockStatement.ts @@ -7,7 +7,13 @@ import ExpressionStatement from './ExpressionStatement'; import * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; -import { type IncludeChildren, type Node, StatementBase, type StatementNode } from './shared/Node'; +import { + type IncludeChildren, + type Node, + onlyIncludeSelf, + StatementBase, + type StatementNode +} from './shared/Node'; export default class BlockStatement extends StatementBase { declare body: readonly StatementNode[]; @@ -51,7 +57,7 @@ export default class BlockStatement extends StatementBase { include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!(this.deoptimizeBody && this.directlyIncluded)) { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.directlyIncluded = true; if (this.deoptimizeBody) includeChildrenRecursively = true; for (const node of this.body) { @@ -61,10 +67,6 @@ export default class BlockStatement extends StatementBase { } } - includeNode() { - this.included = true; - } - initialise(): void { super.initialise(); const firstBodyStatement = this.body[0]; @@ -81,3 +83,5 @@ export default class BlockStatement extends StatementBase { } } } + +BlockStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ConditionalExpression.ts b/src/ast/nodes/ConditionalExpression.ts index 9e9ec40f665..14a413b2497 100644 --- a/src/ast/nodes/ConditionalExpression.ts +++ b/src/ast/nodes/ConditionalExpression.ts @@ -19,7 +19,7 @@ import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expressio import { UnknownValue } from './shared/Expression'; import { MultiExpression } from './shared/MultiExpression'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ConditionalExpression extends NodeBase implements DeoptimizableEntity { declare alternate: ExpressionNode; @@ -142,7 +142,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); const usedBranch = this.getUsedBranch(); if (usedBranch === null || includeChildrenRecursively || this.test.shouldBeIncluded(context)) { this.test.include(context, includeChildrenRecursively); @@ -153,12 +153,8 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz } } - includeNode() { - this.included = true; - } - includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); const usedBranch = this.getUsedBranch(); if (usedBranch === null || this.test.shouldBeIncluded(context)) { this.consequent.includePath(path, context); @@ -235,3 +231,5 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz : (this.usedBranch = testValue ? this.consequent : this.alternate); } } + +ConditionalExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ExportDefaultDeclaration.ts b/src/ast/nodes/ExportDefaultDeclaration.ts index 36cf0ac7581..a3dd8a34e31 100644 --- a/src/ast/nodes/ExportDefaultDeclaration.ts +++ b/src/ast/nodes/ExportDefaultDeclaration.ts @@ -16,7 +16,12 @@ import ClassDeclaration from './ClassDeclaration'; import FunctionDeclaration from './FunctionDeclaration'; import type Identifier from './Identifier'; import * as NodeType from './NodeType'; -import { type ExpressionNode, type IncludeChildren, NodeBase } from './shared/Node'; +import { + type ExpressionNode, + type IncludeChildren, + NodeBase, + onlyIncludeSelf +} from './shared/Node'; // The header ends at the first non-white-space after "default" function getDeclarationStart(code: string, start: number): number { @@ -44,19 +49,15 @@ export default class ExportDefaultDeclaration extends NodeBase { declare private declarationName: string | undefined; include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.declaration.include(context, includeChildrenRecursively); if (includeChildrenRecursively) { this.scope.context.includeVariableInModule(this.variable, UNKNOWN_PATH, context); } } - includeNode() { - this.included = true; - } - includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.declaration.includePath(path, context); } @@ -181,3 +182,4 @@ export default class ExportDefaultDeclaration extends NodeBase { } ExportDefaultDeclaration.prototype.needsBoundaries = true; +ExportDefaultDeclaration.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ExpressionStatement.ts b/src/ast/nodes/ExpressionStatement.ts index 1a6471293e4..36543a8fcf2 100644 --- a/src/ast/nodes/ExpressionStatement.ts +++ b/src/ast/nodes/ExpressionStatement.ts @@ -4,16 +4,12 @@ import { logModuleLevelDirective } from '../../utils/logs'; import type { RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; import * as NodeType from './NodeType'; -import { type ExpressionNode, StatementBase } from './shared/Node'; +import { type ExpressionNode, onlyIncludeSelf, StatementBase } from './shared/Node'; export default class ExpressionStatement extends StatementBase { declare directive?: string; declare expression: ExpressionNode; - includeNode() { - this.included = true; - } - initialise(): void { super.initialise(); if ( @@ -50,3 +46,5 @@ export default class ExpressionStatement extends StatementBase { protected applyDeoptimizations() {} } + +ExpressionStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/IfStatement.ts b/src/ast/nodes/IfStatement.ts index 690c84ab91e..4fc6facb883 100644 --- a/src/ast/nodes/IfStatement.ts +++ b/src/ast/nodes/IfStatement.ts @@ -13,6 +13,7 @@ import { type ExpressionNode, type GenericEsTreeNode, type IncludeChildren, + onlyIncludeSelf, StatementBase, type StatementNode } from './shared/Node'; @@ -52,7 +53,7 @@ export default class IfStatement extends StatementBase implements DeoptimizableE } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); if (includeChildrenRecursively) { this.includeRecursively(includeChildrenRecursively, context); } else { @@ -65,10 +66,6 @@ export default class IfStatement extends StatementBase implements DeoptimizableE } } - includeNode() { - this.included = true; - } - parseNode(esTreeNode: GenericEsTreeNode): this { this.consequent = new (this.scope.context.getNodeConstructor(esTreeNode.consequent.type))( this, @@ -211,3 +208,5 @@ export default class IfStatement extends StatementBase implements DeoptimizableE return false; } } + +IfStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/Literal.ts b/src/ast/nodes/Literal.ts index dc33f495c0f..9ac887b537d 100644 --- a/src/ast/nodes/Literal.ts +++ b/src/ast/nodes/Literal.ts @@ -20,7 +20,7 @@ import { UNKNOWN_RETURN_EXPRESSION, UnknownValue } from './shared/Expression'; -import { type GenericEsTreeNode, NodeBase } from './shared/Node'; +import { type GenericEsTreeNode, NodeBase, onlyIncludeSelf } from './shared/Node'; export type LiteralValue = string | boolean | null | number | RegExp | undefined; export type LiteralValueOrBigInt = LiteralValue | bigint; @@ -90,10 +90,6 @@ export default class Literal< } } - includeNode() { - this.included = true; - } - initialise(): void { super.initialise(); this.members = getLiteralMembersForValue(this.value); @@ -111,3 +107,5 @@ export default class Literal< } } } + +Literal.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/LogicalExpression.ts b/src/ast/nodes/LogicalExpression.ts index d70072b873e..f090e90b5ce 100644 --- a/src/ast/nodes/LogicalExpression.ts +++ b/src/ast/nodes/LogicalExpression.ts @@ -30,7 +30,12 @@ import { UnknownValue } from './shared/Expression'; import { MultiExpression } from './shared/MultiExpression'; -import { type ExpressionNode, type IncludeChildren, NodeBase } from './shared/Node'; +import { + type ExpressionNode, + type IncludeChildren, + NodeBase, + onlyIncludeSelf +} from './shared/Node'; export type LogicalOperator = '||' | '&&' | '??'; @@ -190,7 +195,7 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); const usedBranch = this.getUsedBranch(); if ( includeChildrenRecursively || @@ -215,10 +220,6 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable } } - includeNode() { - this.included = true; - } - removeAnnotations(code: MagicString) { this.left.removeAnnotations(code); } @@ -283,3 +284,5 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable return this.usedBranch; } } + +LogicalExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ObjectPattern.ts b/src/ast/nodes/ObjectPattern.ts index a5c7e63303a..80e9be8b9b5 100644 --- a/src/ast/nodes/ObjectPattern.ts +++ b/src/ast/nodes/ObjectPattern.ts @@ -11,7 +11,7 @@ import * as NodeType from './NodeType'; import type Property from './Property'; import type RestElement from './RestElement'; import type { ExpressionEntity } from './shared/Expression'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -95,10 +95,6 @@ export default class ObjectPattern extends NodeBase implements DeclarationPatter return (this.included ||= included); } - includeNode() { - this.included = true; - } - markDeclarationReached(): void { for (const property of this.properties) { property.markDeclarationReached(); @@ -130,3 +126,5 @@ export default class ObjectPattern extends NodeBase implements DeclarationPatter protected applyDeoptimizations() {} } + +ObjectPattern.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/Program.ts b/src/ast/nodes/Program.ts index e06829e77d6..eb9ac42e7e6 100644 --- a/src/ast/nodes/Program.ts +++ b/src/ast/nodes/Program.ts @@ -11,7 +11,7 @@ import { import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { createHasEffectsContext } from '../ExecutionContext'; import type * as NodeType from './NodeType'; -import { type IncludeChildren, NodeBase, type StatementNode } from './shared/Node'; +import { type IncludeChildren, NodeBase, onlyIncludeSelf, type StatementNode } from './shared/Node'; export default class Program extends NodeBase { declare body: readonly StatementNode[]; @@ -50,7 +50,7 @@ export default class Program extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) { node.include(context, includeChildrenRecursively); @@ -58,10 +58,6 @@ export default class Program extends NodeBase { } } - includeNode() { - this.included = true; - } - initialise() { super.initialise(); if (this.invalidAnnotations) @@ -106,3 +102,5 @@ export default class Program extends NodeBase { protected applyDeoptimizations() {} } + +Program.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/Property.ts b/src/ast/nodes/Property.ts index 45823e59a63..6c6e0f874b8 100644 --- a/src/ast/nodes/Property.ts +++ b/src/ast/nodes/Property.ts @@ -12,6 +12,7 @@ import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { type ExpressionEntity } from './shared/Expression'; import MethodBase from './shared/MethodBase'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; +import { onlyIncludeSelf } from './shared/Node'; import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -94,17 +95,13 @@ export default class Property extends MethodBase implements DeclarationPatternNo } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.key.include(context, includeChildrenRecursively); this.value.include(context, includeChildrenRecursively); } - includeNode() { - this.included = true; - } - includePath(path: ObjectPath, context: InclusionContext) { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.value.includePath(path, context); } @@ -133,3 +130,5 @@ export default class Property extends MethodBase implements DeclarationPatternNo : [...destructuredInitPath, String((this.key as Literal).value)]; } } + +Property.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/RestElement.ts b/src/ast/nodes/RestElement.ts index 76ed31ab6ef..4e4cfa140ea 100644 --- a/src/ast/nodes/RestElement.ts +++ b/src/ast/nodes/RestElement.ts @@ -6,7 +6,7 @@ import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import { type ExpressionEntity } from './shared/Expression'; import type { IncludeChildren } from './shared/Node'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -82,16 +82,12 @@ export default class RestElement extends NodeBase implements DeclarationPatternN } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); // This should just include the identifier, its properties should be // included where the variable is used. this.argument.include(context, includeChildrenRecursively); } - includeNode() { - this.included = true; - } - markDeclarationReached(): void { (this.argument as DeclarationPatternNode).markDeclarationReached(); } @@ -105,6 +101,8 @@ export default class RestElement extends NodeBase implements DeclarationPatternN } } +RestElement.prototype.includeNode = onlyIncludeSelf; + const getIncludedPatternPath = (destructuredInitPath: ObjectPath): ObjectPath => destructuredInitPath.at(-1) === UnknownKey ? destructuredInitPath diff --git a/src/ast/nodes/SequenceExpression.ts b/src/ast/nodes/SequenceExpression.ts index 0c36c27ea52..737898df179 100644 --- a/src/ast/nodes/SequenceExpression.ts +++ b/src/ast/nodes/SequenceExpression.ts @@ -14,7 +14,12 @@ import { type EntityPathTracker, type ObjectPath } from '../utils/PathTracker'; import ExpressionStatement from './ExpressionStatement'; import type * as NodeType from './NodeType'; import type { LiteralValueOrUnknown } from './shared/Expression'; -import { type ExpressionNode, type IncludeChildren, NodeBase } from './shared/Node'; +import { + type ExpressionNode, + type IncludeChildren, + NodeBase, + onlyIncludeSelf +} from './shared/Node'; export default class SequenceExpression extends NodeBase { declare expressions: ExpressionNode[]; @@ -68,7 +73,7 @@ export default class SequenceExpression extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); const lastExpression = this.expressions[this.expressions.length - 1]; for (const expression of this.expressions) { if ( @@ -81,12 +86,8 @@ export default class SequenceExpression extends NodeBase { } } - includeNode() { - this.included = true; - } - includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.expressions[this.expressions.length - 1].includePath(path, context); } @@ -133,3 +134,5 @@ export default class SequenceExpression extends NodeBase { } } } + +SequenceExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/StaticBlock.ts b/src/ast/nodes/StaticBlock.ts index 932365772a3..686b3a2991a 100644 --- a/src/ast/nodes/StaticBlock.ts +++ b/src/ast/nodes/StaticBlock.ts @@ -8,7 +8,12 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; import * as NodeType from './NodeType'; -import { type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; +import { + type IncludeChildren, + onlyIncludeSelf, + StatementBase, + type StatementNode +} from './shared/Node'; export default class StaticBlock extends StatementBase { declare body: readonly StatementNode[]; @@ -26,17 +31,13 @@ export default class StaticBlock extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) node.include(context, includeChildrenRecursively); } } - includeNode() { - this.included = true; - } - render(code: MagicString, options: RenderOptions): void { if (this.body.length > 0) { const bodyStartPos = @@ -48,6 +49,8 @@ export default class StaticBlock extends StatementBase { } } +StaticBlock.prototype.includeNode = onlyIncludeSelf; + export function isStaticBlock(statement: StatementNode): statement is StaticBlock { return statement.type === NodeType.StaticBlock; } diff --git a/src/ast/nodes/SwitchCase.ts b/src/ast/nodes/SwitchCase.ts index a48d729e7d3..e42fdcdc2f4 100644 --- a/src/ast/nodes/SwitchCase.ts +++ b/src/ast/nodes/SwitchCase.ts @@ -11,6 +11,7 @@ import { type ExpressionNode, type IncludeChildren, NodeBase, + onlyIncludeSelf, type StatementNode } from './shared/Node'; @@ -30,7 +31,7 @@ export default class SwitchCase extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.test?.include(context, includeChildrenRecursively); for (const node of this.consequent) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) @@ -38,10 +39,6 @@ export default class SwitchCase extends NodeBase { } } - includeNode() { - this.included = true; - } - render(code: MagicString, options: RenderOptions, nodeRenderOptions?: NodeRenderOptions): void { if (this.consequent.length > 0) { if (this.test) { @@ -59,3 +56,4 @@ export default class SwitchCase extends NodeBase { } SwitchCase.prototype.needsBoundaries = true; +SwitchCase.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/SwitchStatement.ts b/src/ast/nodes/SwitchStatement.ts index 8d0d36014fd..c74204dc41b 100644 --- a/src/ast/nodes/SwitchStatement.ts +++ b/src/ast/nodes/SwitchStatement.ts @@ -9,7 +9,7 @@ import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; import type * as NodeType from './NodeType'; import type { ExpressionNode, GenericEsTreeNode, IncludeChildren } from './shared/Node'; -import { StatementBase } from './shared/Node'; +import { onlyIncludeSelf, StatementBase } from './shared/Node'; import type SwitchCase from './SwitchCase'; export default class SwitchStatement extends StatementBase { @@ -47,7 +47,7 @@ export default class SwitchStatement extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.discriminant.include(context, includeChildrenRecursively); const { brokenFlow, hasBreak } = context; context.hasBreak = false; @@ -80,10 +80,6 @@ export default class SwitchStatement extends StatementBase { context.hasBreak = hasBreak; } - includeNode() { - this.included = true; - } - initialise(): void { super.initialise(); for (let caseIndex = 0; caseIndex < this.cases.length; caseIndex++) { @@ -110,3 +106,5 @@ export default class SwitchStatement extends StatementBase { } } } + +SwitchStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/TaggedTemplateExpression.ts b/src/ast/nodes/TaggedTemplateExpression.ts index 7108e955524..3da7b54c367 100644 --- a/src/ast/nodes/TaggedTemplateExpression.ts +++ b/src/ast/nodes/TaggedTemplateExpression.ts @@ -13,6 +13,7 @@ import CallExpressionBase from './shared/CallExpressionBase'; import type { ExpressionEntity } from './shared/Expression'; import { UNKNOWN_EXPRESSION, UNKNOWN_RETURN_EXPRESSION } from './shared/Expression'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; +import { onlyIncludeSelf } from './shared/Node'; import type TemplateLiteral from './TemplateLiteral'; export default class TaggedTemplateExpression extends CallExpressionBase { @@ -46,7 +47,7 @@ export default class TaggedTemplateExpression extends CallExpressionBase { include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!this.deoptimized) this.applyDeoptimizations(); - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); if (includeChildrenRecursively) { super.include(context, includeChildrenRecursively); } else { @@ -61,10 +62,6 @@ export default class TaggedTemplateExpression extends CallExpressionBase { } } - includeNode() { - this.included = true; - } - initialise(): void { super.initialise(); this.args = [UNKNOWN_EXPRESSION, ...this.quasi.expressions]; @@ -108,3 +105,5 @@ export default class TaggedTemplateExpression extends CallExpressionBase { return this.returnExpression; } } + +TaggedTemplateExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/UpdateExpression.ts b/src/ast/nodes/UpdateExpression.ts index 2d93d67b620..5ee8322ff0b 100644 --- a/src/ast/nodes/UpdateExpression.ts +++ b/src/ast/nodes/UpdateExpression.ts @@ -13,7 +13,7 @@ import Identifier from './Identifier'; import * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class UpdateExpression extends NodeBase { declare argument: ExpressionNode; @@ -33,14 +33,10 @@ export default class UpdateExpression extends NodeBase { include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { if (!this.deoptimized) this.applyDeoptimizations(); - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.argument.includeAsAssignmentTarget(context, includeChildrenRecursively, true); } - includeNode() { - this.included = true; - } - initialise() { super.initialise(); this.argument.setAssignedValue(UNKNOWN_EXPRESSION); @@ -96,3 +92,5 @@ export default class UpdateExpression extends NodeBase { this.scope.context.requestTreeshakingPass(); } } + +UpdateExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/VariableDeclaration.ts b/src/ast/nodes/VariableDeclaration.ts index 0c5e0d96d01..7af5d3dcc4a 100644 --- a/src/ast/nodes/VariableDeclaration.ts +++ b/src/ast/nodes/VariableDeclaration.ts @@ -21,7 +21,7 @@ import Identifier, { type IdentifierWithVariable } from './Identifier'; import * as NodeType from './NodeType'; import ObjectPattern from './ObjectPattern'; import type { InclusionOptions } from './shared/Expression'; -import { type IncludeChildren, NodeBase } from './shared/Node'; +import { type IncludeChildren, NodeBase, onlyIncludeSelf } from './shared/Node'; import type { VariableDeclarationKind } from './shared/VariableKinds'; import type VariableDeclarator from './VariableDeclarator'; @@ -63,7 +63,7 @@ export default class VariableDeclaration extends NodeBase { includeChildrenRecursively: IncludeChildren, { asSingleStatement }: InclusionOptions = BLANK ): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); for (const declarator of this.declarations) { if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) { declarator.include(context, includeChildrenRecursively); @@ -83,10 +83,6 @@ export default class VariableDeclaration extends NodeBase { } } - includeNode() { - this.included = true; - } - initialise(): void { super.initialise(); this.isUsingDeclaration = this.kind === 'await using' || this.kind === 'using'; @@ -282,3 +278,5 @@ function gatherSystemExportsAndGetSingleExport( } return singleSystemExport; } + +VariableDeclaration.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/VariableDeclarator.ts b/src/ast/nodes/VariableDeclarator.ts index 1c0288bf509..971391cb7d7 100644 --- a/src/ast/nodes/VariableDeclarator.ts +++ b/src/ast/nodes/VariableDeclarator.ts @@ -13,7 +13,12 @@ import { UNDEFINED_EXPRESSION } from '../values'; import ClassExpression from './ClassExpression'; import Identifier from './Identifier'; import * as NodeType from './NodeType'; -import { type ExpressionNode, type IncludeChildren, NodeBase } from './shared/Node'; +import { + type ExpressionNode, + type IncludeChildren, + NodeBase, + onlyIncludeSelf +} from './shared/Node'; import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -49,7 +54,7 @@ export default class VariableDeclarator extends NodeBase { include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { const { deoptimized, id, init } = this; if (!deoptimized) this.applyDeoptimizations(); - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); init?.include(context, includeChildrenRecursively); id.markDeclarationReached(); if (includeChildrenRecursively) { @@ -59,10 +64,6 @@ export default class VariableDeclarator extends NodeBase { } } - includeNode() { - this.included = true; - } - removeAnnotations(code: MagicString) { this.init?.removeAnnotations(code); } @@ -113,3 +114,5 @@ export default class VariableDeclarator extends NodeBase { } } } + +VariableDeclarator.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/WhileStatement.ts b/src/ast/nodes/WhileStatement.ts index 55818b63788..09fb3d15f42 100644 --- a/src/ast/nodes/WhileStatement.ts +++ b/src/ast/nodes/WhileStatement.ts @@ -4,6 +4,7 @@ import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, + onlyIncludeSelf, StatementBase, type StatementNode } from './shared/Node'; @@ -19,12 +20,10 @@ export default class WhileStatement extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(); + if (!this.included) this.includeNode(context); this.test.include(context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } - - includeNode() { - this.included = true; - } } + +WhileStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/shared/Node.ts b/src/ast/nodes/shared/Node.ts index bf0931b3b75..ab1b19468e7 100644 --- a/src/ast/nodes/shared/Node.ts +++ b/src/ast/nodes/shared/Node.ts @@ -407,3 +407,7 @@ export function locateNode(node: Node): Location & { file: string } { export function logNode(node: Node): string { return node.scope.context.code.slice(node.start, node.end); } + +export function onlyIncludeSelf(this: Node) { + this.included = true; +} From 25835797f6e065b5213aa626a3ffdbd03cbd508a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 10 Dec 2024 06:57:33 +0100 Subject: [PATCH 10/32] Use trivial includeNode method where possible --- src/ast/nodes/ArrayExpression.ts | 13 ++++++++-- src/ast/nodes/ArrayPattern.ts | 4 ++- src/ast/nodes/AssignmentPattern.ts | 5 ++++ src/ast/nodes/BinaryExpression.ts | 4 ++- src/ast/nodes/BreakStatement.ts | 4 ++- src/ast/nodes/CatchClause.ts | 3 ++- src/ast/nodes/ChainExpression.ts | 11 ++++++-- src/ast/nodes/ClassBody.ts | 9 ++++++- src/ast/nodes/ContinueStatement.ts | 4 ++- src/ast/nodes/DebuggerStatement.ts | 4 ++- src/ast/nodes/Decorator.ts | 4 ++- src/ast/nodes/DoWhileStatement.ts | 3 +++ src/ast/nodes/EmptyStatement.ts | 4 ++- src/ast/nodes/ExportAllDeclaration.ts | 3 ++- src/ast/nodes/ExportNamedDeclaration.ts | 3 ++- src/ast/nodes/ExportSpecifier.ts | 4 ++- src/ast/nodes/ForStatement.ts | 3 +++ src/ast/nodes/ImportDeclaration.ts | 3 ++- src/ast/nodes/ImportDefaultSpecifier.ts | 4 ++- src/ast/nodes/ImportNamespaceSpecifier.ts | 4 ++- src/ast/nodes/ImportSpecifier.ts | 4 ++- src/ast/nodes/JSXAttribute.ts | 4 ++- src/ast/nodes/JSXElement.ts | 8 ++++++ src/ast/nodes/JSXEmptyExpression.ts | 4 ++- src/ast/nodes/JSXExpressionContainer.ts | 7 +++++ src/ast/nodes/JSXFragment.ts | 8 ++++++ src/ast/nodes/JSXIdentifier.ts | 26 +++++++++++++++++++ src/ast/nodes/JSXMemberExpression.ts | 12 +++++++++ src/ast/nodes/JSXNamespacedName.ts | 4 ++- src/ast/nodes/JSXOpeningElement.ts | 4 ++- src/ast/nodes/JSXOpeningFragment.ts | 4 --- src/ast/nodes/JSXText.ts | 4 ++- src/ast/nodes/PrivateIdentifier.ts | 4 ++- src/ast/nodes/PropertyDefinition.ts | 13 ++++++++-- src/ast/nodes/ReturnStatement.ts | 6 +++++ src/ast/nodes/SpreadElement.ts | 7 ++++- src/ast/nodes/TemplateElement.ts | 4 ++- src/ast/nodes/TemplateLiteral.ts | 12 +++++++-- src/ast/nodes/ThrowStatement.ts | 9 ++++++- src/ast/nodes/TryStatement.ts | 9 ++++++- src/ast/nodes/UnaryExpression.ts | 4 ++- src/ast/nodes/YieldExpression.ts | 8 +++++- src/ast/nodes/shared/ClassNode.ts | 4 ++- src/ast/nodes/shared/JSXClosingBase.ts | 4 ++- src/ast/nodes/shared/JSXElementBase.ts | 2 +- src/ast/nodes/shared/MethodBase.ts | 4 ++- src/ast/nodes/shared/Node.ts | 2 -- .../transpiles-empty-fragment/_expected.js | 2 +- .../_config.js | 3 +++ .../_expected.js | 3 +++ .../track-through-chain-expressions/main.js | 3 +++ .../tree-shake-jsx-namespace/_config.js | 4 +++ .../tree-shake-jsx-namespace/_expected.js | 7 +++++ .../tree-shake-jsx-namespace/main.js | 6 +++++ .../_expected.js | 2 +- .../_config.js | 3 +++ .../retain-property-definition-paths/main.js | 5 ++++ 57 files changed, 267 insertions(+), 48 deletions(-) create mode 100644 test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/track-through-chain-expressions/main.js create mode 100644 test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_config.js create mode 100644 test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_expected.js create mode 100644 test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/main.js create mode 100644 test/function/samples/object-expression-treeshaking/retain-property-definition-paths/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/retain-property-definition-paths/main.js diff --git a/src/ast/nodes/ArrayExpression.ts b/src/ast/nodes/ArrayExpression.ts index 739cde53a81..5a018096d8a 100644 --- a/src/ast/nodes/ArrayExpression.ts +++ b/src/ast/nodes/ArrayExpression.ts @@ -1,5 +1,5 @@ import type { DeoptimizableEntity } from '../DeoptimizableEntity'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; import { type EntityPathTracker, @@ -9,11 +9,11 @@ import { } from '../utils/PathTracker'; import { UNDEFINED_EXPRESSION, UNKNOWN_LITERAL_NUMBER } from '../values'; import type * as NodeType from './NodeType'; -import SpreadElement from './SpreadElement'; import { ARRAY_PROTOTYPE } from './shared/ArrayPrototype'; import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expression'; import { type ExpressionNode, NodeBase } from './shared/Node'; import { ObjectEntity, type ObjectProperty } from './shared/ObjectEntity'; +import SpreadElement from './SpreadElement'; export default class ArrayExpression extends NodeBase { declare elements: readonly (ExpressionNode | SpreadElement | null)[]; @@ -66,6 +66,15 @@ export default class ArrayExpression extends NodeBase { return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context); } + includeNode(context: InclusionContext) { + this.included = true; + for (const element of this.elements) { + if (element) { + element?.includePath(UNKNOWN_PATH, context); + } + } + } + protected applyDeoptimizations(): void { this.deoptimized = true; let hasSpread = false; diff --git a/src/ast/nodes/ArrayPattern.ts b/src/ast/nodes/ArrayPattern.ts index daf57eb35ea..811a9467003 100644 --- a/src/ast/nodes/ArrayPattern.ts +++ b/src/ast/nodes/ArrayPattern.ts @@ -5,7 +5,7 @@ import type LocalVariable from '../variables/LocalVariable'; import type Variable from '../variables/Variable'; import type * as NodeType from './NodeType'; import type { ExpressionEntity } from './shared/Expression'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -113,6 +113,8 @@ export default class ArrayPattern extends NodeBase implements DeclarationPattern } } +ArrayPattern.prototype.includeNode = onlyIncludeSelf; + const getIncludedPatternPath = (destructuredInitPath: ObjectPath): ObjectPath => destructuredInitPath.at(-1) === UnknownKey ? destructuredInitPath diff --git a/src/ast/nodes/AssignmentPattern.ts b/src/ast/nodes/AssignmentPattern.ts index acd7d7d7587..dc693c11ea3 100644 --- a/src/ast/nodes/AssignmentPattern.ts +++ b/src/ast/nodes/AssignmentPattern.ts @@ -80,6 +80,11 @@ export default class AssignmentPattern extends NodeBase implements DeclarationPa return (this.included = included); } + includeNode(context: InclusionContext) { + this.included = true; + this.right.includePath(UNKNOWN_PATH, context); + } + markDeclarationReached(): void { (this.left as DeclarationPatternNode).markDeclarationReached(); } diff --git a/src/ast/nodes/BinaryExpression.ts b/src/ast/nodes/BinaryExpression.ts index 8021d923bf2..5cd38b0ded2 100644 --- a/src/ast/nodes/BinaryExpression.ts +++ b/src/ast/nodes/BinaryExpression.ts @@ -15,7 +15,7 @@ import ExpressionStatement from './ExpressionStatement'; import type { LiteralValue } from './Literal'; import type * as NodeType from './NodeType'; import { type LiteralValueOrUnknown, UnknownValue } from './shared/Expression'; -import { type ExpressionNode, NodeBase } from './shared/Node'; +import { type ExpressionNode, NodeBase, onlyIncludeSelf } from './shared/Node'; type Operator = | '!=' @@ -125,3 +125,5 @@ export default class BinaryExpression extends NodeBase implements DeoptimizableE this.right.render(code, options); } } + +BinaryExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/BreakStatement.ts b/src/ast/nodes/BreakStatement.ts index 78d08154465..0a3292e7653 100644 --- a/src/ast/nodes/BreakStatement.ts +++ b/src/ast/nodes/BreakStatement.ts @@ -1,7 +1,7 @@ import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { StatementBase } from './shared/Node'; +import { onlyIncludeSelf, StatementBase } from './shared/Node'; export default class BreakStatement extends StatementBase { declare label: Identifier | null; @@ -30,3 +30,5 @@ export default class BreakStatement extends StatementBase { context.brokenFlow = true; } } + +BreakStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/CatchClause.ts b/src/ast/nodes/CatchClause.ts index be2a9d6c23d..7224a9a8be2 100644 --- a/src/ast/nodes/CatchClause.ts +++ b/src/ast/nodes/CatchClause.ts @@ -4,7 +4,7 @@ import { EMPTY_PATH } from '../utils/PathTracker'; import BlockStatement from './BlockStatement'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; -import { type GenericEsTreeNode, NodeBase } from './shared/Node'; +import { type GenericEsTreeNode, NodeBase, onlyIncludeSelf } from './shared/Node'; import type { DeclarationPatternNode } from './shared/Pattern'; export default class CatchClause extends NodeBase { @@ -34,3 +34,4 @@ export default class CatchClause extends NodeBase { } CatchClause.prototype.preventChildBlockScope = true; +CatchClause.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ChainExpression.ts b/src/ast/nodes/ChainExpression.ts index 5bd7868bc64..039f3183a5c 100644 --- a/src/ast/nodes/ChainExpression.ts +++ b/src/ast/nodes/ChainExpression.ts @@ -1,12 +1,12 @@ import type MagicString from 'magic-string'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import type CallExpression from './CallExpression'; import type MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; import type { LiteralValueOrUnknown } from './shared/Expression'; -import { IS_SKIPPED_CHAIN, NodeBase } from './shared/Node'; +import { IS_SKIPPED_CHAIN, NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ChainExpression extends NodeBase implements DeoptimizableEntity { declare expression: CallExpression | MemberExpression; @@ -32,9 +32,16 @@ export default class ChainExpression extends NodeBase implements DeoptimizableEn return this.expression.hasEffectsAsChainElement(context) === true; } + includePath(path: ObjectPath, context: InclusionContext) { + if (!this.included) this.includeNode(context); + this.expression.includePath(path, context); + } + removeAnnotations(code: MagicString) { this.expression.removeAnnotations(code); } protected applyDeoptimizations() {} } + +ChainExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ClassBody.ts b/src/ast/nodes/ClassBody.ts index e30d6ae693f..2b62ff39295 100644 --- a/src/ast/nodes/ClassBody.ts +++ b/src/ast/nodes/ClassBody.ts @@ -7,7 +7,12 @@ import type MethodDefinition from './MethodDefinition'; import type * as NodeType from './NodeType'; import type PropertyDefinition from './PropertyDefinition'; import type ClassNode from './shared/ClassNode'; -import { type GenericEsTreeNode, type IncludeChildren, NodeBase } from './shared/Node'; +import { + type GenericEsTreeNode, + type IncludeChildren, + NodeBase, + onlyIncludeSelf +} from './shared/Node'; import type StaticBlock from './StaticBlock'; export default class ClassBody extends NodeBase { @@ -41,3 +46,5 @@ export default class ClassBody extends NodeBase { protected applyDeoptimizations() {} } + +ClassBody.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ContinueStatement.ts b/src/ast/nodes/ContinueStatement.ts index 1f03f6493ae..9341140f3c7 100644 --- a/src/ast/nodes/ContinueStatement.ts +++ b/src/ast/nodes/ContinueStatement.ts @@ -1,7 +1,7 @@ import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { StatementBase } from './shared/Node'; +import { onlyIncludeSelf, StatementBase } from './shared/Node'; export default class ContinueStatement extends StatementBase { declare label: Identifier | null; @@ -30,3 +30,5 @@ export default class ContinueStatement extends StatementBase { context.brokenFlow = true; } } + +ContinueStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/DebuggerStatement.ts b/src/ast/nodes/DebuggerStatement.ts index e0e42deeff6..cffa2943647 100644 --- a/src/ast/nodes/DebuggerStatement.ts +++ b/src/ast/nodes/DebuggerStatement.ts @@ -1,5 +1,5 @@ import type * as NodeType from './NodeType'; -import { StatementBase } from './shared/Node'; +import { onlyIncludeSelf, StatementBase } from './shared/Node'; export default class DebuggerStatement extends StatementBase { declare type: NodeType.tDebuggerStatement; @@ -8,3 +8,5 @@ export default class DebuggerStatement extends StatementBase { return true; } } + +DebuggerStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/Decorator.ts b/src/ast/nodes/Decorator.ts index 67dfe97c9b8..c6cf5329dce 100644 --- a/src/ast/nodes/Decorator.ts +++ b/src/ast/nodes/Decorator.ts @@ -2,7 +2,7 @@ import type { HasEffectsContext } from '../ExecutionContext'; import { NODE_INTERACTION_UNKNOWN_CALL } from '../NodeInteractions'; import { EMPTY_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; -import { type ExpressionNode, NodeBase } from './shared/Node'; +import { type ExpressionNode, NodeBase, onlyIncludeSelf } from './shared/Node'; export default class Decorator extends NodeBase { declare type: NodeType.tDecorator; @@ -18,3 +18,5 @@ export default class Decorator extends NodeBase { ); } } + +Decorator.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/DoWhileStatement.ts b/src/ast/nodes/DoWhileStatement.ts index 8f53a47d348..12695c8365c 100644 --- a/src/ast/nodes/DoWhileStatement.ts +++ b/src/ast/nodes/DoWhileStatement.ts @@ -4,6 +4,7 @@ import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, + onlyIncludeSelf, StatementBase, type StatementNode } from './shared/Node'; @@ -24,3 +25,5 @@ export default class DoWhileStatement extends StatementBase { includeLoopBody(context, this.body, includeChildrenRecursively); } } + +DoWhileStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/EmptyStatement.ts b/src/ast/nodes/EmptyStatement.ts index 464157b1ce0..bfe36c3680c 100644 --- a/src/ast/nodes/EmptyStatement.ts +++ b/src/ast/nodes/EmptyStatement.ts @@ -1,5 +1,5 @@ import type * as NodeType from './NodeType'; -import { StatementBase } from './shared/Node'; +import { onlyIncludeSelf, StatementBase } from './shared/Node'; export default class EmptyStatement extends StatementBase { declare type: NodeType.tEmptyStatement; @@ -8,3 +8,5 @@ export default class EmptyStatement extends StatementBase { return false; } } + +EmptyStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ExportAllDeclaration.ts b/src/ast/nodes/ExportAllDeclaration.ts index bd4bd6db3fa..931ff44626a 100644 --- a/src/ast/nodes/ExportAllDeclaration.ts +++ b/src/ast/nodes/ExportAllDeclaration.ts @@ -4,7 +4,7 @@ import type Identifier from './Identifier'; import type ImportAttribute from './ImportAttribute'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ExportAllDeclaration extends NodeBase { declare attributes: ImportAttribute[]; @@ -30,3 +30,4 @@ export default class ExportAllDeclaration extends NodeBase { } ExportAllDeclaration.prototype.needsBoundaries = true; +ExportAllDeclaration.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ExportNamedDeclaration.ts b/src/ast/nodes/ExportNamedDeclaration.ts index 332de1d0cd0..97bc6f4d89b 100644 --- a/src/ast/nodes/ExportNamedDeclaration.ts +++ b/src/ast/nodes/ExportNamedDeclaration.ts @@ -7,8 +7,8 @@ import type FunctionDeclaration from './FunctionDeclaration'; import type ImportAttribute from './ImportAttribute'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; +import { type Node, NodeBase, onlyIncludeSelf } from './shared/Node'; import type VariableDeclaration from './VariableDeclaration'; -import { type Node, NodeBase } from './shared/Node'; export default class ExportNamedDeclaration extends NodeBase { declare attributes: ImportAttribute[]; @@ -50,3 +50,4 @@ export default class ExportNamedDeclaration extends NodeBase { } ExportNamedDeclaration.prototype.needsBoundaries = true; +ExportNamedDeclaration.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ExportSpecifier.ts b/src/ast/nodes/ExportSpecifier.ts index f4dc7a91f7a..5fa24b0496f 100644 --- a/src/ast/nodes/ExportSpecifier.ts +++ b/src/ast/nodes/ExportSpecifier.ts @@ -1,7 +1,7 @@ import type Identifier from './Identifier'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ExportSpecifier extends NodeBase { declare exported: Identifier | Literal; @@ -10,3 +10,5 @@ export default class ExportSpecifier extends NodeBase { protected applyDeoptimizations() {} } + +ExportSpecifier.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ForStatement.ts b/src/ast/nodes/ForStatement.ts index ca2f6b0c2c5..37bb22305b1 100644 --- a/src/ast/nodes/ForStatement.ts +++ b/src/ast/nodes/ForStatement.ts @@ -8,6 +8,7 @@ import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { type ExpressionNode, type IncludeChildren, + onlyIncludeSelf, StatementBase, type StatementNode } from './shared/Node'; @@ -52,3 +53,5 @@ export default class ForStatement extends StatementBase { this.body.render(code, options); } } + +ForStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ImportDeclaration.ts b/src/ast/nodes/ImportDeclaration.ts index 945737ee8d4..318346b8dda 100644 --- a/src/ast/nodes/ImportDeclaration.ts +++ b/src/ast/nodes/ImportDeclaration.ts @@ -6,7 +6,7 @@ import type ImportNamespaceSpecifier from './ImportNamespaceSpecifier'; import type ImportSpecifier from './ImportSpecifier'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ImportDeclaration extends NodeBase { declare attributes: ImportAttribute[]; @@ -35,3 +35,4 @@ export default class ImportDeclaration extends NodeBase { } ImportDeclaration.prototype.needsBoundaries = true; +ImportDeclaration.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ImportDefaultSpecifier.ts b/src/ast/nodes/ImportDefaultSpecifier.ts index 91079284281..a60a0f2b4a3 100644 --- a/src/ast/nodes/ImportDefaultSpecifier.ts +++ b/src/ast/nodes/ImportDefaultSpecifier.ts @@ -1,6 +1,6 @@ import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ImportDefaultSpecifier extends NodeBase { declare local: Identifier; @@ -8,3 +8,5 @@ export default class ImportDefaultSpecifier extends NodeBase { protected applyDeoptimizations() {} } + +ImportDefaultSpecifier.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ImportNamespaceSpecifier.ts b/src/ast/nodes/ImportNamespaceSpecifier.ts index f4d4d1dd074..2cc0e089cd4 100644 --- a/src/ast/nodes/ImportNamespaceSpecifier.ts +++ b/src/ast/nodes/ImportNamespaceSpecifier.ts @@ -1,6 +1,6 @@ import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ImportNamespaceSpecifier extends NodeBase { declare local: Identifier; @@ -8,3 +8,5 @@ export default class ImportNamespaceSpecifier extends NodeBase { protected applyDeoptimizations() {} } + +ImportNamespaceSpecifier.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/ImportSpecifier.ts b/src/ast/nodes/ImportSpecifier.ts index d8b589dfcf1..e20c7f8c79c 100644 --- a/src/ast/nodes/ImportSpecifier.ts +++ b/src/ast/nodes/ImportSpecifier.ts @@ -1,7 +1,7 @@ import type Identifier from './Identifier'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class ImportSpecifier extends NodeBase { declare imported: Identifier | Literal; @@ -10,3 +10,5 @@ export default class ImportSpecifier extends NodeBase { protected applyDeoptimizations() {} } + +ImportSpecifier.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/JSXAttribute.ts b/src/ast/nodes/JSXAttribute.ts index b16287d9de2..b43818c6e35 100644 --- a/src/ast/nodes/JSXAttribute.ts +++ b/src/ast/nodes/JSXAttribute.ts @@ -9,7 +9,7 @@ import JSXIdentifier from './JSXIdentifier'; import type JSXNamespacedName from './JSXNamespacedName'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class JSXAttribute extends NodeBase { type!: NodeType.tJSXAttribute; @@ -36,3 +36,5 @@ export default class JSXAttribute extends NodeBase { } } } + +JSXAttribute.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/JSXElement.ts b/src/ast/nodes/JSXElement.ts index cd5ab4f449a..7fd37b5f3ba 100644 --- a/src/ast/nodes/JSXElement.ts +++ b/src/ast/nodes/JSXElement.ts @@ -1,6 +1,7 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../rollup/types'; import type { RenderOptions } from '../../utils/renderHelpers'; +import type { InclusionContext } from '../ExecutionContext'; import JSXAttribute from './JSXAttribute'; import type JSXClosingElement from './JSXClosingElement'; import type JSXOpeningElement from './JSXOpeningElement'; @@ -8,6 +9,7 @@ import JSXSpreadAttribute from './JSXSpreadAttribute'; import type * as NodeType from './NodeType'; import JSXElementBase from './shared/JSXElementBase'; import type { JSXChild, JsxMode } from './shared/jsxHelpers'; +import type { IncludeChildren } from './shared/Node'; export default class JSXElement extends JSXElementBase { type!: NodeType.tJSXElement; @@ -15,6 +17,12 @@ export default class JSXElement extends JSXElementBase { closingElement!: JSXClosingElement | null; children!: JSXChild[]; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + super.include(context, includeChildrenRecursively); + this.openingElement.include(context, includeChildrenRecursively); + this.closingElement?.include(context, includeChildrenRecursively); + } + render(code: MagicString, options: RenderOptions): void { switch (this.jsxMode.mode) { case 'classic': { diff --git a/src/ast/nodes/JSXEmptyExpression.ts b/src/ast/nodes/JSXEmptyExpression.ts index 87d3b29a1b3..8ae56517c37 100644 --- a/src/ast/nodes/JSXEmptyExpression.ts +++ b/src/ast/nodes/JSXEmptyExpression.ts @@ -1,6 +1,8 @@ import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class JSXEmptyExpression extends NodeBase { type!: NodeType.tJSXEmptyExpression; } + +JSXEmptyExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/JSXExpressionContainer.ts b/src/ast/nodes/JSXExpressionContainer.ts index d4b001629c2..57c5083ad26 100644 --- a/src/ast/nodes/JSXExpressionContainer.ts +++ b/src/ast/nodes/JSXExpressionContainer.ts @@ -1,6 +1,8 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../rollup/types'; import type { RenderOptions } from '../../utils/renderHelpers'; +import type { InclusionContext } from '../ExecutionContext'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type JSXEmptyExpression from './JSXEmptyExpression'; import type * as NodeType from './NodeType'; import type { ExpressionNode } from './shared/Node'; @@ -10,6 +12,11 @@ export default class JSXExpressionContainer extends NodeBase { type!: NodeType.tJSXExpressionContainer; expression!: ExpressionNode | JSXEmptyExpression; + includeNode(context: InclusionContext) { + this.included = true; + this.expression.includePath(UNKNOWN_PATH, context); + } + render(code: MagicString, options: RenderOptions): void { const { mode } = this.scope.context.options.jsx as NormalizedJsxOptions; if (mode !== 'preserve') { diff --git a/src/ast/nodes/JSXFragment.ts b/src/ast/nodes/JSXFragment.ts index a239459c866..1f04e9f7522 100644 --- a/src/ast/nodes/JSXFragment.ts +++ b/src/ast/nodes/JSXFragment.ts @@ -1,10 +1,12 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; +import type { InclusionContext } from '../ExecutionContext'; import type JSXClosingFragment from './JSXClosingFragment'; import type JSXOpeningFragment from './JSXOpeningFragment'; import type * as NodeType from './NodeType'; import JSXElementBase from './shared/JSXElementBase'; import type { JSXChild } from './shared/jsxHelpers'; +import type { IncludeChildren } from './shared/Node'; export default class JSXFragment extends JSXElementBase { type!: NodeType.tJSXElement; @@ -12,6 +14,12 @@ export default class JSXFragment extends JSXElementBase { children!: JSXChild[]; closingFragment!: JSXClosingFragment; + include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { + super.include(context, includeChildrenRecursively); + this.openingFragment.include(context, includeChildrenRecursively); + this.closingFragment.include(context, includeChildrenRecursively); + } + render(code: MagicString, options: RenderOptions): void { switch (this.jsxMode.mode) { case 'classic': { diff --git a/src/ast/nodes/JSXIdentifier.ts b/src/ast/nodes/JSXIdentifier.ts index f7576328311..c7651da37e3 100644 --- a/src/ast/nodes/JSXIdentifier.ts +++ b/src/ast/nodes/JSXIdentifier.ts @@ -1,6 +1,9 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../rollup/types'; import type { RenderOptions } from '../../utils/renderHelpers'; +import type { InclusionContext } from '../ExecutionContext'; +import type { ObjectPath } from '../utils/PathTracker'; +import { EMPTY_PATH } from '../utils/PathTracker'; import type JSXMemberExpression from './JSXMemberExpression'; import type * as NodeType from './NodeType'; import IdentifierBase from './shared/IdentifierBase'; @@ -27,6 +30,29 @@ export default class JSXIdentifier extends IdentifierBase { } } + include(context: InclusionContext): void { + if (!this.deoptimized) this.applyDeoptimizations(); + if (!this.included) this.includeNode(context); + } + + includeNode(context: InclusionContext) { + this.included = true; + if (this.variable !== null) { + this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); + } + } + + includePath(path: ObjectPath, context: InclusionContext): void { + if (!this.included) { + this.included = true; + if (this.variable !== null) { + this.scope.context.includeVariableInModule(this.variable, path, context); + } + } else if (path.length > 0) { + this.variable?.includePath(path, context); + } + } + render( code: MagicString, { snippets: { getPropertyAccess }, useOriginalName }: RenderOptions diff --git a/src/ast/nodes/JSXMemberExpression.ts b/src/ast/nodes/JSXMemberExpression.ts index 1212066f3c7..b9348353386 100644 --- a/src/ast/nodes/JSXMemberExpression.ts +++ b/src/ast/nodes/JSXMemberExpression.ts @@ -1,3 +1,5 @@ +import type { InclusionContext } from '../ExecutionContext'; +import type { ObjectPath } from '../utils/PathTracker'; import type JSXIdentifier from './JSXIdentifier'; import type * as NodeType from './NodeType'; import { NodeBase } from './shared/Node'; @@ -6,4 +8,14 @@ export default class JSXMemberExpression extends NodeBase { type!: NodeType.tJSXMemberExpression; object!: JSXMemberExpression | JSXIdentifier; property!: JSXIdentifier; + + includeNode(context: InclusionContext) { + this.included = true; + this.object.includePath([this.property.name], context); + } + + includePath(path: ObjectPath, context: InclusionContext) { + if (!this.included) this.includeNode(context); + this.object.includePath([this.property.name, ...path], context); + } } diff --git a/src/ast/nodes/JSXNamespacedName.ts b/src/ast/nodes/JSXNamespacedName.ts index 5172b2a47a0..086568a3d68 100644 --- a/src/ast/nodes/JSXNamespacedName.ts +++ b/src/ast/nodes/JSXNamespacedName.ts @@ -1,9 +1,11 @@ import type JSXIdentifier from './JSXIdentifier'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class JSXNamespacedName extends NodeBase { type!: NodeType.tJSXNamespacedName; name!: JSXIdentifier; namespace!: JSXIdentifier; } + +JSXNamespacedName.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/JSXOpeningElement.ts b/src/ast/nodes/JSXOpeningElement.ts index a7a57f06a72..30261a9556d 100644 --- a/src/ast/nodes/JSXOpeningElement.ts +++ b/src/ast/nodes/JSXOpeningElement.ts @@ -7,7 +7,7 @@ import type JSXMemberExpression from './JSXMemberExpression'; import type JSXNamespacedName from './JSXNamespacedName'; import type JSXSpreadAttribute from './JSXSpreadAttribute'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class JSXOpeningElement extends NodeBase { type!: NodeType.tJSXOpeningElement; @@ -28,3 +28,5 @@ export default class JSXOpeningElement extends NodeBase { } } } + +JSXOpeningElement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/JSXOpeningFragment.ts b/src/ast/nodes/JSXOpeningFragment.ts index 805a1762331..85f6a95c952 100644 --- a/src/ast/nodes/JSXOpeningFragment.ts +++ b/src/ast/nodes/JSXOpeningFragment.ts @@ -15,10 +15,6 @@ export default class JSXOpeningFragment extends NodeBase { private fragment: string | null = null; private fragmentVariable: Variable | null = null; - include(context: InclusionContext) { - if (!this.included) this.includeNode(context); - } - includeNode(context: InclusionContext) { this.included = true; const jsx = this.scope.context.options.jsx as NormalizedJsxOptions; diff --git a/src/ast/nodes/JSXText.ts b/src/ast/nodes/JSXText.ts index 59e905cda2f..e06d0383dee 100644 --- a/src/ast/nodes/JSXText.ts +++ b/src/ast/nodes/JSXText.ts @@ -1,7 +1,7 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../rollup/types'; import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class JSXText extends NodeBase { type!: NodeType.tJSXText; @@ -17,3 +17,5 @@ export default class JSXText extends NodeBase { } } } + +JSXText.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/PrivateIdentifier.ts b/src/ast/nodes/PrivateIdentifier.ts index 094a62664b2..47a51070bbc 100644 --- a/src/ast/nodes/PrivateIdentifier.ts +++ b/src/ast/nodes/PrivateIdentifier.ts @@ -1,7 +1,9 @@ import type * as NodeType from './NodeType'; -import { NodeBase } from './shared/Node'; +import { NodeBase, onlyIncludeSelf } from './shared/Node'; export default class PrivateIdentifier extends NodeBase { declare name: string; declare type: NodeType.tPrivateIdentifier; } + +PrivateIdentifier.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/PropertyDefinition.ts b/src/ast/nodes/PropertyDefinition.ts index a5a2d5e5335..9d1ef6bc950 100644 --- a/src/ast/nodes/PropertyDefinition.ts +++ b/src/ast/nodes/PropertyDefinition.ts @@ -1,8 +1,9 @@ import type { DeoptimizableEntity } from '../DeoptimizableEntity'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction, NodeInteractionCalled } from '../NodeInteractions'; -import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; import { checkEffectForNodes } from '../utils/checkEffectForNodes'; +import type { EntityPathTracker, ObjectPath } from '../utils/PathTracker'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type Decorator from './Decorator'; import type * as NodeType from './NodeType'; import type PrivateIdentifier from './PrivateIdentifier'; @@ -78,5 +79,13 @@ export default class PropertyDefinition extends NodeBase { return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context); } + includeNode(context: InclusionContext) { + this.included = true; + this.value?.includePath(UNKNOWN_PATH, context); + for (const decorator of this.decorators) { + decorator.includePath(UNKNOWN_PATH, context); + } + } + protected applyDeoptimizations() {} } diff --git a/src/ast/nodes/ReturnStatement.ts b/src/ast/nodes/ReturnStatement.ts index 801bdf63f44..66db2c77fb3 100644 --- a/src/ast/nodes/ReturnStatement.ts +++ b/src/ast/nodes/ReturnStatement.ts @@ -1,6 +1,7 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; @@ -21,6 +22,11 @@ export default class ReturnStatement extends StatementBase { context.brokenFlow = true; } + includeNode(context: InclusionContext) { + this.included = true; + this.argument?.includePath(UNKNOWN_PATH, context); + } + initialise(): void { super.initialise(); this.scope.addReturnExpression(this.argument || UNKNOWN_EXPRESSION); diff --git a/src/ast/nodes/SpreadElement.ts b/src/ast/nodes/SpreadElement.ts index be6e8c72f21..1ea8afa49ef 100644 --- a/src/ast/nodes/SpreadElement.ts +++ b/src/ast/nodes/SpreadElement.ts @@ -1,5 +1,5 @@ import type { NormalizedTreeshakingOptions } from '../../rollup/types'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { NODE_INTERACTION_UNKNOWN_ACCESS } from '../NodeInteractions'; import { @@ -45,6 +45,11 @@ export default class SpreadElement extends NodeBase { ); } + includeNode(context: InclusionContext) { + this.included = true; + this.argument.includePath(UNKNOWN_PATH, context); + } + protected applyDeoptimizations(): void { this.deoptimized = true; // Only properties of properties of the argument could become subject to reassignment diff --git a/src/ast/nodes/TemplateElement.ts b/src/ast/nodes/TemplateElement.ts index 3f894d0280c..c63183830d1 100644 --- a/src/ast/nodes/TemplateElement.ts +++ b/src/ast/nodes/TemplateElement.ts @@ -1,6 +1,6 @@ import type * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; -import { type GenericEsTreeNode, NodeBase } from './shared/Node'; +import { type GenericEsTreeNode, NodeBase, onlyIncludeSelf } from './shared/Node'; export default class TemplateElement extends NodeBase { declare type: NodeType.tTemplateElement; @@ -30,3 +30,5 @@ export default class TemplateElement extends NodeBase { render(): void {} } + +TemplateElement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/TemplateLiteral.ts b/src/ast/nodes/TemplateLiteral.ts index 0134909a88c..5d152c96fa8 100644 --- a/src/ast/nodes/TemplateLiteral.ts +++ b/src/ast/nodes/TemplateLiteral.ts @@ -1,19 +1,20 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED, INTERACTION_CALLED } from '../NodeInteractions'; import type { ObjectPath } from '../utils/PathTracker'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import { getMemberReturnExpressionWhenCalled, hasMemberEffectWhenCalled, literalStringMembers } from '../values'; import type * as NodeType from './NodeType'; -import type TemplateElement from './TemplateElement'; import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expression'; import { UNKNOWN_RETURN_EXPRESSION, UnknownValue } from './shared/Expression'; import { type ExpressionNode, NodeBase } from './shared/Node'; +import type TemplateElement from './TemplateElement'; export default class TemplateLiteral extends NodeBase { declare expressions: ExpressionNode[]; @@ -52,6 +53,13 @@ export default class TemplateLiteral extends NodeBase { return true; } + includeNode(context: InclusionContext) { + this.included = true; + for (const node of this.expressions) { + node.includePath(UNKNOWN_PATH, context); + } + } + render(code: MagicString, options: RenderOptions): void { (code.indentExclusionRanges as [number, number][]).push([this.start, this.end]); super.render(code, options); diff --git a/src/ast/nodes/ThrowStatement.ts b/src/ast/nodes/ThrowStatement.ts index 3083671d652..6b42c7ac4f6 100644 --- a/src/ast/nodes/ThrowStatement.ts +++ b/src/ast/nodes/ThrowStatement.ts @@ -2,7 +2,12 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; import { type InclusionContext } from '../ExecutionContext'; import type * as NodeType from './NodeType'; -import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; +import { + type ExpressionNode, + type IncludeChildren, + onlyIncludeSelf, + StatementBase +} from './shared/Node'; export default class ThrowStatement extends StatementBase { declare argument: ExpressionNode; @@ -25,3 +30,5 @@ export default class ThrowStatement extends StatementBase { } } } + +ThrowStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/TryStatement.ts b/src/ast/nodes/TryStatement.ts index 3f6462dbcdb..2456a6a9cac 100644 --- a/src/ast/nodes/TryStatement.ts +++ b/src/ast/nodes/TryStatement.ts @@ -3,7 +3,12 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type BlockStatement from './BlockStatement'; import type CatchClause from './CatchClause'; import type * as NodeType from './NodeType'; -import { INCLUDE_PARAMETERS, type IncludeChildren, StatementBase } from './shared/Node'; +import { + INCLUDE_PARAMETERS, + type IncludeChildren, + onlyIncludeSelf, + StatementBase +} from './shared/Node'; export default class TryStatement extends StatementBase { declare block: BlockStatement; @@ -50,3 +55,5 @@ export default class TryStatement extends StatementBase { this.finalizer?.include(context, includeChildrenRecursively); } } + +TryStatement.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/UnaryExpression.ts b/src/ast/nodes/UnaryExpression.ts index b8f72c42d5e..8e39a86d2f0 100644 --- a/src/ast/nodes/UnaryExpression.ts +++ b/src/ast/nodes/UnaryExpression.ts @@ -8,7 +8,7 @@ import type { LiteralValue } from './Literal'; import type * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { type LiteralValueOrUnknown, UnknownValue } from './shared/Expression'; -import { type ExpressionNode, NodeBase } from './shared/Node'; +import { type ExpressionNode, NodeBase, onlyIncludeSelf } from './shared/Node'; const unaryOperators: Record LiteralValueOrUnknown> = { '!': value => !value, @@ -70,3 +70,5 @@ export default class UnaryExpression extends NodeBase { } } } + +UnaryExpression.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/YieldExpression.ts b/src/ast/nodes/YieldExpression.ts index cc44e8ea1e0..84e65765ce5 100644 --- a/src/ast/nodes/YieldExpression.ts +++ b/src/ast/nodes/YieldExpression.ts @@ -1,6 +1,7 @@ import type MagicString from 'magic-string'; import type { RenderOptions } from '../../utils/renderHelpers'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; +import { UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { type ExpressionNode, NodeBase } from './shared/Node'; @@ -14,6 +15,11 @@ export default class YieldExpression extends NodeBase { return !(context.ignore.returnYield && !this.argument?.hasEffects(context)); } + includeNode(context: InclusionContext) { + this.included = true; + this.argument?.includePath(UNKNOWN_PATH, context); + } + render(code: MagicString, options: RenderOptions): void { if (this.argument) { this.argument.render(code, options, { preventASI: true }); diff --git a/src/ast/nodes/shared/ClassNode.ts b/src/ast/nodes/shared/ClassNode.ts index bad31aa39b8..044fc4fcc49 100644 --- a/src/ast/nodes/shared/ClassNode.ts +++ b/src/ast/nodes/shared/ClassNode.ts @@ -19,7 +19,7 @@ import type Literal from '../Literal'; import MethodDefinition from '../MethodDefinition'; import { isStaticBlock } from '../StaticBlock'; import { type ExpressionEntity, type LiteralValueOrUnknown } from './Expression'; -import { type ExpressionNode, type IncludeChildren, NodeBase } from './Node'; +import { type ExpressionNode, type IncludeChildren, NodeBase, onlyIncludeSelf } from './Node'; import { ObjectEntity, type ObjectProperty } from './ObjectEntity'; import { ObjectMember } from './ObjectMember'; import { OBJECT_PROTOTYPE } from './ObjectPrototype'; @@ -188,3 +188,5 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { )); } } + +ClassNode.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/shared/JSXClosingBase.ts b/src/ast/nodes/shared/JSXClosingBase.ts index 9cb69e19bd7..19d672888df 100644 --- a/src/ast/nodes/shared/JSXClosingBase.ts +++ b/src/ast/nodes/shared/JSXClosingBase.ts @@ -1,7 +1,7 @@ import type MagicString from 'magic-string'; import type { NormalizedJsxOptions } from '../../../rollup/types'; import type { RenderOptions } from '../../../utils/renderHelpers'; -import { NodeBase } from './Node'; +import { NodeBase, onlyIncludeSelf } from './Node'; export default class JSXClosingBase extends NodeBase { render(code: MagicString, options: RenderOptions): void { @@ -13,3 +13,5 @@ export default class JSXClosingBase extends NodeBase { } } } + +JSXClosingBase.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/shared/JSXElementBase.ts b/src/ast/nodes/shared/JSXElementBase.ts index ae4e7e6532f..d7f7c077795 100644 --- a/src/ast/nodes/shared/JSXElementBase.ts +++ b/src/ast/nodes/shared/JSXElementBase.ts @@ -34,7 +34,7 @@ export default class JSXElementBase extends NodeBase { } includeNode(context: InclusionContext) { - super.includeNode(context); + this.included = true; const { factory, importSource, mode } = this.jsxMode; if (factory) { this.factory = factory; diff --git a/src/ast/nodes/shared/MethodBase.ts b/src/ast/nodes/shared/MethodBase.ts index 5ca69cfa066..ef997eefce0 100644 --- a/src/ast/nodes/shared/MethodBase.ts +++ b/src/ast/nodes/shared/MethodBase.ts @@ -20,7 +20,7 @@ import { type LiteralValueOrUnknown, UNKNOWN_RETURN_EXPRESSION } from './Expression'; -import { type ExpressionNode, NodeBase } from './Node'; +import { type ExpressionNode, NodeBase, onlyIncludeSelf } from './Node'; import type { DeclarationPatternNode } from './Pattern'; export default class MethodBase extends NodeBase implements DeoptimizableEntity { @@ -155,3 +155,5 @@ export default class MethodBase extends NodeBase implements DeoptimizableEntity return this.accessedValue; } } + +MethodBase.prototype.includeNode = onlyIncludeSelf; diff --git a/src/ast/nodes/shared/Node.ts b/src/ast/nodes/shared/Node.ts index ab1b19468e7..6b7f86c9355 100644 --- a/src/ast/nodes/shared/Node.ts +++ b/src/ast/nodes/shared/Node.ts @@ -255,8 +255,6 @@ export class NodeBase extends ExpressionEntity implements ExpressionNode { } includeNode(context: InclusionContext) { - // TODO Lukas remove - // console.log('NodeBase.includeNode', this.type, logNode(this)); this.included = true; for (const key of childNodeKeys[this.type]) { const value = (this as GenericEsTreeNode)[key]; diff --git a/test/form/samples/jsx/transpiles-empty-fragment/_expected.js b/test/form/samples/jsx/transpiles-empty-fragment/_expected.js index fd1687b4abe..5fd112f7f75 100644 --- a/test/form/samples/jsx/transpiles-empty-fragment/_expected.js +++ b/test/form/samples/jsx/transpiles-empty-fragment/_expected.js @@ -1,3 +1,3 @@ -import { Fragment, jsx } from 'react/jsx-runtime'; +import { jsx, Fragment } from 'react/jsx-runtime'; console.log(/*#__PURE__*/jsx(Fragment, {})); diff --git a/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_config.js b/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_config.js new file mode 100644 index 00000000000..ac6cebc360a --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'tracks property access through optional chains' +}); diff --git a/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_expected.js b/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_expected.js new file mode 100644 index 00000000000..642bd2e3d1b --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/_expected.js @@ -0,0 +1,3 @@ +const a = { b: { c: 1}}; +const b = a?.b; +console.log(b?.c); diff --git a/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/main.js b/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/main.js new file mode 100644 index 00000000000..bbbc0e5f09b --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/track-through-chain-expressions/main.js @@ -0,0 +1,3 @@ +const a = { b: { c: 1, removed: true }, removed: true }; +const b = a?.b; +console.log(b?.c); diff --git a/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_config.js b/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_config.js new file mode 100644 index 00000000000..2c211e43c55 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_config.js @@ -0,0 +1,4 @@ +module.exports = defineTest({ + description: 'tree-shakes unused properties of JSX namespaces', + options: { jsx: 'preserve' } +}); diff --git a/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_expected.js b/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_expected.js new file mode 100644 index 00000000000..00696f749a5 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/_expected.js @@ -0,0 +1,7 @@ +const ns = { + Bar: () => null +}; + +const a = ; + +export { a }; diff --git a/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/main.js b/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/main.js new file mode 100644 index 00000000000..0fbcaca66d9 --- /dev/null +++ b/test/form/samples/object-expression-treeshaking/tree-shake-jsx-namespace/main.js @@ -0,0 +1,6 @@ +const ns = { + Foo: () => null, + Bar: () => null +} + +export const a = diff --git a/test/form/samples/pure-comment-scenarios-complex/_expected.js b/test/form/samples/pure-comment-scenarios-complex/_expected.js index 49468bd313e..c3e88f5e94e 100644 --- a/test/form/samples/pure-comment-scenarios-complex/_expected.js +++ b/test/form/samples/pure-comment-scenarios-complex/_expected.js @@ -19,4 +19,4 @@ bar(); "foo" + /* @__PURE__ */(function(){})() ? bar() : baz(); /* @__PURE__ */(function(){})() ? foo() : foo(); foo() ; -!{ foo: /* @__PURE__ */(function(){})() } ? bar() : baz(); +!{ } ? bar() : baz(); diff --git a/test/function/samples/object-expression-treeshaking/retain-property-definition-paths/_config.js b/test/function/samples/object-expression-treeshaking/retain-property-definition-paths/_config.js new file mode 100644 index 00000000000..b9af1759f4f --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/retain-property-definition-paths/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'ensures that paths of property definitions are retained' +}); diff --git a/test/function/samples/object-expression-treeshaking/retain-property-definition-paths/main.js b/test/function/samples/object-expression-treeshaking/retain-property-definition-paths/main.js new file mode 100644 index 00000000000..7110c9874fa --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/retain-property-definition-paths/main.js @@ -0,0 +1,5 @@ +class Test { + foo = { x: 1 }; +} + +assert.strictEqual(new Test().foo.x, 1); From 0ee3d44438fd2f484504a489a26dcee1ffc390f8 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 11 Dec 2024 06:41:56 +0100 Subject: [PATCH 11/32] Remove unnecessary applyDeoptimizations calls --- src/ast/nodes/ArrowFunctionExpression.ts | 1 - src/ast/nodes/MethodDefinition.ts | 2 +- src/ast/nodes/Property.ts | 3 --- src/ast/nodes/shared/FunctionBase.ts | 1 - src/ast/nodes/shared/FunctionNode.ts | 2 -- 5 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/ast/nodes/ArrowFunctionExpression.ts b/src/ast/nodes/ArrowFunctionExpression.ts index e9eaffbe470..0f79ea808ff 100644 --- a/src/ast/nodes/ArrowFunctionExpression.ts +++ b/src/ast/nodes/ArrowFunctionExpression.ts @@ -35,7 +35,6 @@ export default class ArrowFunctionExpression extends FunctionBase { } hasEffects(): boolean { - if (!this.deoptimized) this.applyDeoptimizations(); return false; } diff --git a/src/ast/nodes/MethodDefinition.ts b/src/ast/nodes/MethodDefinition.ts index d4d66b48ca5..41dc6762ecd 100644 --- a/src/ast/nodes/MethodDefinition.ts +++ b/src/ast/nodes/MethodDefinition.ts @@ -14,8 +14,8 @@ export default class MethodDefinition extends MethodBase { declare type: NodeType.tMethodDefinition; declare value: FunctionExpression; declare decorators: Decorator[]; + hasEffects(context: HasEffectsContext): boolean { return super.hasEffects(context) || checkEffectForNodes(this.decorators, context); } - protected applyDeoptimizations() {} } diff --git a/src/ast/nodes/Property.ts b/src/ast/nodes/Property.ts index 6c6e0f874b8..e28ab4deb8a 100644 --- a/src/ast/nodes/Property.ts +++ b/src/ast/nodes/Property.ts @@ -57,7 +57,6 @@ export default class Property extends MethodBase implements DeclarationPatternNo } hasEffects(context: HasEffectsContext): boolean { - if (!this.deoptimized) this.applyDeoptimizations(); return this.key.hasEffects(context) || this.value.hasEffects(context); } @@ -116,8 +115,6 @@ export default class Property extends MethodBase implements DeclarationPatternNo this.value.render(code, options, { isShorthandProperty: this.shorthand }); } - protected applyDeoptimizations(): void {} - private getPathInProperty(destructuredInitPath: ObjectPath): ObjectPath { return destructuredInitPath.at(-1) === UnknownKey ? destructuredInitPath diff --git a/src/ast/nodes/shared/FunctionBase.ts b/src/ast/nodes/shared/FunctionBase.ts index 47f2ece1445..cf5af4fe25a 100644 --- a/src/ast/nodes/shared/FunctionBase.ts +++ b/src/ast/nodes/shared/FunctionBase.ts @@ -192,7 +192,6 @@ export default abstract class FunctionBase extends NodeBase { this.parameterVariableValuesDeoptimized = true; this.scope.reassignAllParameters(); } - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); const { brokenFlow } = context; context.brokenFlow = false; diff --git a/src/ast/nodes/shared/FunctionNode.ts b/src/ast/nodes/shared/FunctionNode.ts index 766936ff4cb..4e32368a8ce 100644 --- a/src/ast/nodes/shared/FunctionNode.ts +++ b/src/ast/nodes/shared/FunctionNode.ts @@ -48,8 +48,6 @@ export default class FunctionNode extends FunctionBase { } hasEffects(context: HasEffectsContext): boolean { - if (!this.deoptimized) this.applyDeoptimizations(); - if (this.annotationNoSideEffects) { return false; } From ddad67b47ecdb20a3804b607928c0c38702b7811 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 13 Dec 2024 09:03:18 +0100 Subject: [PATCH 12/32] Move applyDeoptimizations check from include to includeNode This should avoid an unnecessary check. --- src/ast/nodes/ArrayExpression.ts | 3 ++- src/ast/nodes/AssignmentExpression.ts | 3 ++- src/ast/nodes/AssignmentPattern.ts | 3 ++- src/ast/nodes/AwaitExpression.ts | 4 ++-- src/ast/nodes/BinaryExpression.ts | 10 ++++++++-- src/ast/nodes/BlockStatement.ts | 6 ++++-- src/ast/nodes/BreakStatement.ts | 5 +++-- src/ast/nodes/CallExpression.ts | 4 ++-- src/ast/nodes/ChainExpression.ts | 12 ++++++++---- src/ast/nodes/ClassBody.ts | 8 ++++---- src/ast/nodes/ClassDeclaration.ts | 2 +- src/ast/nodes/ConditionalExpression.ts | 5 +++-- src/ast/nodes/ContinueStatement.ts | 5 +++-- src/ast/nodes/DoWhileStatement.ts | 8 +++++--- src/ast/nodes/ExportAllDeclaration.ts | 7 +++---- src/ast/nodes/ExportDefaultDeclaration.ts | 8 ++++---- src/ast/nodes/ExportNamedDeclaration.ts | 7 +++---- src/ast/nodes/ExportSpecifier.ts | 7 +++---- src/ast/nodes/ExpressionStatement.ts | 12 ++++++++---- src/ast/nodes/ForInStatement.ts | 3 ++- src/ast/nodes/ForOfStatement.ts | 3 ++- src/ast/nodes/ForStatement.ts | 6 ++++-- src/ast/nodes/IfStatement.ts | 8 ++++---- src/ast/nodes/ImportDeclaration.ts | 7 +++---- src/ast/nodes/ImportDefaultSpecifier.ts | 7 +++---- src/ast/nodes/ImportExpression.ts | 5 +++-- src/ast/nodes/ImportNamespaceSpecifier.ts | 7 +++---- src/ast/nodes/ImportSpecifier.ts | 7 +++---- src/ast/nodes/JSXExpressionContainer.ts | 1 + src/ast/nodes/JSXIdentifier.ts | 2 +- src/ast/nodes/JSXMemberExpression.ts | 1 + src/ast/nodes/JSXOpeningFragment.ts | 1 + src/ast/nodes/LabeledStatement.ts | 9 ++++++++- src/ast/nodes/LogicalExpression.ts | 6 ++++-- src/ast/nodes/MemberExpression.ts | 5 ++--- src/ast/nodes/NewExpression.ts | 4 ++-- src/ast/nodes/ObjectExpression.ts | 6 +++--- src/ast/nodes/ObjectPattern.ts | 7 +++---- src/ast/nodes/Program.ts | 13 +++++++++---- src/ast/nodes/Property.ts | 5 +++-- src/ast/nodes/PropertyDefinition.ts | 6 +++--- src/ast/nodes/RestElement.ts | 2 +- src/ast/nodes/ReturnStatement.ts | 9 ++++++++- src/ast/nodes/SequenceExpression.ts | 6 ++++-- src/ast/nodes/SpreadElement.ts | 3 ++- src/ast/nodes/StaticBlock.ts | 6 ++++-- src/ast/nodes/Super.ts | 1 + src/ast/nodes/SwitchCase.ts | 6 ++++-- src/ast/nodes/SwitchStatement.ts | 5 +++-- src/ast/nodes/TaggedTemplateExpression.ts | 3 +-- src/ast/nodes/TemplateLiteral.ts | 1 + src/ast/nodes/ThisExpression.ts | 1 + src/ast/nodes/TryStatement.ts | 6 ++++-- src/ast/nodes/UnaryExpression.ts | 2 +- src/ast/nodes/UpdateExpression.ts | 3 +-- src/ast/nodes/VariableDeclaration.ts | 12 ++++++++---- src/ast/nodes/VariableDeclarator.ts | 3 ++- src/ast/nodes/WhileStatement.ts | 6 ++++-- src/ast/nodes/YieldExpression.ts | 6 ++++++ src/ast/nodes/shared/ClassNode.ts | 3 +-- src/ast/nodes/shared/FunctionBase.ts | 5 +++-- src/ast/nodes/shared/IdentifierBase.ts | 4 ++-- src/ast/nodes/shared/JSXElementBase.ts | 6 +++--- src/ast/nodes/shared/MethodBase.ts | 12 ++++++++---- src/ast/nodes/shared/Node.ts | 15 ++++++++++++--- 65 files changed, 223 insertions(+), 141 deletions(-) diff --git a/src/ast/nodes/ArrayExpression.ts b/src/ast/nodes/ArrayExpression.ts index 5a018096d8a..87897b87c92 100644 --- a/src/ast/nodes/ArrayExpression.ts +++ b/src/ast/nodes/ArrayExpression.ts @@ -68,6 +68,7 @@ export default class ArrayExpression extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); for (const element of this.elements) { if (element) { element?.includePath(UNKNOWN_PATH, context); @@ -75,7 +76,7 @@ export default class ArrayExpression extends NodeBase { } } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; let hasSpread = false; for (let index = 0; index < this.elements.length; index++) { diff --git a/src/ast/nodes/AssignmentExpression.ts b/src/ast/nodes/AssignmentExpression.ts index 1a3f3ec1a0b..f6e395699ab 100644 --- a/src/ast/nodes/AssignmentExpression.ts +++ b/src/ast/nodes/AssignmentExpression.ts @@ -88,6 +88,7 @@ export default class AssignmentExpression extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.right.includePath(UNKNOWN_PATH, context); } @@ -171,7 +172,7 @@ export default class AssignmentExpression extends NodeBase { } } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.left.deoptimizeAssignment(EMPTY_PATH, this.right); this.scope.context.requestTreeshakingPass(); diff --git a/src/ast/nodes/AssignmentPattern.ts b/src/ast/nodes/AssignmentPattern.ts index dc693c11ea3..16669ef9f19 100644 --- a/src/ast/nodes/AssignmentPattern.ts +++ b/src/ast/nodes/AssignmentPattern.ts @@ -82,6 +82,7 @@ export default class AssignmentPattern extends NodeBase implements DeclarationPa includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.right.includePath(UNKNOWN_PATH, context); } @@ -98,7 +99,7 @@ export default class AssignmentPattern extends NodeBase implements DeclarationPa this.right.render(code, options); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.left.deoptimizePath(EMPTY_PATH); this.right.deoptimizePath(UNKNOWN_PATH); diff --git a/src/ast/nodes/AwaitExpression.ts b/src/ast/nodes/AwaitExpression.ts index ee4cf08b854..912cdf02e66 100644 --- a/src/ast/nodes/AwaitExpression.ts +++ b/src/ast/nodes/AwaitExpression.ts @@ -15,13 +15,13 @@ export default class AwaitExpression extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); this.argument.include(context, includeChildrenRecursively); } - includeNode(context: InclusionContext): void { + includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); checkTopLevelAwait: if (!this.scope.context.usesTopLevelAwait) { let parent = this.parent; do { diff --git a/src/ast/nodes/BinaryExpression.ts b/src/ast/nodes/BinaryExpression.ts index 5cd38b0ded2..7a5f261569c 100644 --- a/src/ast/nodes/BinaryExpression.ts +++ b/src/ast/nodes/BinaryExpression.ts @@ -15,7 +15,12 @@ import ExpressionStatement from './ExpressionStatement'; import type { LiteralValue } from './Literal'; import type * as NodeType from './NodeType'; import { type LiteralValueOrUnknown, UnknownValue } from './shared/Expression'; -import { type ExpressionNode, NodeBase, onlyIncludeSelf } from './shared/Node'; +import { + doNotDeoptimize, + type ExpressionNode, + NodeBase, + onlyIncludeSelfNoDeoptimize +} from './shared/Node'; type Operator = | '!=' @@ -126,4 +131,5 @@ export default class BinaryExpression extends NodeBase implements DeoptimizableE } } -BinaryExpression.prototype.includeNode = onlyIncludeSelf; +BinaryExpression.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +BinaryExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/BlockStatement.ts b/src/ast/nodes/BlockStatement.ts index 7e48762cf6d..b8846dcf364 100644 --- a/src/ast/nodes/BlockStatement.ts +++ b/src/ast/nodes/BlockStatement.ts @@ -8,9 +8,10 @@ import * as NodeType from './NodeType'; import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; import { + doNotDeoptimize, type IncludeChildren, type Node, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase, type StatementNode } from './shared/Node'; @@ -84,4 +85,5 @@ export default class BlockStatement extends StatementBase { } } -BlockStatement.prototype.includeNode = onlyIncludeSelf; +BlockStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +BlockStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/BreakStatement.ts b/src/ast/nodes/BreakStatement.ts index 0a3292e7653..501c27dfa08 100644 --- a/src/ast/nodes/BreakStatement.ts +++ b/src/ast/nodes/BreakStatement.ts @@ -1,7 +1,7 @@ import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { onlyIncludeSelf, StatementBase } from './shared/Node'; +import { doNotDeoptimize, onlyIncludeSelfNoDeoptimize, StatementBase } from './shared/Node'; export default class BreakStatement extends StatementBase { declare label: Identifier | null; @@ -31,4 +31,5 @@ export default class BreakStatement extends StatementBase { } } -BreakStatement.prototype.includeNode = onlyIncludeSelf; +BreakStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +BreakStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/CallExpression.ts b/src/ast/nodes/CallExpression.ts index ccc8b77fedd..fc6fe5a012e 100644 --- a/src/ast/nodes/CallExpression.ts +++ b/src/ast/nodes/CallExpression.ts @@ -112,7 +112,6 @@ export default class CallExpression } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { super.include(context, includeChildrenRecursively); if ( @@ -139,6 +138,7 @@ export default class CallExpression includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.callee.includePath(UNKNOWN_PATH, context); } @@ -164,7 +164,7 @@ export default class CallExpression renderCallArguments(code, options, this); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.callee.deoptimizeArgumentsOnInteractionAtPath( this.interaction, diff --git a/src/ast/nodes/ChainExpression.ts b/src/ast/nodes/ChainExpression.ts index 039f3183a5c..8d6c93ead95 100644 --- a/src/ast/nodes/ChainExpression.ts +++ b/src/ast/nodes/ChainExpression.ts @@ -6,7 +6,12 @@ import type CallExpression from './CallExpression'; import type MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; import type { LiteralValueOrUnknown } from './shared/Expression'; -import { IS_SKIPPED_CHAIN, NodeBase, onlyIncludeSelf } from './shared/Node'; +import { + doNotDeoptimize, + IS_SKIPPED_CHAIN, + NodeBase, + onlyIncludeSelfNoDeoptimize +} from './shared/Node'; export default class ChainExpression extends NodeBase implements DeoptimizableEntity { declare expression: CallExpression | MemberExpression; @@ -40,8 +45,7 @@ export default class ChainExpression extends NodeBase implements DeoptimizableEn removeAnnotations(code: MagicString) { this.expression.removeAnnotations(code); } - - protected applyDeoptimizations() {} } -ChainExpression.prototype.includeNode = onlyIncludeSelf; +ChainExpression.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ChainExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ClassBody.ts b/src/ast/nodes/ClassBody.ts index 2b62ff39295..c04c8e70242 100644 --- a/src/ast/nodes/ClassBody.ts +++ b/src/ast/nodes/ClassBody.ts @@ -8,10 +8,11 @@ import type * as NodeType from './NodeType'; import type PropertyDefinition from './PropertyDefinition'; import type ClassNode from './shared/ClassNode'; import { + doNotDeoptimize, type GenericEsTreeNode, type IncludeChildren, NodeBase, - onlyIncludeSelf + onlyIncludeSelfNoDeoptimize } from './shared/Node'; import type StaticBlock from './StaticBlock'; @@ -43,8 +44,7 @@ export default class ClassBody extends NodeBase { } return super.parseNode(esTreeNode); } - - protected applyDeoptimizations() {} } -ClassBody.prototype.includeNode = onlyIncludeSelf; +ClassBody.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ClassBody.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ClassDeclaration.ts b/src/ast/nodes/ClassDeclaration.ts index 76b1465cc41..fdb0bd576d6 100644 --- a/src/ast/nodes/ClassDeclaration.ts +++ b/src/ast/nodes/ClassDeclaration.ts @@ -55,7 +55,7 @@ export default class ClassDeclaration extends ClassNode { super.render(code, options); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { super.applyDeoptimizations(); const { id, scope } = this; if (id) { diff --git a/src/ast/nodes/ConditionalExpression.ts b/src/ast/nodes/ConditionalExpression.ts index 14a413b2497..41f59e001f5 100644 --- a/src/ast/nodes/ConditionalExpression.ts +++ b/src/ast/nodes/ConditionalExpression.ts @@ -19,7 +19,7 @@ import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expressio import { UnknownValue } from './shared/Expression'; import { MultiExpression } from './shared/MultiExpression'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ConditionalExpression extends NodeBase implements DeoptimizableEntity { declare alternate: ExpressionNode; @@ -232,4 +232,5 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz } } -ConditionalExpression.prototype.includeNode = onlyIncludeSelf; +ConditionalExpression.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ConditionalExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ContinueStatement.ts b/src/ast/nodes/ContinueStatement.ts index 9341140f3c7..e7a0130fdd3 100644 --- a/src/ast/nodes/ContinueStatement.ts +++ b/src/ast/nodes/ContinueStatement.ts @@ -1,7 +1,7 @@ import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { onlyIncludeSelf, StatementBase } from './shared/Node'; +import { doNotDeoptimize, onlyIncludeSelfNoDeoptimize, StatementBase } from './shared/Node'; export default class ContinueStatement extends StatementBase { declare label: Identifier | null; @@ -31,4 +31,5 @@ export default class ContinueStatement extends StatementBase { } } -ContinueStatement.prototype.includeNode = onlyIncludeSelf; +ContinueStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ContinueStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/DoWhileStatement.ts b/src/ast/nodes/DoWhileStatement.ts index 12695c8365c..1878ca42a65 100644 --- a/src/ast/nodes/DoWhileStatement.ts +++ b/src/ast/nodes/DoWhileStatement.ts @@ -2,9 +2,10 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type * as NodeType from './NodeType'; import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase, type StatementNode } from './shared/Node'; @@ -20,10 +21,11 @@ export default class DoWhileStatement extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.test.include(context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } } -DoWhileStatement.prototype.includeNode = onlyIncludeSelf; +DoWhileStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +DoWhileStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ExportAllDeclaration.ts b/src/ast/nodes/ExportAllDeclaration.ts index 931ff44626a..19b97ec269b 100644 --- a/src/ast/nodes/ExportAllDeclaration.ts +++ b/src/ast/nodes/ExportAllDeclaration.ts @@ -4,7 +4,7 @@ import type Identifier from './Identifier'; import type ImportAttribute from './ImportAttribute'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ExportAllDeclaration extends NodeBase { declare attributes: ImportAttribute[]; @@ -25,9 +25,8 @@ export default class ExportAllDeclaration extends NodeBase { render(code: MagicString, _options: RenderOptions, nodeRenderOptions?: NodeRenderOptions): void { code.remove(nodeRenderOptions!.start!, nodeRenderOptions!.end!); } - - protected applyDeoptimizations() {} } ExportAllDeclaration.prototype.needsBoundaries = true; -ExportAllDeclaration.prototype.includeNode = onlyIncludeSelf; +ExportAllDeclaration.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ExportAllDeclaration.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ExportDefaultDeclaration.ts b/src/ast/nodes/ExportDefaultDeclaration.ts index a3dd8a34e31..91201979294 100644 --- a/src/ast/nodes/ExportDefaultDeclaration.ts +++ b/src/ast/nodes/ExportDefaultDeclaration.ts @@ -17,10 +17,11 @@ import FunctionDeclaration from './FunctionDeclaration'; import type Identifier from './Identifier'; import * as NodeType from './NodeType'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, NodeBase, - onlyIncludeSelf + onlyIncludeSelfNoDeoptimize } from './shared/Node'; // The header ends at the first non-white-space after "default" @@ -119,8 +120,6 @@ export default class ExportDefaultDeclaration extends NodeBase { this.declaration.render(code, options); } - protected applyDeoptimizations() {} - private renderNamedDeclaration( code: MagicString, declarationStart: number, @@ -182,4 +181,5 @@ export default class ExportDefaultDeclaration extends NodeBase { } ExportDefaultDeclaration.prototype.needsBoundaries = true; -ExportDefaultDeclaration.prototype.includeNode = onlyIncludeSelf; +ExportDefaultDeclaration.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ExportDefaultDeclaration.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ExportNamedDeclaration.ts b/src/ast/nodes/ExportNamedDeclaration.ts index 97bc6f4d89b..7b53d090b27 100644 --- a/src/ast/nodes/ExportNamedDeclaration.ts +++ b/src/ast/nodes/ExportNamedDeclaration.ts @@ -7,7 +7,7 @@ import type FunctionDeclaration from './FunctionDeclaration'; import type ImportAttribute from './ImportAttribute'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { type Node, NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, type Node, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; import type VariableDeclaration from './VariableDeclaration'; export default class ExportNamedDeclaration extends NodeBase { @@ -45,9 +45,8 @@ export default class ExportNamedDeclaration extends NodeBase { (this.declaration as Node).render(code, options, { end, start }); } } - - protected applyDeoptimizations() {} } ExportNamedDeclaration.prototype.needsBoundaries = true; -ExportNamedDeclaration.prototype.includeNode = onlyIncludeSelf; +ExportNamedDeclaration.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ExportNamedDeclaration.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ExportSpecifier.ts b/src/ast/nodes/ExportSpecifier.ts index 5fa24b0496f..7937561329f 100644 --- a/src/ast/nodes/ExportSpecifier.ts +++ b/src/ast/nodes/ExportSpecifier.ts @@ -1,14 +1,13 @@ import type Identifier from './Identifier'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ExportSpecifier extends NodeBase { declare exported: Identifier | Literal; declare local: Identifier | Literal; declare type: NodeType.tExportSpecifier; - - protected applyDeoptimizations() {} } -ExportSpecifier.prototype.includeNode = onlyIncludeSelf; +ExportSpecifier.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ExportSpecifier.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ExpressionStatement.ts b/src/ast/nodes/ExpressionStatement.ts index 36543a8fcf2..2aecbf6f433 100644 --- a/src/ast/nodes/ExpressionStatement.ts +++ b/src/ast/nodes/ExpressionStatement.ts @@ -4,7 +4,12 @@ import { logModuleLevelDirective } from '../../utils/logs'; import type { RenderOptions } from '../../utils/renderHelpers'; import type { InclusionContext } from '../ExecutionContext'; import * as NodeType from './NodeType'; -import { type ExpressionNode, onlyIncludeSelf, StatementBase } from './shared/Node'; +import { + doNotDeoptimize, + type ExpressionNode, + onlyIncludeSelfNoDeoptimize, + StatementBase +} from './shared/Node'; export default class ExpressionStatement extends StatementBase { declare directive?: string; @@ -43,8 +48,7 @@ export default class ExpressionStatement extends StatementBase { return super.shouldBeIncluded(context); } - - protected applyDeoptimizations() {} } -ExpressionStatement.prototype.includeNode = onlyIncludeSelf; +ExpressionStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ExpressionStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ForInStatement.ts b/src/ast/nodes/ForInStatement.ts index 8e66f3f88a9..8cd8e453859 100644 --- a/src/ast/nodes/ForInStatement.ts +++ b/src/ast/nodes/ForInStatement.ts @@ -44,6 +44,7 @@ export default class ForInStatement extends StatementBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.right.includePath(UNKNOWN_PATH, context); } @@ -62,7 +63,7 @@ export default class ForInStatement extends StatementBase { this.body.render(code, options); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.left.deoptimizePath(EMPTY_PATH); this.scope.context.requestTreeshakingPass(); diff --git a/src/ast/nodes/ForOfStatement.ts b/src/ast/nodes/ForOfStatement.ts index c1ce7e86e4a..100f3742add 100644 --- a/src/ast/nodes/ForOfStatement.ts +++ b/src/ast/nodes/ForOfStatement.ts @@ -51,6 +51,7 @@ export default class ForOfStatement extends StatementBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.right.includePath(UNKNOWN_PATH, context); } @@ -69,7 +70,7 @@ export default class ForOfStatement extends StatementBase { this.body.render(code, options); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.left.deoptimizePath(EMPTY_PATH); this.right.deoptimizePath(UNKNOWN_PATH); diff --git a/src/ast/nodes/ForStatement.ts b/src/ast/nodes/ForStatement.ts index 37bb22305b1..577c76d41ef 100644 --- a/src/ast/nodes/ForStatement.ts +++ b/src/ast/nodes/ForStatement.ts @@ -6,9 +6,10 @@ import type ChildScope from '../scopes/ChildScope'; import type * as NodeType from './NodeType'; import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase, type StatementNode } from './shared/Node'; @@ -54,4 +55,5 @@ export default class ForStatement extends StatementBase { } } -ForStatement.prototype.includeNode = onlyIncludeSelf; +ForStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ForStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/IfStatement.ts b/src/ast/nodes/IfStatement.ts index 4fc6facb883..9b7919ecbe3 100644 --- a/src/ast/nodes/IfStatement.ts +++ b/src/ast/nodes/IfStatement.ts @@ -10,10 +10,11 @@ import type Identifier from './Identifier'; import * as NodeType from './NodeType'; import { type LiteralValueOrUnknown, UnknownValue } from './shared/Expression'; import { + doNotDeoptimize, type ExpressionNode, type GenericEsTreeNode, type IncludeChildren, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase, type StatementNode } from './shared/Node'; @@ -122,8 +123,6 @@ export default class IfStatement extends StatementBase implements DeoptimizableE this.renderHoistedDeclarations(hoistedDeclarations, code, getPropertyAccess); } - protected applyDeoptimizations() {} - private getTestValue(): LiteralValueOrUnknown { if (this.testValue === unset) { return (this.testValue = tryCastLiteralValueToBoolean( @@ -209,4 +208,5 @@ export default class IfStatement extends StatementBase implements DeoptimizableE } } -IfStatement.prototype.includeNode = onlyIncludeSelf; +IfStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +IfStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ImportDeclaration.ts b/src/ast/nodes/ImportDeclaration.ts index 318346b8dda..d279d26b237 100644 --- a/src/ast/nodes/ImportDeclaration.ts +++ b/src/ast/nodes/ImportDeclaration.ts @@ -6,7 +6,7 @@ import type ImportNamespaceSpecifier from './ImportNamespaceSpecifier'; import type ImportSpecifier from './ImportSpecifier'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ImportDeclaration extends NodeBase { declare attributes: ImportAttribute[]; @@ -30,9 +30,8 @@ export default class ImportDeclaration extends NodeBase { render(code: MagicString, _options: RenderOptions, nodeRenderOptions?: NodeRenderOptions): void { code.remove(nodeRenderOptions!.start!, nodeRenderOptions!.end!); } - - protected applyDeoptimizations() {} } ImportDeclaration.prototype.needsBoundaries = true; -ImportDeclaration.prototype.includeNode = onlyIncludeSelf; +ImportDeclaration.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ImportDeclaration.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ImportDefaultSpecifier.ts b/src/ast/nodes/ImportDefaultSpecifier.ts index a60a0f2b4a3..e355254a564 100644 --- a/src/ast/nodes/ImportDefaultSpecifier.ts +++ b/src/ast/nodes/ImportDefaultSpecifier.ts @@ -1,12 +1,11 @@ import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ImportDefaultSpecifier extends NodeBase { declare local: Identifier; declare type: NodeType.tImportDefaultSpecifier; - - protected applyDeoptimizations() {} } -ImportDefaultSpecifier.prototype.includeNode = onlyIncludeSelf; +ImportDefaultSpecifier.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ImportDefaultSpecifier.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ImportExpression.ts b/src/ast/nodes/ImportExpression.ts index 96fa42add56..8f58789f1d0 100644 --- a/src/ast/nodes/ImportExpression.ts +++ b/src/ast/nodes/ImportExpression.ts @@ -25,6 +25,7 @@ import MemberExpression from './MemberExpression'; import type * as NodeType from './NodeType'; import ObjectPattern from './ObjectPattern'; import { + doNotDeoptimize, type ExpressionNode, type GenericEsTreeNode, type IncludeChildren, @@ -283,8 +284,6 @@ export default class ImportExpression extends NodeBase { this.inlineNamespace = inlineNamespace; } - protected applyDeoptimizations() {} - private getDynamicImportMechanismAndHelper( resolution: Module | ExternalModule | string | null, exportMode: 'none' | 'named' | 'default' | 'external', @@ -390,6 +389,8 @@ export default class ImportExpression extends NodeBase { } } +ImportExpression.prototype.applyDeoptimizations = doNotDeoptimize; + function getInteropHelper( resolution: Module | ExternalModule | string | null, exportMode: 'none' | 'named' | 'default' | 'external', diff --git a/src/ast/nodes/ImportNamespaceSpecifier.ts b/src/ast/nodes/ImportNamespaceSpecifier.ts index 2cc0e089cd4..7fa92cf9638 100644 --- a/src/ast/nodes/ImportNamespaceSpecifier.ts +++ b/src/ast/nodes/ImportNamespaceSpecifier.ts @@ -1,12 +1,11 @@ import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ImportNamespaceSpecifier extends NodeBase { declare local: Identifier; declare type: NodeType.tImportNamespaceSpecifier; - - protected applyDeoptimizations() {} } -ImportNamespaceSpecifier.prototype.includeNode = onlyIncludeSelf; +ImportNamespaceSpecifier.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ImportNamespaceSpecifier.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ImportSpecifier.ts b/src/ast/nodes/ImportSpecifier.ts index e20c7f8c79c..1cde4f4ac81 100644 --- a/src/ast/nodes/ImportSpecifier.ts +++ b/src/ast/nodes/ImportSpecifier.ts @@ -1,14 +1,13 @@ import type Identifier from './Identifier'; import type Literal from './Literal'; import type * as NodeType from './NodeType'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class ImportSpecifier extends NodeBase { declare imported: Identifier | Literal; declare local: Identifier; declare type: NodeType.tImportSpecifier; - - protected applyDeoptimizations() {} } -ImportSpecifier.prototype.includeNode = onlyIncludeSelf; +ImportSpecifier.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ImportSpecifier.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/JSXExpressionContainer.ts b/src/ast/nodes/JSXExpressionContainer.ts index 57c5083ad26..4d71c3891d3 100644 --- a/src/ast/nodes/JSXExpressionContainer.ts +++ b/src/ast/nodes/JSXExpressionContainer.ts @@ -14,6 +14,7 @@ export default class JSXExpressionContainer extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.expression.includePath(UNKNOWN_PATH, context); } diff --git a/src/ast/nodes/JSXIdentifier.ts b/src/ast/nodes/JSXIdentifier.ts index c7651da37e3..89847c43321 100644 --- a/src/ast/nodes/JSXIdentifier.ts +++ b/src/ast/nodes/JSXIdentifier.ts @@ -31,12 +31,12 @@ export default class JSXIdentifier extends IdentifierBase { } include(context: InclusionContext): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); } includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); if (this.variable !== null) { this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } diff --git a/src/ast/nodes/JSXMemberExpression.ts b/src/ast/nodes/JSXMemberExpression.ts index b9348353386..f20963163f1 100644 --- a/src/ast/nodes/JSXMemberExpression.ts +++ b/src/ast/nodes/JSXMemberExpression.ts @@ -11,6 +11,7 @@ export default class JSXMemberExpression extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.object.includePath([this.property.name], context); } diff --git a/src/ast/nodes/JSXOpeningFragment.ts b/src/ast/nodes/JSXOpeningFragment.ts index 85f6a95c952..15d67eac143 100644 --- a/src/ast/nodes/JSXOpeningFragment.ts +++ b/src/ast/nodes/JSXOpeningFragment.ts @@ -17,6 +17,7 @@ export default class JSXOpeningFragment extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); const jsx = this.scope.context.options.jsx as NormalizedJsxOptions; if (jsx.mode === 'automatic') { this.fragment = 'Fragment'; diff --git a/src/ast/nodes/LabeledStatement.ts b/src/ast/nodes/LabeledStatement.ts index 56dc6421132..aea5d278778 100644 --- a/src/ast/nodes/LabeledStatement.ts +++ b/src/ast/nodes/LabeledStatement.ts @@ -8,7 +8,12 @@ import { type HasEffectsContext, type InclusionContext } from '../ExecutionConte import { UNKNOWN_PATH } from '../utils/PathTracker'; import type Identifier from './Identifier'; import type * as NodeType from './NodeType'; -import { type IncludeChildren, StatementBase, type StatementNode } from './shared/Node'; +import { + doNotDeoptimize, + type IncludeChildren, + StatementBase, + type StatementNode +} from './shared/Node'; export default class LabeledStatement extends StatementBase { declare body: StatementNode; @@ -66,3 +71,5 @@ export default class LabeledStatement extends StatementBase { this.body.render(code, options); } } + +LabeledStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/LogicalExpression.ts b/src/ast/nodes/LogicalExpression.ts index f090e90b5ce..aa114bc290f 100644 --- a/src/ast/nodes/LogicalExpression.ts +++ b/src/ast/nodes/LogicalExpression.ts @@ -31,10 +31,11 @@ import { } from './shared/Expression'; import { MultiExpression } from './shared/MultiExpression'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, NodeBase, - onlyIncludeSelf + onlyIncludeSelfNoDeoptimize } from './shared/Node'; export type LogicalOperator = '||' | '&&' | '??'; @@ -285,4 +286,5 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable } } -LogicalExpression.prototype.includeNode = onlyIncludeSelf; +LogicalExpression.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +LogicalExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index 411a4e11037..8f106fab12c 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -359,7 +359,6 @@ export default class MemberExpression } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); this.object.include(context, includeChildrenRecursively); this.property.include(context, includeChildrenRecursively); @@ -367,6 +366,7 @@ export default class MemberExpression includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); if (this.variable) { this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } else if (!this.isUndefined) { @@ -375,7 +375,6 @@ export default class MemberExpression } includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); if (this.variable) { this.variable?.includePath(path, context); @@ -478,7 +477,7 @@ export default class MemberExpression }; } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; const { propertyReadSideEffects } = this.scope.context.options .treeshake as NormalizedTreeshakingOptions; diff --git a/src/ast/nodes/NewExpression.ts b/src/ast/nodes/NewExpression.ts index f95c1594571..431a72f9fdb 100644 --- a/src/ast/nodes/NewExpression.ts +++ b/src/ast/nodes/NewExpression.ts @@ -42,7 +42,6 @@ export default class NewExpression extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (includeChildrenRecursively) { super.include(context, includeChildrenRecursively); } else { @@ -54,6 +53,7 @@ export default class NewExpression extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.callee.includePath(UNKNOWN_PATH, context); } @@ -77,7 +77,7 @@ export default class NewExpression extends NodeBase { renderCallArguments(code, options, this); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.callee.deoptimizeArgumentsOnInteractionAtPath( this.interaction, diff --git a/src/ast/nodes/ObjectExpression.ts b/src/ast/nodes/ObjectExpression.ts index 99869491b6d..942a9743bf8 100644 --- a/src/ast/nodes/ObjectExpression.ts +++ b/src/ast/nodes/ObjectExpression.ts @@ -20,7 +20,7 @@ import * as NodeType from './NodeType'; import type Property from './Property'; import type { ExpressionEntity, LiteralValueOrUnknown } from './shared/Expression'; import type { IncludeChildren } from './shared/Node'; -import { NodeBase } from './shared/Node'; +import { doNotDeoptimize, NodeBase } from './shared/Node'; import { ObjectEntity, type ObjectProperty } from './shared/ObjectEntity'; import { OBJECT_PROTOTYPE } from './shared/ObjectPrototype'; import SpreadElement from './SpreadElement'; @@ -131,8 +131,6 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE } } - protected applyDeoptimizations() {} - private getObjectEntity(): ObjectEntity { if (this.objectEntity !== null) { return this.objectEntity; @@ -176,3 +174,5 @@ export default class ObjectExpression extends NodeBase implements DeoptimizableE return (this.objectEntity = new ObjectEntity(properties, prototype)); } } + +ObjectExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/ObjectPattern.ts b/src/ast/nodes/ObjectPattern.ts index 80e9be8b9b5..6a1beedcd01 100644 --- a/src/ast/nodes/ObjectPattern.ts +++ b/src/ast/nodes/ObjectPattern.ts @@ -11,7 +11,7 @@ import * as NodeType from './NodeType'; import type Property from './Property'; import type RestElement from './RestElement'; import type { ExpressionEntity } from './shared/Expression'; -import { NodeBase, onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, NodeBase, onlyIncludeSelfNoDeoptimize } from './shared/Node'; import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -123,8 +123,7 @@ export default class ObjectPattern extends NodeBase implements DeclarationPatter } } } - - protected applyDeoptimizations() {} } -ObjectPattern.prototype.includeNode = onlyIncludeSelf; +ObjectPattern.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +ObjectPattern.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/Program.ts b/src/ast/nodes/Program.ts index eb9ac42e7e6..78f3f81b943 100644 --- a/src/ast/nodes/Program.ts +++ b/src/ast/nodes/Program.ts @@ -11,7 +11,13 @@ import { import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import { createHasEffectsContext } from '../ExecutionContext'; import type * as NodeType from './NodeType'; -import { type IncludeChildren, NodeBase, onlyIncludeSelf, type StatementNode } from './shared/Node'; +import { + doNotDeoptimize, + type IncludeChildren, + NodeBase, + onlyIncludeSelfNoDeoptimize, + type StatementNode +} from './shared/Node'; export default class Program extends NodeBase { declare body: readonly StatementNode[]; @@ -99,8 +105,7 @@ export default class Program extends NodeBase { super.render(code, options); } } - - protected applyDeoptimizations() {} } -Program.prototype.includeNode = onlyIncludeSelf; +Program.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +Program.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/Property.ts b/src/ast/nodes/Property.ts index e28ab4deb8a..c659dfbdefb 100644 --- a/src/ast/nodes/Property.ts +++ b/src/ast/nodes/Property.ts @@ -12,7 +12,7 @@ import { Flag, isFlagSet, setFlag } from './shared/BitFlags'; import { type ExpressionEntity } from './shared/Expression'; import MethodBase from './shared/MethodBase'; import type { ExpressionNode, IncludeChildren } from './shared/Node'; -import { onlyIncludeSelf } from './shared/Node'; +import { doNotDeoptimize, onlyIncludeSelfNoDeoptimize } from './shared/Node'; import type { DeclarationPatternNode, PatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -128,4 +128,5 @@ export default class Property extends MethodBase implements DeclarationPatternNo } } -Property.prototype.includeNode = onlyIncludeSelf; +Property.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +Property.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/PropertyDefinition.ts b/src/ast/nodes/PropertyDefinition.ts index 9d1ef6bc950..1e8d9edca69 100644 --- a/src/ast/nodes/PropertyDefinition.ts +++ b/src/ast/nodes/PropertyDefinition.ts @@ -14,7 +14,7 @@ import { UNKNOWN_RETURN_EXPRESSION, UnknownValue } from './shared/Expression'; -import { type ExpressionNode, NodeBase } from './shared/Node'; +import { doNotDeoptimize, type ExpressionNode, NodeBase } from './shared/Node'; export default class PropertyDefinition extends NodeBase { declare key: ExpressionNode | PrivateIdentifier; @@ -86,6 +86,6 @@ export default class PropertyDefinition extends NodeBase { decorator.includePath(UNKNOWN_PATH, context); } } - - protected applyDeoptimizations() {} } + +PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/RestElement.ts b/src/ast/nodes/RestElement.ts index 4e4cfa140ea..1e742343fc2 100644 --- a/src/ast/nodes/RestElement.ts +++ b/src/ast/nodes/RestElement.ts @@ -92,7 +92,7 @@ export default class RestElement extends NodeBase implements DeclarationPatternN (this.argument as DeclarationPatternNode).markDeclarationReached(); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; if (this.declarationInit !== null) { this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]); diff --git a/src/ast/nodes/ReturnStatement.ts b/src/ast/nodes/ReturnStatement.ts index 66db2c77fb3..695019cd3f4 100644 --- a/src/ast/nodes/ReturnStatement.ts +++ b/src/ast/nodes/ReturnStatement.ts @@ -4,7 +4,12 @@ import { type HasEffectsContext, type InclusionContext } from '../ExecutionConte import { UNKNOWN_PATH } from '../utils/PathTracker'; import type * as NodeType from './NodeType'; import { UNKNOWN_EXPRESSION } from './shared/Expression'; -import { type ExpressionNode, type IncludeChildren, StatementBase } from './shared/Node'; +import { + doNotDeoptimize, + type ExpressionNode, + type IncludeChildren, + StatementBase +} from './shared/Node'; export default class ReturnStatement extends StatementBase { declare argument: ExpressionNode | null; @@ -41,3 +46,5 @@ export default class ReturnStatement extends StatementBase { } } } + +ReturnStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/SequenceExpression.ts b/src/ast/nodes/SequenceExpression.ts index 737898df179..0ba5ba6cbc0 100644 --- a/src/ast/nodes/SequenceExpression.ts +++ b/src/ast/nodes/SequenceExpression.ts @@ -15,10 +15,11 @@ import ExpressionStatement from './ExpressionStatement'; import type * as NodeType from './NodeType'; import type { LiteralValueOrUnknown } from './shared/Expression'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, NodeBase, - onlyIncludeSelf + onlyIncludeSelfNoDeoptimize } from './shared/Node'; export default class SequenceExpression extends NodeBase { @@ -135,4 +136,5 @@ export default class SequenceExpression extends NodeBase { } } -SequenceExpression.prototype.includeNode = onlyIncludeSelf; +SequenceExpression.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +SequenceExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/SpreadElement.ts b/src/ast/nodes/SpreadElement.ts index 1ea8afa49ef..a6f0a99c5db 100644 --- a/src/ast/nodes/SpreadElement.ts +++ b/src/ast/nodes/SpreadElement.ts @@ -47,10 +47,11 @@ export default class SpreadElement extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.argument.includePath(UNKNOWN_PATH, context); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; // Only properties of properties of the argument could become subject to reassignment // This will also reassign the return values of iterators diff --git a/src/ast/nodes/StaticBlock.ts b/src/ast/nodes/StaticBlock.ts index 686b3a2991a..4542cc942cb 100644 --- a/src/ast/nodes/StaticBlock.ts +++ b/src/ast/nodes/StaticBlock.ts @@ -9,8 +9,9 @@ import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; import * as NodeType from './NodeType'; import { + doNotDeoptimize, type IncludeChildren, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase, type StatementNode } from './shared/Node'; @@ -49,7 +50,8 @@ export default class StaticBlock extends StatementBase { } } -StaticBlock.prototype.includeNode = onlyIncludeSelf; +StaticBlock.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +StaticBlock.prototype.applyDeoptimizations = doNotDeoptimize; export function isStaticBlock(statement: StatementNode): statement is StaticBlock { return statement.type === NodeType.StaticBlock; diff --git a/src/ast/nodes/Super.ts b/src/ast/nodes/Super.ts index 8cd486ac318..f91ed0e709d 100644 --- a/src/ast/nodes/Super.ts +++ b/src/ast/nodes/Super.ts @@ -32,6 +32,7 @@ export default class Super extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } } diff --git a/src/ast/nodes/SwitchCase.ts b/src/ast/nodes/SwitchCase.ts index e42fdcdc2f4..8d0e437a08c 100644 --- a/src/ast/nodes/SwitchCase.ts +++ b/src/ast/nodes/SwitchCase.ts @@ -8,10 +8,11 @@ import { import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type * as NodeType from './NodeType'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, NodeBase, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, type StatementNode } from './shared/Node'; @@ -56,4 +57,5 @@ export default class SwitchCase extends NodeBase { } SwitchCase.prototype.needsBoundaries = true; -SwitchCase.prototype.includeNode = onlyIncludeSelf; +SwitchCase.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +SwitchCase.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/SwitchStatement.ts b/src/ast/nodes/SwitchStatement.ts index c74204dc41b..1843ad80c35 100644 --- a/src/ast/nodes/SwitchStatement.ts +++ b/src/ast/nodes/SwitchStatement.ts @@ -9,7 +9,7 @@ import BlockScope from '../scopes/BlockScope'; import type ChildScope from '../scopes/ChildScope'; import type * as NodeType from './NodeType'; import type { ExpressionNode, GenericEsTreeNode, IncludeChildren } from './shared/Node'; -import { onlyIncludeSelf, StatementBase } from './shared/Node'; +import { doNotDeoptimize, onlyIncludeSelfNoDeoptimize, StatementBase } from './shared/Node'; import type SwitchCase from './SwitchCase'; export default class SwitchStatement extends StatementBase { @@ -107,4 +107,5 @@ export default class SwitchStatement extends StatementBase { } } -SwitchStatement.prototype.includeNode = onlyIncludeSelf; +SwitchStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +SwitchStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/TaggedTemplateExpression.ts b/src/ast/nodes/TaggedTemplateExpression.ts index 3da7b54c367..7228d260e0b 100644 --- a/src/ast/nodes/TaggedTemplateExpression.ts +++ b/src/ast/nodes/TaggedTemplateExpression.ts @@ -46,7 +46,6 @@ export default class TaggedTemplateExpression extends CallExpressionBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); if (includeChildrenRecursively) { super.include(context, includeChildrenRecursively); @@ -80,7 +79,7 @@ export default class TaggedTemplateExpression extends CallExpressionBase { this.quasi.render(code, options); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.tag.deoptimizeArgumentsOnInteractionAtPath( this.interaction, diff --git a/src/ast/nodes/TemplateLiteral.ts b/src/ast/nodes/TemplateLiteral.ts index 5d152c96fa8..ee0279a55e0 100644 --- a/src/ast/nodes/TemplateLiteral.ts +++ b/src/ast/nodes/TemplateLiteral.ts @@ -55,6 +55,7 @@ export default class TemplateLiteral extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); for (const node of this.expressions) { node.includePath(UNKNOWN_PATH, context); } diff --git a/src/ast/nodes/ThisExpression.ts b/src/ast/nodes/ThisExpression.ts index dac38cc4bb1..643a12f8767 100644 --- a/src/ast/nodes/ThisExpression.ts +++ b/src/ast/nodes/ThisExpression.ts @@ -49,6 +49,7 @@ export default class ThisExpression extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } diff --git a/src/ast/nodes/TryStatement.ts b/src/ast/nodes/TryStatement.ts index 2456a6a9cac..51e34f5c5fa 100644 --- a/src/ast/nodes/TryStatement.ts +++ b/src/ast/nodes/TryStatement.ts @@ -4,9 +4,10 @@ import type BlockStatement from './BlockStatement'; import type CatchClause from './CatchClause'; import type * as NodeType from './NodeType'; import { + doNotDeoptimize, INCLUDE_PARAMETERS, type IncludeChildren, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase } from './shared/Node'; @@ -56,4 +57,5 @@ export default class TryStatement extends StatementBase { } } -TryStatement.prototype.includeNode = onlyIncludeSelf; +TryStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +TryStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/UnaryExpression.ts b/src/ast/nodes/UnaryExpression.ts index 8e39a86d2f0..4f5b3accbc3 100644 --- a/src/ast/nodes/UnaryExpression.ts +++ b/src/ast/nodes/UnaryExpression.ts @@ -62,7 +62,7 @@ export default class UnaryExpression extends NodeBase { return type !== INTERACTION_ACCESSED || path.length > (this.operator === 'void' ? 0 : 1); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; if (this.operator === 'delete') { this.argument.deoptimizePath(EMPTY_PATH); diff --git a/src/ast/nodes/UpdateExpression.ts b/src/ast/nodes/UpdateExpression.ts index 5ee8322ff0b..eaa3a7db893 100644 --- a/src/ast/nodes/UpdateExpression.ts +++ b/src/ast/nodes/UpdateExpression.ts @@ -32,7 +32,6 @@ export default class UpdateExpression extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); this.argument.includeAsAssignmentTarget(context, includeChildrenRecursively, true); } @@ -82,7 +81,7 @@ export default class UpdateExpression extends NodeBase { } } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; this.argument.deoptimizePath(EMPTY_PATH); if (this.argument instanceof Identifier) { diff --git a/src/ast/nodes/VariableDeclaration.ts b/src/ast/nodes/VariableDeclaration.ts index 7af5d3dcc4a..e840965f42d 100644 --- a/src/ast/nodes/VariableDeclaration.ts +++ b/src/ast/nodes/VariableDeclaration.ts @@ -21,7 +21,12 @@ import Identifier, { type IdentifierWithVariable } from './Identifier'; import * as NodeType from './NodeType'; import ObjectPattern from './ObjectPattern'; import type { InclusionOptions } from './shared/Expression'; -import { type IncludeChildren, NodeBase, onlyIncludeSelf } from './shared/Node'; +import { + doNotDeoptimize, + type IncludeChildren, + NodeBase, + onlyIncludeSelfNoDeoptimize +} from './shared/Node'; import type { VariableDeclarationKind } from './shared/VariableKinds'; import type VariableDeclarator from './VariableDeclarator'; @@ -118,8 +123,6 @@ export default class VariableDeclaration extends NodeBase { } } - protected applyDeoptimizations() {} - private renderDeclarationEnd( code: MagicString, separatorString: string, @@ -279,4 +282,5 @@ function gatherSystemExportsAndGetSingleExport( return singleSystemExport; } -VariableDeclaration.prototype.includeNode = onlyIncludeSelf; +VariableDeclaration.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +VariableDeclaration.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/VariableDeclarator.ts b/src/ast/nodes/VariableDeclarator.ts index 971391cb7d7..1f737494482 100644 --- a/src/ast/nodes/VariableDeclarator.ts +++ b/src/ast/nodes/VariableDeclarator.ts @@ -101,7 +101,8 @@ export default class VariableDeclarator extends NodeBase { } } - protected applyDeoptimizations() { + // TODO Lukas is this not something for includeNode? + applyDeoptimizations() { this.deoptimized = true; const { id, init } = this; if (init && id instanceof Identifier && init instanceof ClassExpression && !init.id) { diff --git a/src/ast/nodes/WhileStatement.ts b/src/ast/nodes/WhileStatement.ts index 09fb3d15f42..bfc24f56b7d 100644 --- a/src/ast/nodes/WhileStatement.ts +++ b/src/ast/nodes/WhileStatement.ts @@ -2,9 +2,10 @@ import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type * as NodeType from './NodeType'; import { hasLoopBodyEffects, includeLoopBody } from './shared/loops'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, - onlyIncludeSelf, + onlyIncludeSelfNoDeoptimize, StatementBase, type StatementNode } from './shared/Node'; @@ -26,4 +27,5 @@ export default class WhileStatement extends StatementBase { } } -WhileStatement.prototype.includeNode = onlyIncludeSelf; +WhileStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +WhileStatement.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/YieldExpression.ts b/src/ast/nodes/YieldExpression.ts index 84e65765ce5..e342f6a6446 100644 --- a/src/ast/nodes/YieldExpression.ts +++ b/src/ast/nodes/YieldExpression.ts @@ -10,6 +10,11 @@ export default class YieldExpression extends NodeBase { declare delegate: boolean; declare type: NodeType.tYieldExpression; + applyDeoptimizations() { + this.deoptimized = true; + this.argument?.deoptimizePath(UNKNOWN_PATH); + } + hasEffects(context: HasEffectsContext): boolean { if (!this.deoptimized) this.applyDeoptimizations(); return !(context.ignore.returnYield && !this.argument?.hasEffects(context)); @@ -17,6 +22,7 @@ export default class YieldExpression extends NodeBase { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); this.argument?.includePath(UNKNOWN_PATH, context); } diff --git a/src/ast/nodes/shared/ClassNode.ts b/src/ast/nodes/shared/ClassNode.ts index 044fc4fcc49..cf94e40902d 100644 --- a/src/ast/nodes/shared/ClassNode.ts +++ b/src/ast/nodes/shared/ClassNode.ts @@ -100,7 +100,6 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); this.superClass?.include(context, includeChildrenRecursively); this.body.include(context, includeChildrenRecursively); @@ -123,7 +122,7 @@ export default class ClassNode extends NodeBase implements DeoptimizableEntity { this.classConstructor = null; } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; for (const definition of this.body.body) { if ( diff --git a/src/ast/nodes/shared/FunctionBase.ts b/src/ast/nodes/shared/FunctionBase.ts index cf5af4fe25a..10a4f974496 100644 --- a/src/ast/nodes/shared/FunctionBase.ts +++ b/src/ast/nodes/shared/FunctionBase.ts @@ -22,6 +22,7 @@ import { Flag, isFlagSet, setFlag } from './BitFlags'; import type { ExpressionEntity, LiteralValueOrUnknown } from './Expression'; import { UNKNOWN_EXPRESSION, UNKNOWN_RETURN_EXPRESSION } from './Expression'; import { + doNotDeoptimize, type ExpressionNode, type GenericEsTreeNode, type IncludeChildren, @@ -199,6 +200,7 @@ export default abstract class FunctionBase extends NodeBase { context.brokenFlow = brokenFlow; } + // TODO Lukas only for ArrowFunctionExpression? includeNode(context: InclusionContext) { this.included = true; this.body.includePath(UNKNOWN_PATH, context); @@ -247,9 +249,8 @@ export default abstract class FunctionBase extends NodeBase { return super.parseNode(esTreeNode); } - protected applyDeoptimizations() {} - protected abstract getObjectEntity(): ObjectEntity; } FunctionBase.prototype.preventChildBlockScope = true; +FunctionBase.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/shared/IdentifierBase.ts b/src/ast/nodes/shared/IdentifierBase.ts index 5043153ee0f..9e151755d6f 100644 --- a/src/ast/nodes/shared/IdentifierBase.ts +++ b/src/ast/nodes/shared/IdentifierBase.ts @@ -128,12 +128,12 @@ export default class IdentifierBase extends NodeBase { } include(context: InclusionContext): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); } includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); if (this.variable !== null) { this.scope.context.includeVariableInModule(this.variable, EMPTY_PATH, context); } @@ -195,7 +195,7 @@ export default class IdentifierBase extends NodeBase { return (this.isTDZAccess = false); } - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; if (this.variable instanceof LocalVariable) { // When accessing a variable from a module without side effects, this diff --git a/src/ast/nodes/shared/JSXElementBase.ts b/src/ast/nodes/shared/JSXElementBase.ts index d7f7c077795..e5bba910d07 100644 --- a/src/ast/nodes/shared/JSXElementBase.ts +++ b/src/ast/nodes/shared/JSXElementBase.ts @@ -9,7 +9,7 @@ import JSXExpressionContainer from '../JSXExpressionContainer'; import type { JSXChild, JsxMode } from './jsxHelpers'; import { getAndIncludeFactoryVariable } from './jsxHelpers'; import type { IncludeChildren } from './Node'; -import { NodeBase } from './Node'; +import { doNotDeoptimize, NodeBase } from './Node'; export default class JSXElementBase extends NodeBase { children!: JSXChild[]; @@ -48,8 +48,6 @@ export default class JSXElementBase extends NodeBase { } } - protected applyDeoptimizations() {} - protected getRenderingMode(): JsxMode { const jsx = this.scope.context.options.jsx as NormalizedJsxOptions; const { mode, factory, importSource } = jsx; @@ -88,3 +86,5 @@ export default class JSXElementBase extends NodeBase { return { childrenEnd, firstChild, hasMultipleChildren }; } } + +JSXElementBase.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/shared/MethodBase.ts b/src/ast/nodes/shared/MethodBase.ts index ef997eefce0..6bd71da55de 100644 --- a/src/ast/nodes/shared/MethodBase.ts +++ b/src/ast/nodes/shared/MethodBase.ts @@ -20,7 +20,12 @@ import { type LiteralValueOrUnknown, UNKNOWN_RETURN_EXPRESSION } from './Expression'; -import { type ExpressionNode, NodeBase, onlyIncludeSelf } from './Node'; +import { + doNotDeoptimize, + type ExpressionNode, + NodeBase, + onlyIncludeSelfNoDeoptimize +} from './Node'; import type { DeclarationPatternNode } from './Pattern'; export default class MethodBase extends NodeBase implements DeoptimizableEntity { @@ -136,8 +141,6 @@ export default class MethodBase extends NodeBase implements DeoptimizableEntity return this.getAccessedValue()[0].hasEffectsOnInteractionAtPath(path, interaction, context); } - protected applyDeoptimizations() {} - protected getAccessedValue(): [expression: ExpressionEntity, isPure: boolean] { if (this.accessedValue === null) { if (this.kind === 'get') { @@ -156,4 +159,5 @@ export default class MethodBase extends NodeBase implements DeoptimizableEntity } } -MethodBase.prototype.includeNode = onlyIncludeSelf; +MethodBase.prototype.includeNode = onlyIncludeSelfNoDeoptimize; +MethodBase.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/shared/Node.ts b/src/ast/nodes/shared/Node.ts index 6b7f86c9355..4bfcf84c334 100644 --- a/src/ast/nodes/shared/Node.ts +++ b/src/ast/nodes/shared/Node.ts @@ -239,7 +239,6 @@ export class NodeBase extends ExpressionEntity implements ExpressionNode { includeChildrenRecursively: IncludeChildren, _options?: InclusionOptions ): void { - if (!this.deoptimized) this.applyDeoptimizations(); if (!this.included) this.includeNode(context); for (const key of childNodeKeys[this.type]) { const value = (this as GenericEsTreeNode)[key]; @@ -256,6 +255,7 @@ export class NodeBase extends ExpressionEntity implements ExpressionNode { includeNode(context: InclusionContext) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); for (const key of childNodeKeys[this.type]) { const value = (this as GenericEsTreeNode)[key]; if (value === null) continue; @@ -361,7 +361,7 @@ export class NodeBase extends ExpressionEntity implements ExpressionNode { * something properly, it is deoptimized. * @protected */ - protected applyDeoptimizations(): void { + applyDeoptimizations() { this.deoptimized = true; for (const key of childNodeKeys[this.type]) { const value = (this as GenericEsTreeNode)[key]; @@ -406,6 +406,15 @@ export function logNode(node: Node): string { return node.scope.context.code.slice(node.start, node.end); } -export function onlyIncludeSelf(this: Node) { +export function onlyIncludeSelf(this: NodeBase) { this.included = true; + if (!this.deoptimized) this.applyDeoptimizations(); +} + +export function onlyIncludeSelfNoDeoptimize(this: NodeBase) { + this.included = true; +} + +export function doNotDeoptimize(this: NodeBase) { + this.deoptimized = true; } From 787d7680082fbc3e57460d973281abbcd7515ddc Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 13 Dec 2024 09:06:49 +0100 Subject: [PATCH 13/32] Only deoptimize body for ArrowFunctionExpression For block scopes, this is not needed. --- src/ast/nodes/ArrowFunctionExpression.ts | 3 ++- src/ast/nodes/shared/FunctionBase.ts | 12 ++++-------- src/ast/nodes/shared/FunctionNode.ts | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ast/nodes/ArrowFunctionExpression.ts b/src/ast/nodes/ArrowFunctionExpression.ts index 0f79ea808ff..fc358501634 100644 --- a/src/ast/nodes/ArrowFunctionExpression.ts +++ b/src/ast/nodes/ArrowFunctionExpression.ts @@ -84,7 +84,8 @@ export default class ArrowFunctionExpression extends FunctionBase { } includeNode(context: InclusionContext) { - super.includeNode(context); + this.included = true; + this.body.includePath(UNKNOWN_PATH, context); for (const parameter of this.params) { if (!(parameter instanceof Identifier)) { parameter.includePath(UNKNOWN_PATH, context); diff --git a/src/ast/nodes/shared/FunctionBase.ts b/src/ast/nodes/shared/FunctionBase.ts index 10a4f974496..268acc15cae 100644 --- a/src/ast/nodes/shared/FunctionBase.ts +++ b/src/ast/nodes/shared/FunctionBase.ts @@ -26,7 +26,8 @@ import { type ExpressionNode, type GenericEsTreeNode, type IncludeChildren, - NodeBase + NodeBase, + onlyIncludeSelfNoDeoptimize } from './Node'; import type { ObjectEntity } from './ObjectEntity'; import type { DeclarationPatternNode } from './Pattern'; @@ -189,23 +190,17 @@ export default abstract class FunctionBase extends NodeBase { private parameterVariableValuesDeoptimized = false; include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); if (!(this.parameterVariableValuesDeoptimized || this.onlyFunctionCallUsed())) { this.parameterVariableValuesDeoptimized = true; this.scope.reassignAllParameters(); } - if (!this.included) this.includeNode(context); const { brokenFlow } = context; context.brokenFlow = false; this.body.include(context, includeChildrenRecursively); context.brokenFlow = brokenFlow; } - // TODO Lukas only for ArrowFunctionExpression? - includeNode(context: InclusionContext) { - this.included = true; - this.body.includePath(UNKNOWN_PATH, context); - } - includeCallArguments = this.scope.includeCallArguments.bind(this.scope); initialise(): void { @@ -253,4 +248,5 @@ export default abstract class FunctionBase extends NodeBase { } FunctionBase.prototype.preventChildBlockScope = true; +FunctionBase.prototype.includeNode = onlyIncludeSelfNoDeoptimize; FunctionBase.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/src/ast/nodes/shared/FunctionNode.ts b/src/ast/nodes/shared/FunctionNode.ts index 4e32368a8ce..9b309563b43 100644 --- a/src/ast/nodes/shared/FunctionNode.ts +++ b/src/ast/nodes/shared/FunctionNode.ts @@ -104,7 +104,7 @@ export default class FunctionNode extends FunctionBase { } includeNode(context: InclusionContext) { - super.includeNode(context); + this.included = true; const hasArguments = this.scope.argumentsVariable.included; for (const parameter of this.params) { if (!(parameter instanceof Identifier) || hasArguments) { From 688b6d1ec4569bbc6668a7cedd8f239924f8539b Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 13 Dec 2024 09:10:27 +0100 Subject: [PATCH 14/32] Handle accessed outside variables on includeNode rather than applyDeoptimizations --- src/ast/nodes/VariableDeclarator.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/ast/nodes/VariableDeclarator.ts b/src/ast/nodes/VariableDeclarator.ts index 1f737494482..3169457f713 100644 --- a/src/ast/nodes/VariableDeclarator.ts +++ b/src/ast/nodes/VariableDeclarator.ts @@ -14,10 +14,10 @@ import ClassExpression from './ClassExpression'; import Identifier from './Identifier'; import * as NodeType from './NodeType'; import { + doNotDeoptimize, type ExpressionNode, type IncludeChildren, - NodeBase, - onlyIncludeSelf + NodeBase } from './shared/Node'; import type { DeclarationPatternNode } from './shared/Pattern'; import type { VariableKind } from './shared/VariableKinds'; @@ -38,7 +38,6 @@ export default class VariableDeclarator extends NodeBase { } hasEffects(context: HasEffectsContext): boolean { - if (!this.deoptimized) this.applyDeoptimizations(); const initEffect = this.init?.hasEffects(context); this.id.markDeclarationReached(); return ( @@ -52,9 +51,8 @@ export default class VariableDeclarator extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - const { deoptimized, id, init } = this; - if (!deoptimized) this.applyDeoptimizations(); - if (!this.included) this.includeNode(context); + const { id, init } = this; + if (!this.included) this.includeNode(); init?.include(context, includeChildrenRecursively); id.markDeclarationReached(); if (includeChildrenRecursively) { @@ -101,9 +99,8 @@ export default class VariableDeclarator extends NodeBase { } } - // TODO Lukas is this not something for includeNode? - applyDeoptimizations() { - this.deoptimized = true; + includeNode() { + this.included = true; const { id, init } = this; if (init && id instanceof Identifier && init instanceof ClassExpression && !init.id) { const { name, variable } = id; @@ -116,4 +113,4 @@ export default class VariableDeclarator extends NodeBase { } } -VariableDeclarator.prototype.includeNode = onlyIncludeSelf; +VariableDeclarator.prototype.applyDeoptimizations = doNotDeoptimize; From d1fcc64628b284e3c00b62af0c1d19debafd79e9 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 13 Dec 2024 09:15:14 +0100 Subject: [PATCH 15/32] If a node has not special logic on include or deoptimize, replace check --- src/ast/nodes/BlockStatement.ts | 2 +- src/ast/nodes/BreakStatement.ts | 2 +- src/ast/nodes/ChainExpression.ts | 2 +- src/ast/nodes/ClassBody.ts | 2 +- src/ast/nodes/ConditionalExpression.ts | 4 ++-- src/ast/nodes/ContinueStatement.ts | 2 +- src/ast/nodes/ExportDefaultDeclaration.ts | 4 ++-- src/ast/nodes/ForStatement.ts | 2 +- src/ast/nodes/IfStatement.ts | 2 +- src/ast/nodes/LogicalExpression.ts | 2 +- src/ast/nodes/Program.ts | 2 +- src/ast/nodes/Property.ts | 4 ++-- src/ast/nodes/SequenceExpression.ts | 4 ++-- src/ast/nodes/StaticBlock.ts | 2 +- src/ast/nodes/SwitchCase.ts | 2 +- src/ast/nodes/SwitchStatement.ts | 2 +- src/ast/nodes/TryStatement.ts | 2 +- src/ast/nodes/VariableDeclaration.ts | 2 +- src/ast/nodes/WhileStatement.ts | 2 +- 19 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/ast/nodes/BlockStatement.ts b/src/ast/nodes/BlockStatement.ts index b8846dcf364..f636281e3e6 100644 --- a/src/ast/nodes/BlockStatement.ts +++ b/src/ast/nodes/BlockStatement.ts @@ -58,7 +58,7 @@ export default class BlockStatement extends StatementBase { include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { if (!(this.deoptimizeBody && this.directlyIncluded)) { - if (!this.included) this.includeNode(context); + this.included = true; this.directlyIncluded = true; if (this.deoptimizeBody) includeChildrenRecursively = true; for (const node of this.body) { diff --git a/src/ast/nodes/BreakStatement.ts b/src/ast/nodes/BreakStatement.ts index 501c27dfa08..72cb404056d 100644 --- a/src/ast/nodes/BreakStatement.ts +++ b/src/ast/nodes/BreakStatement.ts @@ -20,7 +20,7 @@ export default class BreakStatement extends StatementBase { } include(context: InclusionContext): void { - if (!this.included) this.includeNode(context); + this.included = true; if (this.label) { this.label.include(context); context.includedLabels.add(this.label.name); diff --git a/src/ast/nodes/ChainExpression.ts b/src/ast/nodes/ChainExpression.ts index 8d6c93ead95..e4c02e15ee2 100644 --- a/src/ast/nodes/ChainExpression.ts +++ b/src/ast/nodes/ChainExpression.ts @@ -38,7 +38,7 @@ export default class ChainExpression extends NodeBase implements DeoptimizableEn } includePath(path: ObjectPath, context: InclusionContext) { - if (!this.included) this.includeNode(context); + this.included = true; this.expression.includePath(path, context); } diff --git a/src/ast/nodes/ClassBody.ts b/src/ast/nodes/ClassBody.ts index c04c8e70242..900e5bca9bf 100644 --- a/src/ast/nodes/ClassBody.ts +++ b/src/ast/nodes/ClassBody.ts @@ -26,7 +26,7 @@ export default class ClassBody extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.scope.context.includeVariableInModule(this.scope.thisVariable, UNKNOWN_PATH, context); for (const definition of this.body) { definition.include(context, includeChildrenRecursively); diff --git a/src/ast/nodes/ConditionalExpression.ts b/src/ast/nodes/ConditionalExpression.ts index 41f59e001f5..cb8ff5f0e35 100644 --- a/src/ast/nodes/ConditionalExpression.ts +++ b/src/ast/nodes/ConditionalExpression.ts @@ -142,7 +142,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; const usedBranch = this.getUsedBranch(); if (usedBranch === null || includeChildrenRecursively || this.test.shouldBeIncluded(context)) { this.test.include(context, includeChildrenRecursively); @@ -154,7 +154,7 @@ export default class ConditionalExpression extends NodeBase implements Deoptimiz } includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) this.includeNode(context); + this.included = true; const usedBranch = this.getUsedBranch(); if (usedBranch === null || this.test.shouldBeIncluded(context)) { this.consequent.includePath(path, context); diff --git a/src/ast/nodes/ContinueStatement.ts b/src/ast/nodes/ContinueStatement.ts index e7a0130fdd3..8f8a27b4b64 100644 --- a/src/ast/nodes/ContinueStatement.ts +++ b/src/ast/nodes/ContinueStatement.ts @@ -20,7 +20,7 @@ export default class ContinueStatement extends StatementBase { } include(context: InclusionContext): void { - if (!this.included) this.includeNode(context); + this.included = true; if (this.label) { this.label.include(context); context.includedLabels.add(this.label.name); diff --git a/src/ast/nodes/ExportDefaultDeclaration.ts b/src/ast/nodes/ExportDefaultDeclaration.ts index 91201979294..bf62838d90d 100644 --- a/src/ast/nodes/ExportDefaultDeclaration.ts +++ b/src/ast/nodes/ExportDefaultDeclaration.ts @@ -50,7 +50,7 @@ export default class ExportDefaultDeclaration extends NodeBase { declare private declarationName: string | undefined; include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.declaration.include(context, includeChildrenRecursively); if (includeChildrenRecursively) { this.scope.context.includeVariableInModule(this.variable, UNKNOWN_PATH, context); @@ -58,7 +58,7 @@ export default class ExportDefaultDeclaration extends NodeBase { } includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) this.includeNode(context); + this.included = true; this.declaration.includePath(path, context); } diff --git a/src/ast/nodes/ForStatement.ts b/src/ast/nodes/ForStatement.ts index 577c76d41ef..748ec5a602a 100644 --- a/src/ast/nodes/ForStatement.ts +++ b/src/ast/nodes/ForStatement.ts @@ -38,7 +38,7 @@ export default class ForStatement extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.init?.include(context, includeChildrenRecursively, { asSingleStatement: true }); diff --git a/src/ast/nodes/IfStatement.ts b/src/ast/nodes/IfStatement.ts index 9b7919ecbe3..931d0d37261 100644 --- a/src/ast/nodes/IfStatement.ts +++ b/src/ast/nodes/IfStatement.ts @@ -54,7 +54,7 @@ export default class IfStatement extends StatementBase implements DeoptimizableE } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; if (includeChildrenRecursively) { this.includeRecursively(includeChildrenRecursively, context); } else { diff --git a/src/ast/nodes/LogicalExpression.ts b/src/ast/nodes/LogicalExpression.ts index aa114bc290f..e37564d8025 100644 --- a/src/ast/nodes/LogicalExpression.ts +++ b/src/ast/nodes/LogicalExpression.ts @@ -196,7 +196,7 @@ export default class LogicalExpression extends NodeBase implements Deoptimizable } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; const usedBranch = this.getUsedBranch(); if ( includeChildrenRecursively || diff --git a/src/ast/nodes/Program.ts b/src/ast/nodes/Program.ts index 78f3f81b943..6e9a4b5204f 100644 --- a/src/ast/nodes/Program.ts +++ b/src/ast/nodes/Program.ts @@ -56,7 +56,7 @@ export default class Program extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) { node.include(context, includeChildrenRecursively); diff --git a/src/ast/nodes/Property.ts b/src/ast/nodes/Property.ts index c659dfbdefb..e4195cdeacd 100644 --- a/src/ast/nodes/Property.ts +++ b/src/ast/nodes/Property.ts @@ -94,13 +94,13 @@ export default class Property extends MethodBase implements DeclarationPatternNo } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren) { - if (!this.included) this.includeNode(context); + this.included = true; this.key.include(context, includeChildrenRecursively); this.value.include(context, includeChildrenRecursively); } includePath(path: ObjectPath, context: InclusionContext) { - if (!this.included) this.includeNode(context); + this.included = true; this.value.includePath(path, context); } diff --git a/src/ast/nodes/SequenceExpression.ts b/src/ast/nodes/SequenceExpression.ts index 0ba5ba6cbc0..0d3fc7e17dd 100644 --- a/src/ast/nodes/SequenceExpression.ts +++ b/src/ast/nodes/SequenceExpression.ts @@ -74,7 +74,7 @@ export default class SequenceExpression extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; const lastExpression = this.expressions[this.expressions.length - 1]; for (const expression of this.expressions) { if ( @@ -88,7 +88,7 @@ export default class SequenceExpression extends NodeBase { } includePath(path: ObjectPath, context: InclusionContext): void { - if (!this.included) this.includeNode(context); + this.included = true; this.expressions[this.expressions.length - 1].includePath(path, context); } diff --git a/src/ast/nodes/StaticBlock.ts b/src/ast/nodes/StaticBlock.ts index 4542cc942cb..385737cf231 100644 --- a/src/ast/nodes/StaticBlock.ts +++ b/src/ast/nodes/StaticBlock.ts @@ -32,7 +32,7 @@ export default class StaticBlock extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; for (const node of this.body) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) node.include(context, includeChildrenRecursively); diff --git a/src/ast/nodes/SwitchCase.ts b/src/ast/nodes/SwitchCase.ts index 8d0e437a08c..ca0ab1e6cc9 100644 --- a/src/ast/nodes/SwitchCase.ts +++ b/src/ast/nodes/SwitchCase.ts @@ -32,7 +32,7 @@ export default class SwitchCase extends NodeBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.test?.include(context, includeChildrenRecursively); for (const node of this.consequent) { if (includeChildrenRecursively || node.shouldBeIncluded(context)) diff --git a/src/ast/nodes/SwitchStatement.ts b/src/ast/nodes/SwitchStatement.ts index 1843ad80c35..97e83e77109 100644 --- a/src/ast/nodes/SwitchStatement.ts +++ b/src/ast/nodes/SwitchStatement.ts @@ -47,7 +47,7 @@ export default class SwitchStatement extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.discriminant.include(context, includeChildrenRecursively); const { brokenFlow, hasBreak } = context; context.hasBreak = false; diff --git a/src/ast/nodes/TryStatement.ts b/src/ast/nodes/TryStatement.ts index 51e34f5c5fa..5ec6fff814b 100644 --- a/src/ast/nodes/TryStatement.ts +++ b/src/ast/nodes/TryStatement.ts @@ -34,7 +34,7 @@ export default class TryStatement extends StatementBase { )?.tryCatchDeoptimization; const { brokenFlow, includedLabels } = context; if (!this.directlyIncluded || !tryCatchDeoptimization) { - if (!this.included) this.includeNode(context); + this.included = true; this.directlyIncluded = true; this.block.include( context, diff --git a/src/ast/nodes/VariableDeclaration.ts b/src/ast/nodes/VariableDeclaration.ts index e840965f42d..6b9b9f8f75e 100644 --- a/src/ast/nodes/VariableDeclaration.ts +++ b/src/ast/nodes/VariableDeclaration.ts @@ -68,7 +68,7 @@ export default class VariableDeclaration extends NodeBase { includeChildrenRecursively: IncludeChildren, { asSingleStatement }: InclusionOptions = BLANK ): void { - if (!this.included) this.includeNode(context); + this.included = true; for (const declarator of this.declarations) { if (includeChildrenRecursively || declarator.shouldBeIncluded(context)) { declarator.include(context, includeChildrenRecursively); diff --git a/src/ast/nodes/WhileStatement.ts b/src/ast/nodes/WhileStatement.ts index bfc24f56b7d..88eab40862b 100644 --- a/src/ast/nodes/WhileStatement.ts +++ b/src/ast/nodes/WhileStatement.ts @@ -21,7 +21,7 @@ export default class WhileStatement extends StatementBase { } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { - if (!this.included) this.includeNode(context); + this.included = true; this.test.include(context, includeChildrenRecursively); includeLoopBody(context, this.body, includeChildrenRecursively); } From 956c3796e8a6f6a98db85395327f12cb5d340fd8 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 15 Dec 2024 07:18:28 +0100 Subject: [PATCH 16/32] See if we can reduce the number of tree-shaking passes The idea is to again eagerly include variable inits, but not in a nested call but in a loop at the end of the regular pass. --- src/Graph.ts | 8 ++++++++ src/Module.ts | 3 +++ src/ast/scopes/ParameterScope.ts | 2 +- src/ast/variables/LocalVariable.ts | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Graph.ts b/src/Graph.ts index 3398fbf0b63..11e95973dfb 100644 --- a/src/Graph.ts +++ b/src/Graph.ts @@ -1,4 +1,6 @@ import flru from 'flru'; +import { createInclusionContext } from './ast/ExecutionContext'; +import type { ExpressionEntity } from './ast/nodes/shared/Expression'; import GlobalScope from './ast/scopes/GlobalScope'; import { EntityPathTracker } from './ast/utils/PathTracker'; import type ExternalModule from './ExternalModule'; @@ -60,6 +62,7 @@ export default class Graph { readonly moduleLoader: ModuleLoader; readonly modulesById = new Map(); needsTreeshakingPass = false; + readonly newlyIncludedVariableInits = new Set(); phase: BuildPhase = BuildPhase.LOAD_AND_PARSE; readonly pluginDriver: PluginDriver; readonly pureFunctions: PureFunctions; @@ -167,6 +170,7 @@ export default class Graph { } if (this.options.treeshake) { let treeshakingPass = 1; + this.newlyIncludedVariableInits.clear(); do { timeStart(`treeshaking pass ${treeshakingPass}`, 3); this.needsTreeshakingPass = false; @@ -190,6 +194,10 @@ export default class Graph { } } } + for (const entity of this.newlyIncludedVariableInits) { + this.newlyIncludedVariableInits.delete(entity); + entity.include(createInclusionContext(), false); + } timeEnd(`treeshaking pass ${treeshakingPass++}`, 3); } while (this.needsTreeshakingPass); } else { diff --git a/src/Module.ts b/src/Module.ts index 0e2ee6631f6..3e4cda8fea3 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -18,6 +18,7 @@ import Literal from './ast/nodes/Literal'; import type MetaProperty from './ast/nodes/MetaProperty'; import * as NodeType from './ast/nodes/NodeType'; import type Program from './ast/nodes/Program'; +import type { ExpressionEntity } from './ast/nodes/shared/Expression'; import type { NodeBase } from './ast/nodes/shared/Node'; import VariableDeclaration from './ast/nodes/VariableDeclaration'; import ModuleScope from './ast/scopes/ModuleScope'; @@ -140,6 +141,7 @@ export interface AstContext { manualPureFunctions: PureFunctions; module: Module; // not to be used for tree-shaking moduleContext: string; + newlyIncludedVariableInits: Set; options: NormalizedInputOptions; requestTreeshakingPass: () => void; traceExport: (name: string) => Variable | null; @@ -896,6 +898,7 @@ export default class Module { manualPureFunctions: this.graph.pureFunctions, module: this, moduleContext: this.context, + newlyIncludedVariableInits: this.graph.newlyIncludedVariableInits, options: this.options, requestTreeshakingPass: () => (this.graph.needsTreeshakingPass = true), traceExport: (name: string) => this.getVariableForExportName(name)[0], diff --git a/src/ast/scopes/ParameterScope.ts b/src/ast/scopes/ParameterScope.ts index 82b5e4bd1c6..9b656b4b30f 100644 --- a/src/ast/scopes/ParameterScope.ts +++ b/src/ast/scopes/ParameterScope.ts @@ -90,8 +90,8 @@ export default class ParameterScope extends ChildScope { if (calledFromTryStatement) { argument.include(context, true); } else { - argument.include(context, false); variable.includeArgumentPaths(argument, context); + argument.include(context, false); } } } diff --git a/src/ast/variables/LocalVariable.ts b/src/ast/variables/LocalVariable.ts index 86133e360e6..a62398a5af5 100644 --- a/src/ast/variables/LocalVariable.ts +++ b/src/ast/variables/LocalVariable.ts @@ -202,6 +202,13 @@ export default class LocalVariable extends Variable { includePath(path: ObjectPath, context: InclusionContext): void { if (!this.includedPathTracker.includePathAndGetIfIncluded(path)) { + this.module.scope.context.requestTreeshakingPass(); + if (!this.included) { + // This will reduce the number of tree-shaking passes by eagerly + // including inits. By pushing this here instead of directly including + // we avoid deep call stacks. + this.module.scope.context.newlyIncludedVariableInits.add(this.init); + } super.includePath(path, context); for (const declaration of this.declarations) { // If node is a default export, it can save a tree-shaking run to include the full declaration now From 917129b83e4589207db12b00247926277e82f0d4 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 18 Dec 2024 22:29:34 +0100 Subject: [PATCH 17/32] Ensure that deoptimizing a MemberExpression does not crash --- src/ast/nodes/MemberExpression.ts | 7 ++++--- .../deoptimized-argument-value/_config.js | 4 ++++ .../deoptimized-argument-value/main.js | 9 +++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 test/function/samples/object-expression-treeshaking/deoptimized-argument-value/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/deoptimized-argument-value/main.js diff --git a/src/ast/nodes/MemberExpression.ts b/src/ast/nodes/MemberExpression.ts index 8f106fab12c..454e0b0e004 100644 --- a/src/ast/nodes/MemberExpression.ts +++ b/src/ast/nodes/MemberExpression.ts @@ -194,6 +194,7 @@ export default class MemberExpression } deoptimizeCache(): void { + if (this.propertyKey === this.dynamicPropertyKey) return; const { expressionsToBeDeoptimized, object } = this; this.expressionsToBeDeoptimized = EMPTY_ARRAY as unknown as DeoptimizableEntity[]; this.dynamicPropertyKey = this.propertyKey; @@ -234,7 +235,7 @@ export default class MemberExpression } const propertyKey = this.getDynamicPropertyKey(); if (propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) { - this.expressionsToBeDeoptimized.push(origin); + if (propertyKey !== this.propertyKey) this.expressionsToBeDeoptimized.push(origin); return this.object.getLiteralValueAtPath([propertyKey, ...path], recursionTracker, origin); } return UnknownValue; @@ -273,7 +274,7 @@ export default class MemberExpression } const propertyKey = this.getDynamicPropertyKey(); if (propertyKey !== UnknownKey && path.length < MAX_PATH_DEPTH) { - this.expressionsToBeDeoptimized.push(origin); + if (propertyKey !== this.propertyKey) this.expressionsToBeDeoptimized.push(origin); return this.object.getReturnExpressionWhenCalledAtPath( [propertyKey, ...path], interaction, @@ -541,7 +542,7 @@ export default class MemberExpression private getDynamicPropertyKey(): ObjectPathKey { if (this.dynamicPropertyKey === null) { - this.dynamicPropertyKey = UnknownKey; + this.dynamicPropertyKey = this.propertyKey; const value = this.property.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this); return (this.dynamicPropertyKey = value === SymbolToStringTag diff --git a/test/function/samples/object-expression-treeshaking/deoptimized-argument-value/_config.js b/test/function/samples/object-expression-treeshaking/deoptimized-argument-value/_config.js new file mode 100644 index 00000000000..1f04fcd0619 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deoptimized-argument-value/_config.js @@ -0,0 +1,4 @@ +module.exports = defineTest({ + description: + 'does not fail if an argument is deoptimized where the value of a nested property is used in a condition' +}); diff --git a/test/function/samples/object-expression-treeshaking/deoptimized-argument-value/main.js b/test/function/samples/object-expression-treeshaking/deoptimized-argument-value/main.js new file mode 100644 index 00000000000..dca3d53ecc3 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/deoptimized-argument-value/main.js @@ -0,0 +1,9 @@ +function test(x) { + if (x?.y.z) { + return true; + } + return false; +} + +assert.ok(test({ y: { z: true } })); +assert.ok(!test({ y: { z: false } })); From caa6b0dea530a998cb2b653e859459c3a52b460c Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Thu, 19 Dec 2024 12:27:55 +0100 Subject: [PATCH 18/32] Ensure the "in" operators includes is second operand --- src/ast/nodes/BinaryExpression.ts | 20 ++++++++++--------- .../in-operator/_config.js | 3 +++ .../in-operator/main.js | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 test/function/samples/object-expression-treeshaking/in-operator/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/in-operator/main.js diff --git a/src/ast/nodes/BinaryExpression.ts b/src/ast/nodes/BinaryExpression.ts index 7a5f261569c..9981e6c50c2 100644 --- a/src/ast/nodes/BinaryExpression.ts +++ b/src/ast/nodes/BinaryExpression.ts @@ -2,25 +2,21 @@ import type MagicString from 'magic-string'; import { BLANK } from '../../utils/blank'; import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers'; import type { DeoptimizableEntity } from '../DeoptimizableEntity'; -import type { HasEffectsContext } from '../ExecutionContext'; +import type { HasEffectsContext, InclusionContext } from '../ExecutionContext'; import type { NodeInteraction } from '../NodeInteractions'; import { INTERACTION_ACCESSED } from '../NodeInteractions'; import { EMPTY_PATH, type EntityPathTracker, type ObjectPath, - SHARED_RECURSION_TRACKER + SHARED_RECURSION_TRACKER, + UNKNOWN_PATH } from '../utils/PathTracker'; import ExpressionStatement from './ExpressionStatement'; import type { LiteralValue } from './Literal'; import type * as NodeType from './NodeType'; import { type LiteralValueOrUnknown, UnknownValue } from './shared/Expression'; -import { - doNotDeoptimize, - type ExpressionNode, - NodeBase, - onlyIncludeSelfNoDeoptimize -} from './shared/Node'; +import { doNotDeoptimize, type ExpressionNode, NodeBase } from './shared/Node'; type Operator = | '!=' @@ -117,6 +113,13 @@ export default class BinaryExpression extends NodeBase implements DeoptimizableE return type !== INTERACTION_ACCESSED || path.length > 1; } + includeNode(context: InclusionContext) { + this.included = true; + if (this.operator === 'in') { + this.right.includePath(UNKNOWN_PATH, context); + } + } + removeAnnotations(code: MagicString) { this.left.removeAnnotations(code); } @@ -131,5 +134,4 @@ export default class BinaryExpression extends NodeBase implements DeoptimizableE } } -BinaryExpression.prototype.includeNode = onlyIncludeSelfNoDeoptimize; BinaryExpression.prototype.applyDeoptimizations = doNotDeoptimize; diff --git a/test/function/samples/object-expression-treeshaking/in-operator/_config.js b/test/function/samples/object-expression-treeshaking/in-operator/_config.js new file mode 100644 index 00000000000..d926de806f7 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/in-operator/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'includes properties referenced by the "in" operator' +}); diff --git a/test/function/samples/object-expression-treeshaking/in-operator/main.js b/test/function/samples/object-expression-treeshaking/in-operator/main.js new file mode 100644 index 00000000000..75b3f1af9b8 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/in-operator/main.js @@ -0,0 +1 @@ +assert.ok('foo' in { foo: true, bar: true }); From fd73424e21df2d3ab99d55d77f8c7aba70e91aaf Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 20 Dec 2024 07:07:01 +0100 Subject: [PATCH 19/32] When including all children of a CallExpression, also include all paths --- src/ast/nodes/CallExpression.ts | 8 ++++++-- .../try-statement-arguments/_config.js | 3 +++ .../try-statement-arguments/main.js | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 test/function/samples/object-expression-treeshaking/try-statement-arguments/_config.js create mode 100644 test/function/samples/object-expression-treeshaking/try-statement-arguments/main.js diff --git a/src/ast/nodes/CallExpression.ts b/src/ast/nodes/CallExpression.ts index fc6fe5a012e..f34cb067519 100644 --- a/src/ast/nodes/CallExpression.ts +++ b/src/ast/nodes/CallExpression.ts @@ -112,8 +112,13 @@ export default class CallExpression } include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void { + if (!this.included) this.includeNode(context); if (includeChildrenRecursively) { - super.include(context, includeChildrenRecursively); + this.callee.include(context, true); + for (const argument of this.arguments) { + argument.includePath(UNKNOWN_PATH, context); + argument.include(context, true); + } if ( includeChildrenRecursively === INCLUDE_PARAMETERS && this.callee instanceof Identifier && @@ -122,7 +127,6 @@ export default class CallExpression this.callee.variable.markCalledFromTryStatement(); } } else { - if (!this.included) this.includeNode(context); // If the callee is a member expression and does not have a variable, its // object will already be included via the first argument of the // interaction in includeCallArguments. Including it again can lead to diff --git a/test/function/samples/object-expression-treeshaking/try-statement-arguments/_config.js b/test/function/samples/object-expression-treeshaking/try-statement-arguments/_config.js new file mode 100644 index 00000000000..4b50df22d90 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/try-statement-arguments/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'includes referenced call arguments to functions called from try statements' +}); diff --git a/test/function/samples/object-expression-treeshaking/try-statement-arguments/main.js b/test/function/samples/object-expression-treeshaking/try-statement-arguments/main.js new file mode 100644 index 00000000000..f699e9fb738 --- /dev/null +++ b/test/function/samples/object-expression-treeshaking/try-statement-arguments/main.js @@ -0,0 +1,14 @@ +const safeCall = call => { + call() + try { + return call(); + } catch {} +}; + +const identity = x => x; + +const opts = { foo: 1 }; +assert.deepStrictEqual( + safeCall(() => identity(opts)), + { foo: 1 } +); From 2339f1d8384a8999645823f83f9042a9fc7b3bf7 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sat, 21 Dec 2024 07:58:05 +0100 Subject: [PATCH 20/32] 4.30.0-0 --- browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/package.json b/browser/package.json index 9ab89f66713..9ca022973b0 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "4.29.1", + "version": "4.30.0-0", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index b902ff3554f..96b64b79310 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "4.29.1", + "version": "4.30.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "4.29.1", + "version": "4.30.0-0", "license": "MIT", "dependencies": { "@types/estree": "1.0.6" diff --git a/package.json b/package.json index 5ddddbd5df0..35c36373879 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "4.29.1", + "version": "4.30.0-0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 4e2328d0e187ae6059aab9d41f96b1cc3c33ee23 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 30 Dec 2024 06:42:03 +0100 Subject: [PATCH 21/32] Make sure to use builtins when building for Node Solves an issue when linking with pnpm. --- rollup.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rollup.config.ts b/rollup.config.ts index 109a8f116fa..78f608e126e 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -40,7 +40,7 @@ const treeshake = { const nodePlugins: readonly Plugin[] = [ replace(fsEventsReplacement), alias(moduleAliases), - nodeResolve(), + nodeResolve({ preferBuiltins: true }), json(), string({ include: '**/*.md' }), commonjs({ From a52c4317b012fb16c4594e988c278dc41d24008a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 30 Dec 2024 07:08:42 +0100 Subject: [PATCH 22/32] Revert making objects truthy for now This solves an issue with TypeScript enums. A proper solution should be to improve tracking of uninitialized vars. --- src/ast/nodes/shared/ObjectEntity.ts | 8 +++++-- .../_expected/amd/generated-main2.js | 14 +++++++++++++ .../_expected/amd/main1alias.js | 6 ++---- .../_expected/amd/main2alias.js | 10 +++------ .../_expected/cjs/generated-main2.js | 12 +++++++++++ .../_expected/cjs/main1alias.js | 6 ++---- .../_expected/cjs/main2alias.js | 10 ++++----- .../_expected/es/generated-main2.js | 9 ++++++++ .../_expected/es/main1alias.js | 4 +--- .../_expected/es/main2alias.js | 8 +------ .../_expected/system/generated-main2.js} | 6 ++++-- .../_expected/system/main1alias.js | 9 ++++---- .../_expected/system/main2alias.js | 21 ++++++++----------- .../_expected/amd/generated-main2.js | 14 +++++++++++++ .../entrypoint-facade/_expected/amd/main1.js | 6 ++---- .../entrypoint-facade/_expected/amd/main2.js | 10 +++------ .../_expected/cjs/generated-main2.js | 12 +++++++++++ .../entrypoint-facade/_expected/cjs/main1.js | 6 ++---- .../entrypoint-facade/_expected/cjs/main2.js | 10 ++++----- .../_expected/es/generated-main2.js | 9 ++++++++ .../entrypoint-facade/_expected/es/main1.js | 4 +--- .../entrypoint-facade/_expected/es/main2.js | 8 +------ .../_expected/system/generated-main2.js | 18 ++++++++++++++++ .../_expected/system/main1.js | 9 ++++---- .../_expected/system/main2.js | 21 ++++++++----------- .../_expected/amd/chunk-main2-BeN-_z3e-amd.js | 14 +++++++++++++ .../_expected/amd/entry-main1-DBBrcOFA-amd.js | 7 ------- .../_expected/amd/entry-main1-DMJ9vLw5-amd.js | 5 +++++ .../_expected/amd/entry-main2-DHcdu15H-amd.js | 11 ---------- .../_expected/amd/entry-main2-SEc5gjvu-amd.js | 7 +++++++ .../_expected/cjs/chunk-main2-DB987Lh4-cjs.js | 12 +++++++++++ .../_expected/cjs/entry-main1-DBCWfg7v-cjs.js | 7 ------- .../_expected/cjs/entry-main1-m802XraR-cjs.js | 5 +++++ .../_expected/cjs/entry-main2-BVjYoW06-cjs.js | 9 -------- .../_expected/cjs/entry-main2-CDyYOEPK-cjs.js | 7 +++++++ .../_expected/es/chunk-main2-CPMnlUsH-es.js | 9 ++++++++ .../_expected/es/entry-main1-DCmtsuTI-es.js | 3 +++ .../_expected/es/entry-main1-WTHxIjMp-es.js | 5 ----- .../_expected/es/entry-main2-BNtK1lo1-es.js | 7 ------- .../_expected/es/entry-main2-CO3mT8jT-es.js | 1 + .../system/chunk-main2-BRXsWtDg-system.js | 18 ++++++++++++++++ .../system/entry-main1-Biq2O0X--system.js | 15 +++++++++++++ .../system/entry-main1-bvYFOXPm-system.js | 16 -------------- .../system/entry-main2-D_RLirM0-system.js | 13 ++++++++++++ .../_expected/amd.js | 2 +- .../_expected/cjs.js | 2 +- .../mutate-logical-expression/_expected/es.js | 2 +- .../_expected/iife.js | 2 +- .../_expected/system.js | 2 +- .../_expected/umd.js | 2 +- .../_expected.js | 2 +- .../_config.js | 8 +++++++ .../dep.js | 12 +++++++++++ .../main.js | 3 +++ 54 files changed, 289 insertions(+), 169 deletions(-) create mode 100644 test/chunking-form/samples/entrypoint-aliasing/_expected/amd/generated-main2.js create mode 100644 test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/generated-main2.js create mode 100644 test/chunking-form/samples/entrypoint-aliasing/_expected/es/generated-main2.js rename test/chunking-form/samples/{filenames-patterns/_expected/system/entry-main2-um8DK13a-system.js => entrypoint-aliasing/_expected/system/generated-main2.js} (68%) create mode 100644 test/chunking-form/samples/entrypoint-facade/_expected/amd/generated-main2.js create mode 100644 test/chunking-form/samples/entrypoint-facade/_expected/cjs/generated-main2.js create mode 100644 test/chunking-form/samples/entrypoint-facade/_expected/es/generated-main2.js create mode 100644 test/chunking-form/samples/entrypoint-facade/_expected/system/generated-main2.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/amd/chunk-main2-BeN-_z3e-amd.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DBBrcOFA-amd.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DMJ9vLw5-amd.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-DHcdu15H-amd.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-SEc5gjvu-amd.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/cjs/chunk-main2-DB987Lh4-cjs.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-DBCWfg7v-cjs.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-m802XraR-cjs.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-BVjYoW06-cjs.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-CDyYOEPK-cjs.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/es/chunk-main2-CPMnlUsH-es.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-DCmtsuTI-es.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-WTHxIjMp-es.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-BNtK1lo1-es.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-CO3mT8jT-es.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/system/chunk-main2-BRXsWtDg-system.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-Biq2O0X--system.js delete mode 100644 test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-bvYFOXPm-system.js create mode 100644 test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-D_RLirM0-system.js create mode 100644 test/function/samples/typescript-enum-no-module-side-effects/_config.js create mode 100644 test/function/samples/typescript-enum-no-module-side-effects/dep.js create mode 100644 test/function/samples/typescript-enum-no-module-side-effects/main.js diff --git a/src/ast/nodes/shared/ObjectEntity.ts b/src/ast/nodes/shared/ObjectEntity.ts index b96741051dd..52fd6facd3b 100644 --- a/src/ast/nodes/shared/ObjectEntity.ts +++ b/src/ast/nodes/shared/ObjectEntity.ts @@ -17,7 +17,6 @@ import { ExpressionEntity, UNKNOWN_EXPRESSION, UNKNOWN_RETURN_EXPRESSION, - UnknownTruthyValue, UnknownValue } from './Expression'; import type { IncludeChildren } from './Node'; @@ -255,7 +254,12 @@ export class ObjectEntity extends ExpressionEntity { origin: DeoptimizableEntity ): LiteralValueOrUnknown { if (path.length === 0) { - return UnknownTruthyValue; + // This should actually be "UnknownTruthyValue". However, this currently + // causes an issue with TypeScript enums in files with moduleSideEffects: + // false because we cannot properly track whether a "var" has been + // initialized. This should be reverted once we can properly track this. + // return UnknownTruthyValue; + return UnknownValue; } const key = path[0]; const expressionAtPath = this.getMemberExpressionAndTrackDeopt(key, origin); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/generated-main2.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/generated-main2.js new file mode 100644 index 00000000000..9643e93c569 --- /dev/null +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/generated-main2.js @@ -0,0 +1,14 @@ +define(['exports'], (function (exports) { 'use strict'; + + var dep = { x: 42 }; + + function log (x) { + if (dep) { + console.log(x); + } + } + + exports.dep = dep; + exports.log = log; + +})); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main1alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main1alias.js index a058768aed3..f2c65e8e5a5 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main1alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main1alias.js @@ -1,7 +1,5 @@ -define(['./main2alias'], (function (main2alias) { 'use strict'; +define(['./generated-main2'], (function (main2alias) { 'use strict'; - var dep = { x: 42 }; - - main2alias(dep); + main2alias.log(main2alias.dep); })); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main2alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main2alias.js index 2c8a948428a..b582fed37f8 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main2alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/amd/main2alias.js @@ -1,11 +1,7 @@ -define((function () { 'use strict'; +define(['./generated-main2'], (function (main2alias) { 'use strict'; - function log (x) { - { - console.log(x); - } - } - return log; + + return main2alias.log; })); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/generated-main2.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/generated-main2.js new file mode 100644 index 00000000000..6c9f57c4580 --- /dev/null +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/generated-main2.js @@ -0,0 +1,12 @@ +'use strict'; + +var dep = { x: 42 }; + +function log (x) { + if (dep) { + console.log(x); + } +} + +exports.dep = dep; +exports.log = log; diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main1alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main1alias.js index 5548faffe1b..528760feda2 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main1alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main1alias.js @@ -1,7 +1,5 @@ 'use strict'; -var main2alias = require('./main2alias.js'); +var main2alias = require('./generated-main2.js'); -var dep = { x: 42 }; - -main2alias(dep); +main2alias.log(main2alias.dep); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main2alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main2alias.js index f8394b9508f..69b1826b762 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main2alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/cjs/main2alias.js @@ -1,9 +1,7 @@ 'use strict'; -function log (x) { - { - console.log(x); - } -} +var main2alias = require('./generated-main2.js'); -module.exports = log; + + +module.exports = main2alias.log; diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/es/generated-main2.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/es/generated-main2.js new file mode 100644 index 00000000000..ff43f7f719e --- /dev/null +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/es/generated-main2.js @@ -0,0 +1,9 @@ +var dep = { x: 42 }; + +function log (x) { + if (dep) { + console.log(x); + } +} + +export { dep as d, log as l }; diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main1alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main1alias.js index c6e94de578d..7ad3b06e91d 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main1alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main1alias.js @@ -1,5 +1,3 @@ -import log from './main2alias.js'; - -var dep = { x: 42 }; +import { l as log, d as dep } from './generated-main2.js'; log(dep); diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main2alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main2alias.js index c9c4c326b79..d74b87aba77 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main2alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/es/main2alias.js @@ -1,7 +1 @@ -function log (x) { - { - console.log(x); - } -} - -export { log as default }; +export { l as default } from './generated-main2.js'; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-um8DK13a-system.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/system/generated-main2.js similarity index 68% rename from test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-um8DK13a-system.js rename to test/chunking-form/samples/entrypoint-aliasing/_expected/system/generated-main2.js index c474d122f61..b6cc008bb90 100644 --- a/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-um8DK13a-system.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/system/generated-main2.js @@ -3,10 +3,12 @@ System.register([], (function (exports) { return { execute: (function () { - exports("default", log); + exports("l", log); + + var dep = exports("d", { x: 42 }); function log (x) { - { + if (dep) { console.log(x); } } diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main1alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main1alias.js index 0c66b58b855..413fc99fd3e 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main1alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main1alias.js @@ -1,14 +1,13 @@ -System.register(['./main2alias.js'], (function () { +System.register(['./generated-main2.js'], (function () { 'use strict'; - var log; + var log, dep; return { setters: [function (module) { - log = module.default; + log = module.l; + dep = module.d; }], execute: (function () { - var dep = { x: 42 }; - log(dep); }) diff --git a/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main2alias.js b/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main2alias.js index c474d122f61..1750d72b46b 100644 --- a/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main2alias.js +++ b/test/chunking-form/samples/entrypoint-aliasing/_expected/system/main2alias.js @@ -1,16 +1,13 @@ -System.register([], (function (exports) { - 'use strict'; - return { - execute: (function () { +System.register(['./generated-main2.js'], (function (exports) { + 'use strict'; + return { + setters: [function (module) { + exports("default", module.l); + }], + execute: (function () { - exports("default", log); - function log (x) { - { - console.log(x); - } - } - }) - }; + }) + }; })); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/amd/generated-main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/amd/generated-main2.js new file mode 100644 index 00000000000..9643e93c569 --- /dev/null +++ b/test/chunking-form/samples/entrypoint-facade/_expected/amd/generated-main2.js @@ -0,0 +1,14 @@ +define(['exports'], (function (exports) { 'use strict'; + + var dep = { x: 42 }; + + function log (x) { + if (dep) { + console.log(x); + } + } + + exports.dep = dep; + exports.log = log; + +})); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/amd/main1.js b/test/chunking-form/samples/entrypoint-facade/_expected/amd/main1.js index f06a6668491..d23070f5b8a 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/amd/main1.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/amd/main1.js @@ -1,7 +1,5 @@ -define(['./main2'], (function (main2) { 'use strict'; +define(['./generated-main2'], (function (main2) { 'use strict'; - var dep = { x: 42 }; - - main2(dep); + main2.log(main2.dep); })); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/amd/main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/amd/main2.js index 2c8a948428a..9356f1aca68 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/amd/main2.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/amd/main2.js @@ -1,11 +1,7 @@ -define((function () { 'use strict'; +define(['./generated-main2'], (function (main2) { 'use strict'; - function log (x) { - { - console.log(x); - } - } - return log; + + return main2.log; })); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/cjs/generated-main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/cjs/generated-main2.js new file mode 100644 index 00000000000..6c9f57c4580 --- /dev/null +++ b/test/chunking-form/samples/entrypoint-facade/_expected/cjs/generated-main2.js @@ -0,0 +1,12 @@ +'use strict'; + +var dep = { x: 42 }; + +function log (x) { + if (dep) { + console.log(x); + } +} + +exports.dep = dep; +exports.log = log; diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main1.js b/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main1.js index 12f252d0c6f..6c0864d0770 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main1.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main1.js @@ -1,7 +1,5 @@ 'use strict'; -var main2 = require('./main2.js'); +var main2 = require('./generated-main2.js'); -var dep = { x: 42 }; - -main2(dep); +main2.log(main2.dep); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main2.js index f8394b9508f..1cca608acf8 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main2.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/cjs/main2.js @@ -1,9 +1,7 @@ 'use strict'; -function log (x) { - { - console.log(x); - } -} +var main2 = require('./generated-main2.js'); -module.exports = log; + + +module.exports = main2.log; diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/es/generated-main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/es/generated-main2.js new file mode 100644 index 00000000000..ff43f7f719e --- /dev/null +++ b/test/chunking-form/samples/entrypoint-facade/_expected/es/generated-main2.js @@ -0,0 +1,9 @@ +var dep = { x: 42 }; + +function log (x) { + if (dep) { + console.log(x); + } +} + +export { dep as d, log as l }; diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/es/main1.js b/test/chunking-form/samples/entrypoint-facade/_expected/es/main1.js index d1543164bf7..7ad3b06e91d 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/es/main1.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/es/main1.js @@ -1,5 +1,3 @@ -import log from './main2.js'; - -var dep = { x: 42 }; +import { l as log, d as dep } from './generated-main2.js'; log(dep); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/es/main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/es/main2.js index c9c4c326b79..d74b87aba77 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/es/main2.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/es/main2.js @@ -1,7 +1 @@ -function log (x) { - { - console.log(x); - } -} - -export { log as default }; +export { l as default } from './generated-main2.js'; diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/system/generated-main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/system/generated-main2.js new file mode 100644 index 00000000000..b6cc008bb90 --- /dev/null +++ b/test/chunking-form/samples/entrypoint-facade/_expected/system/generated-main2.js @@ -0,0 +1,18 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + exports("l", log); + + var dep = exports("d", { x: 42 }); + + function log (x) { + if (dep) { + console.log(x); + } + } + + }) + }; +})); diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/system/main1.js b/test/chunking-form/samples/entrypoint-facade/_expected/system/main1.js index abd063145e5..413fc99fd3e 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/system/main1.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/system/main1.js @@ -1,14 +1,13 @@ -System.register(['./main2.js'], (function () { +System.register(['./generated-main2.js'], (function () { 'use strict'; - var log; + var log, dep; return { setters: [function (module) { - log = module.default; + log = module.l; + dep = module.d; }], execute: (function () { - var dep = { x: 42 }; - log(dep); }) diff --git a/test/chunking-form/samples/entrypoint-facade/_expected/system/main2.js b/test/chunking-form/samples/entrypoint-facade/_expected/system/main2.js index c474d122f61..1750d72b46b 100644 --- a/test/chunking-form/samples/entrypoint-facade/_expected/system/main2.js +++ b/test/chunking-form/samples/entrypoint-facade/_expected/system/main2.js @@ -1,16 +1,13 @@ -System.register([], (function (exports) { - 'use strict'; - return { - execute: (function () { +System.register(['./generated-main2.js'], (function (exports) { + 'use strict'; + return { + setters: [function (module) { + exports("default", module.l); + }], + execute: (function () { - exports("default", log); - function log (x) { - { - console.log(x); - } - } - }) - }; + }) + }; })); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/amd/chunk-main2-BeN-_z3e-amd.js b/test/chunking-form/samples/filenames-patterns/_expected/amd/chunk-main2-BeN-_z3e-amd.js new file mode 100644 index 00000000000..9643e93c569 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/amd/chunk-main2-BeN-_z3e-amd.js @@ -0,0 +1,14 @@ +define(['exports'], (function (exports) { 'use strict'; + + var dep = { x: 42 }; + + function log (x) { + if (dep) { + console.log(x); + } + } + + exports.dep = dep; + exports.log = log; + +})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DBBrcOFA-amd.js b/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DBBrcOFA-amd.js deleted file mode 100644 index e74998bb3c2..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DBBrcOFA-amd.js +++ /dev/null @@ -1,7 +0,0 @@ -define(['./entry-main2-DHcdu15H-amd'], (function (main2) { 'use strict'; - - var dep = { x: 42 }; - - main2(dep); - -})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DMJ9vLw5-amd.js b/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DMJ9vLw5-amd.js new file mode 100644 index 00000000000..bf19b5fca96 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main1-DMJ9vLw5-amd.js @@ -0,0 +1,5 @@ +define(['./chunk-main2-BeN-_z3e-amd'], (function (main2) { 'use strict'; + + main2.log(main2.dep); + +})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-DHcdu15H-amd.js b/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-DHcdu15H-amd.js deleted file mode 100644 index 2c8a948428a..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-DHcdu15H-amd.js +++ /dev/null @@ -1,11 +0,0 @@ -define((function () { 'use strict'; - - function log (x) { - { - console.log(x); - } - } - - return log; - -})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-SEc5gjvu-amd.js b/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-SEc5gjvu-amd.js new file mode 100644 index 00000000000..e814188dec4 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/amd/entry-main2-SEc5gjvu-amd.js @@ -0,0 +1,7 @@ +define(['./chunk-main2-BeN-_z3e-amd'], (function (main2) { 'use strict'; + + + + return main2.log; + +})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/cjs/chunk-main2-DB987Lh4-cjs.js b/test/chunking-form/samples/filenames-patterns/_expected/cjs/chunk-main2-DB987Lh4-cjs.js new file mode 100644 index 00000000000..6c9f57c4580 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/cjs/chunk-main2-DB987Lh4-cjs.js @@ -0,0 +1,12 @@ +'use strict'; + +var dep = { x: 42 }; + +function log (x) { + if (dep) { + console.log(x); + } +} + +exports.dep = dep; +exports.log = log; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-DBCWfg7v-cjs.js b/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-DBCWfg7v-cjs.js deleted file mode 100644 index 9a9af09ba92..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-DBCWfg7v-cjs.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -var main2 = require('./entry-main2-BVjYoW06-cjs.js'); - -var dep = { x: 42 }; - -main2(dep); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-m802XraR-cjs.js b/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-m802XraR-cjs.js new file mode 100644 index 00000000000..ff2abb6f258 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main1-m802XraR-cjs.js @@ -0,0 +1,5 @@ +'use strict'; + +var main2 = require('./chunk-main2-DB987Lh4-cjs.js'); + +main2.log(main2.dep); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-BVjYoW06-cjs.js b/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-BVjYoW06-cjs.js deleted file mode 100644 index f8394b9508f..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-BVjYoW06-cjs.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -function log (x) { - { - console.log(x); - } -} - -module.exports = log; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-CDyYOEPK-cjs.js b/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-CDyYOEPK-cjs.js new file mode 100644 index 00000000000..a8c1d498e19 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/cjs/entry-main2-CDyYOEPK-cjs.js @@ -0,0 +1,7 @@ +'use strict'; + +var main2 = require('./chunk-main2-DB987Lh4-cjs.js'); + + + +module.exports = main2.log; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/es/chunk-main2-CPMnlUsH-es.js b/test/chunking-form/samples/filenames-patterns/_expected/es/chunk-main2-CPMnlUsH-es.js new file mode 100644 index 00000000000..ff43f7f719e --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/es/chunk-main2-CPMnlUsH-es.js @@ -0,0 +1,9 @@ +var dep = { x: 42 }; + +function log (x) { + if (dep) { + console.log(x); + } +} + +export { dep as d, log as l }; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-DCmtsuTI-es.js b/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-DCmtsuTI-es.js new file mode 100644 index 00000000000..2e9c7317e25 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-DCmtsuTI-es.js @@ -0,0 +1,3 @@ +import { l as log, d as dep } from './chunk-main2-CPMnlUsH-es.js'; + +log(dep); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-WTHxIjMp-es.js b/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-WTHxIjMp-es.js deleted file mode 100644 index 7f8a79168c7..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main1-WTHxIjMp-es.js +++ /dev/null @@ -1,5 +0,0 @@ -import log from './entry-main2-BNtK1lo1-es.js'; - -var dep = { x: 42 }; - -log(dep); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-BNtK1lo1-es.js b/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-BNtK1lo1-es.js deleted file mode 100644 index c9c4c326b79..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-BNtK1lo1-es.js +++ /dev/null @@ -1,7 +0,0 @@ -function log (x) { - { - console.log(x); - } -} - -export { log as default }; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-CO3mT8jT-es.js b/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-CO3mT8jT-es.js new file mode 100644 index 00000000000..83eddb16c42 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/es/entry-main2-CO3mT8jT-es.js @@ -0,0 +1 @@ +export { l as default } from './chunk-main2-CPMnlUsH-es.js'; diff --git a/test/chunking-form/samples/filenames-patterns/_expected/system/chunk-main2-BRXsWtDg-system.js b/test/chunking-form/samples/filenames-patterns/_expected/system/chunk-main2-BRXsWtDg-system.js new file mode 100644 index 00000000000..b6cc008bb90 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/system/chunk-main2-BRXsWtDg-system.js @@ -0,0 +1,18 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + exports("l", log); + + var dep = exports("d", { x: 42 }); + + function log (x) { + if (dep) { + console.log(x); + } + } + + }) + }; +})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-Biq2O0X--system.js b/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-Biq2O0X--system.js new file mode 100644 index 00000000000..173ac94ddf4 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-Biq2O0X--system.js @@ -0,0 +1,15 @@ +System.register(['./chunk-main2-BRXsWtDg-system.js'], (function () { + 'use strict'; + var log, dep; + return { + setters: [function (module) { + log = module.l; + dep = module.d; + }], + execute: (function () { + + log(dep); + + }) + }; +})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-bvYFOXPm-system.js b/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-bvYFOXPm-system.js deleted file mode 100644 index a7b2fa721dd..00000000000 --- a/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main1-bvYFOXPm-system.js +++ /dev/null @@ -1,16 +0,0 @@ -System.register(['./entry-main2-um8DK13a-system.js'], (function () { - 'use strict'; - var log; - return { - setters: [function (module) { - log = module.default; - }], - execute: (function () { - - var dep = { x: 42 }; - - log(dep); - - }) - }; -})); diff --git a/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-D_RLirM0-system.js b/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-D_RLirM0-system.js new file mode 100644 index 00000000000..417076cf1e2 --- /dev/null +++ b/test/chunking-form/samples/filenames-patterns/_expected/system/entry-main2-D_RLirM0-system.js @@ -0,0 +1,13 @@ +System.register(['./chunk-main2-BRXsWtDg-system.js'], (function (exports) { + 'use strict'; + return { + setters: [function (module) { + exports("default", module.l); + }], + execute: (function () { + + + + }) + }; +})); diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_expected/amd.js b/test/form/samples/logical-expression/mutate-logical-expression/_expected/amd.js index 01da54eab7e..5b474e013d4 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_expected/amd.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_expected/amd.js @@ -1,7 +1,7 @@ define(['exports'], (function (exports) { 'use strict'; var aExp = {}; - var logicalAExp = aExp; + var logicalAExp = aExp || {}; logicalAExp.bar = 1; var bExp = {}; diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_expected/cjs.js b/test/form/samples/logical-expression/mutate-logical-expression/_expected/cjs.js index 27218c17c27..2a72123b962 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_expected/cjs.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_expected/cjs.js @@ -1,7 +1,7 @@ 'use strict'; var aExp = {}; -var logicalAExp = aExp; +var logicalAExp = aExp || {}; logicalAExp.bar = 1; var bExp = {}; diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_expected/es.js b/test/form/samples/logical-expression/mutate-logical-expression/_expected/es.js index 45592bb006f..78297b3e78c 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_expected/es.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_expected/es.js @@ -1,5 +1,5 @@ var aExp = {}; -var logicalAExp = aExp; +var logicalAExp = aExp || {}; logicalAExp.bar = 1; var bExp = {}; diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_expected/iife.js b/test/form/samples/logical-expression/mutate-logical-expression/_expected/iife.js index 3c5e327f10f..7dcdf795cbf 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_expected/iife.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_expected/iife.js @@ -2,7 +2,7 @@ var bundle = (function (exports) { 'use strict'; var aExp = {}; - var logicalAExp = aExp; + var logicalAExp = aExp || {}; logicalAExp.bar = 1; var bExp = {}; diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_expected/system.js b/test/form/samples/logical-expression/mutate-logical-expression/_expected/system.js index 76655df499d..640086779a3 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_expected/system.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_expected/system.js @@ -4,7 +4,7 @@ System.register('bundle', [], (function (exports) { execute: (function () { var aExp = exports("aExp", {}); - var logicalAExp = aExp; + var logicalAExp = aExp || {}; logicalAExp.bar = 1; var bExp = exports("bExp", {}); diff --git a/test/form/samples/logical-expression/mutate-logical-expression/_expected/umd.js b/test/form/samples/logical-expression/mutate-logical-expression/_expected/umd.js index cd08199471c..f14730028f0 100644 --- a/test/form/samples/logical-expression/mutate-logical-expression/_expected/umd.js +++ b/test/form/samples/logical-expression/mutate-logical-expression/_expected/umd.js @@ -5,7 +5,7 @@ })(this, (function (exports) { 'use strict'; var aExp = {}; - var logicalAExp = aExp; + var logicalAExp = aExp || {}; logicalAExp.bar = 1; var bExp = {}; diff --git a/test/form/samples/pure-comment-scenarios-complex/_expected.js b/test/form/samples/pure-comment-scenarios-complex/_expected.js index c3e88f5e94e..c0b4e0e0943 100644 --- a/test/form/samples/pure-comment-scenarios-complex/_expected.js +++ b/test/form/samples/pure-comment-scenarios-complex/_expected.js @@ -18,5 +18,5 @@ bar(); /* @__PURE__ */(function(){})() + "foo" ? bar() : baz(); "foo" + /* @__PURE__ */(function(){})() ? bar() : baz(); /* @__PURE__ */(function(){})() ? foo() : foo(); -foo() ; +[/* @__PURE__ */(function(){})()] ? foo() : bar(); !{ } ? bar() : baz(); diff --git a/test/function/samples/typescript-enum-no-module-side-effects/_config.js b/test/function/samples/typescript-enum-no-module-side-effects/_config.js new file mode 100644 index 00000000000..d766d8840cb --- /dev/null +++ b/test/function/samples/typescript-enum-no-module-side-effects/_config.js @@ -0,0 +1,8 @@ +module.exports = defineTest({ + description: 'bundles enums when using moduleSideEffects: false', + options: { + treeshake: { + moduleSideEffects: false + } + } +}); diff --git a/test/function/samples/typescript-enum-no-module-side-effects/dep.js b/test/function/samples/typescript-enum-no-module-side-effects/dep.js new file mode 100644 index 00000000000..c47995c9ee7 --- /dev/null +++ b/test/function/samples/typescript-enum-no-module-side-effects/dep.js @@ -0,0 +1,12 @@ +// The problem is that with moduleSideEffects: false, the TDZ detection logic +// fails here and assumes that InjectFlags is truthy in its initializer. While +// this construct is questionable, the correct solution should be to detect +// this case even in modules without side effects. For now, the simpler solution +// is to turn off handling the return value of the IIFE as truthy. +var InjectFlags = /* @__PURE__ */ (function (InjectFlags2) { + InjectFlags2[(InjectFlags2['Default'] = 0)] = 'Default'; + return InjectFlags2; +})(InjectFlags || {}); + +export const value = InjectFlags.Default; + diff --git a/test/function/samples/typescript-enum-no-module-side-effects/main.js b/test/function/samples/typescript-enum-no-module-side-effects/main.js new file mode 100644 index 00000000000..e77f08c1593 --- /dev/null +++ b/test/function/samples/typescript-enum-no-module-side-effects/main.js @@ -0,0 +1,3 @@ +import { value } from './dep.js'; + +assert.strictEqual(value, 0); From 41ab39a6e4a5181e9be21e816dd6f11c57e1c52a Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 30 Dec 2024 07:35:06 +0100 Subject: [PATCH 23/32] 4.30.0-1 --- browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/package.json b/browser/package.json index 9ca022973b0..303970146b9 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "4.30.0-0", + "version": "4.30.0-1", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index 2cdbb402c28..e912486af06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "4.30.0-0", + "version": "4.30.0-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "4.30.0-0", + "version": "4.30.0-1", "license": "MIT", "dependencies": { "@types/estree": "1.0.6" diff --git a/package.json b/package.json index 1dc8b2f49c5..1b90b7dbaad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "4.30.0-0", + "version": "4.30.0-1", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 851f687604168f59cefcde8f17ec81402eea5660 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 30 Dec 2024 08:00:11 +0100 Subject: [PATCH 24/32] Include variable inits per module instead of per pass This should reduce peak memory consumption. --- src/Graph.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Graph.ts b/src/Graph.ts index 11e95973dfb..8b6595a886f 100644 --- a/src/Graph.ts +++ b/src/Graph.ts @@ -182,6 +182,10 @@ export default class Graph { } else { module.include(); } + for (const entity of this.newlyIncludedVariableInits) { + this.newlyIncludedVariableInits.delete(entity); + entity.include(createInclusionContext(), false); + } } } if (treeshakingPass === 1) { @@ -194,10 +198,6 @@ export default class Graph { } } } - for (const entity of this.newlyIncludedVariableInits) { - this.newlyIncludedVariableInits.delete(entity); - entity.include(createInclusionContext(), false); - } timeEnd(`treeshaking pass ${treeshakingPass++}`, 3); } while (this.needsTreeshakingPass); } else { From 357cee86af35fef7b843298d1cb7a1239d48a734 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 5 Jan 2025 07:25:14 +0100 Subject: [PATCH 25/32] Skip checking for effects in functions with side effects --- src/ast/nodes/ArrowFunctionExpression.ts | 11 +++++++---- src/ast/nodes/shared/BitFlags.ts | 3 ++- src/ast/nodes/shared/FunctionBase.ts | 17 +++++++++++++---- src/ast/nodes/shared/FunctionNode.ts | 18 +++++++++++++----- 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/ast/nodes/ArrowFunctionExpression.ts b/src/ast/nodes/ArrowFunctionExpression.ts index fc358501634..55ddffe42ee 100644 --- a/src/ast/nodes/ArrowFunctionExpression.ts +++ b/src/ast/nodes/ArrowFunctionExpression.ts @@ -43,14 +43,17 @@ export default class ArrowFunctionExpression extends FunctionBase { interaction: NodeInteraction, context: HasEffectsContext ): boolean { + if ( + this.annotationNoSideEffects && + path.length === 0 && + interaction.type === INTERACTION_CALLED + ) { + return false; + } if (super.hasEffectsOnInteractionAtPath(path, interaction, context)) { return true; } - if (this.annotationNoSideEffects) { - return false; - } - if (interaction.type === INTERACTION_CALLED) { const { ignore, brokenFlow } = context; context.ignore = { diff --git a/src/ast/nodes/shared/BitFlags.ts b/src/ast/nodes/shared/BitFlags.ts index 581e09ecb78..536ce091b6f 100644 --- a/src/ast/nodes/shared/BitFlags.ts +++ b/src/ast/nodes/shared/BitFlags.ts @@ -24,7 +24,8 @@ export const enum Flag { generator = 1 << 22, expression = 1 << 23, destructuringDeoptimized = 1 << 24, - hasDeoptimizedCache = 1 << 25 + hasDeoptimizedCache = 1 << 25, + hasEffects = 1 << 26 } export function isFlagSet(flags: number, flag: Flag): boolean { diff --git a/src/ast/nodes/shared/FunctionBase.ts b/src/ast/nodes/shared/FunctionBase.ts index 268acc15cae..a3da5e27aa4 100644 --- a/src/ast/nodes/shared/FunctionBase.ts +++ b/src/ast/nodes/shared/FunctionBase.ts @@ -62,6 +62,13 @@ export default abstract class FunctionBase extends NodeBase { this.flags = setFlag(this.flags, Flag.generator, value); } + protected get hasCachedEffects(): boolean { + return isFlagSet(this.flags, Flag.hasEffects); + } + protected set hasCachedEffects(value: boolean) { + this.flags = setFlag(this.flags, Flag.hasEffects, value); + } + deoptimizeArgumentsOnInteractionAtPath( interaction: NodeInteraction, path: ObjectPath, @@ -129,9 +136,8 @@ export default abstract class FunctionBase extends NodeBase { if (path.length > 0 || interaction.type !== INTERACTION_CALLED) { return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context); } - - if (this.annotationNoSideEffects) { - return false; + if (this.hasCachedEffects) { + return true; } if (this.async) { @@ -152,6 +158,7 @@ export default abstract class FunctionBase extends NodeBase { context ))) ) { + this.hasCachedEffects = true; return true; } } @@ -167,8 +174,10 @@ export default abstract class FunctionBase extends NodeBase { EMPTY_PATH, interaction.args[index + 1] || UNDEFINED_EXPRESSION )) - ) + ) { + this.hasCachedEffects = true; return true; + } } return false; } diff --git a/src/ast/nodes/shared/FunctionNode.ts b/src/ast/nodes/shared/FunctionNode.ts index 9b309563b43..8a64ba5b633 100644 --- a/src/ast/nodes/shared/FunctionNode.ts +++ b/src/ast/nodes/shared/FunctionNode.ts @@ -60,13 +60,18 @@ export default class FunctionNode extends FunctionBase { interaction: NodeInteraction, context: HasEffectsContext ): boolean { - if (super.hasEffectsOnInteractionAtPath(path, interaction, context)) return true; - - if (this.annotationNoSideEffects) { + if ( + this.annotationNoSideEffects && + path.length === 0 && + interaction.type === INTERACTION_CALLED + ) { return false; } + if (super.hasEffectsOnInteractionAtPath(path, interaction, context)) { + return true; + } - if (interaction.type === INTERACTION_CALLED) { + if (path.length === 0 && interaction.type === INTERACTION_CALLED) { const thisInit = context.replacedVariableInits.get(this.scope.thisVariable); context.replacedVariableInits.set( this.scope.thisVariable, @@ -80,7 +85,10 @@ export default class FunctionNode extends FunctionBase { returnYield: true, this: interaction.withNew }; - if (this.body.hasEffects(context)) return true; + if (this.body.hasEffects(context)) { + this.hasCachedEffects = true; + return true; + } context.brokenFlow = brokenFlow; if (thisInit) { replacedVariableInits.set(this.scope.thisVariable, thisInit); From 249e6df2301c8005f5dbb31734931f935abb0593 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 12 Jan 2025 07:24:48 +0100 Subject: [PATCH 26/32] Do not cache known paramter value as frozen Adding the fallback on each call is not more expensive. --- src/ast/variables/ParameterVariable.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/ast/variables/ParameterVariable.ts b/src/ast/variables/ParameterVariable.ts index b9f354fcf67..0a1595e4a80 100644 --- a/src/ast/variables/ParameterVariable.ts +++ b/src/ast/variables/ParameterVariable.ts @@ -36,11 +36,13 @@ const EMPTY_PATH_TRACKER = new EntityPathTracker(); const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]); export default class ParameterVariable extends LocalVariable { + private argumentsToBeDeoptimized = new Set(); private deoptimizationInteractions: DeoptimizationInteraction[] = []; private deoptimizations = new EntityPathTracker(); private deoptimizedFields = new Set(); - private argumentsToBeDeoptimized = new Set(); private expressionsDependingOnKnownValue: DeoptimizableEntity[] = []; + private knownValue: ExpressionEntity | null = null; + private knownValueLiteral: LiteralValueOrUnknown = UnknownValue; constructor( name: string, @@ -68,6 +70,7 @@ export default class ParameterVariable extends LocalVariable { // This means that we already deoptimized all interactions and no longer // track them entity.deoptimizePath([...this.initPath, UnknownKey]); + // TODO Lukas: Do we need to track?Technically, there should only ever be one argument value } else if (!this.argumentsToBeDeoptimized.has(entity)) { this.argumentsToBeDeoptimized.add(entity); for (const field of this.deoptimizedFields) { @@ -87,6 +90,7 @@ export default class ParameterVariable extends LocalVariable { } } + // TODO Lukas can we replace this with adding a new value? /** This says we should not make assumptions about the value of the parameter. * This is different from deoptimization that will also cause argument values * to be deoptimized. */ @@ -105,8 +109,6 @@ export default class ParameterVariable extends LocalVariable { this.markReassigned(); } - private knownValue: ExpressionEntity | null = null; - private knownValueLiteral: LiteralValueOrUnknown = UnknownValue; /** * Update the known value of the parameter variable. * Must be called for every function call, so it can track all the arguments, @@ -150,7 +152,6 @@ export default class ParameterVariable extends LocalVariable { } } - private frozenValue: ExpressionEntity | null = null; /** * This function freezes the known value of the parameter variable, * so the optimization starts with a certain ExpressionEntity. @@ -158,10 +159,7 @@ export default class ParameterVariable extends LocalVariable { * @returns the frozen value */ private getKnownValue(): ExpressionEntity { - if (this.frozenValue === null) { - this.frozenValue = this.knownValue || UNKNOWN_EXPRESSION; - } - return this.frozenValue; + return this.knownValue || UNKNOWN_EXPRESSION; } getLiteralValueAtPath( From 2ac5a3a13f0c2ebb4c94d90a23ded12e46f1375b Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 13 Jan 2025 07:05:48 +0100 Subject: [PATCH 27/32] Limit number of tracked deoptimized fields for parameters --- src/ast/variables/ParameterVariable.ts | 34 ++++++++++++-------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/ast/variables/ParameterVariable.ts b/src/ast/variables/ParameterVariable.ts index 0a1595e4a80..cfe5abf54a3 100644 --- a/src/ast/variables/ParameterVariable.ts +++ b/src/ast/variables/ParameterVariable.ts @@ -29,7 +29,8 @@ interface DeoptimizationInteraction { path: ObjectPath; } -const MAX_TRACKED_INTERACTIONS = 20; +const MAX_TRACKED_INTERACTIONS = 10; +const MAX_DEOPTIMIZED_FIELDS = 5; const NO_INTERACTIONS = EMPTY_ARRAY as unknown as DeoptimizationInteraction[]; const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]); const EMPTY_PATH_TRACKER = new EntityPathTracker(); @@ -70,17 +71,12 @@ export default class ParameterVariable extends LocalVariable { // This means that we already deoptimized all interactions and no longer // track them entity.deoptimizePath([...this.initPath, UnknownKey]); - // TODO Lukas: Do we need to track?Technically, there should only ever be one argument value } else if (!this.argumentsToBeDeoptimized.has(entity)) { this.argumentsToBeDeoptimized.add(entity); for (const field of this.deoptimizedFields) { entity.deoptimizePath([...this.initPath, field]); } for (const { interaction, path } of this.deoptimizationInteractions) { - if (this.initPath.length + path.length > MAX_PATH_DEPTH) { - deoptimizeInteraction(interaction); - continue; - } entity.deoptimizeArgumentsOnInteractionAtPath( interaction, [...this.initPath, ...path], @@ -90,7 +86,6 @@ export default class ParameterVariable extends LocalVariable { } } - // TODO Lukas can we replace this with adding a new value? /** This says we should not make assumptions about the value of the parameter. * This is different from deoptimization that will also cause argument values * to be deoptimized. */ @@ -140,14 +135,12 @@ export default class ParameterVariable extends LocalVariable { return; } - const oldValue = this.knownValueLiteral; - if (typeof oldValue === 'symbol') { - this.markReassigned(); - return; - } - // add tracking for the new argument - const newValue = argument.getLiteralValueAtPath(this.initPath, SHARED_RECURSION_TRACKER, this); - if (newValue !== oldValue) { + const { knownValueLiteral } = this; + if ( + typeof knownValueLiteral === 'symbol' || + argument.getLiteralValueAtPath(this.initPath, SHARED_RECURSION_TRACKER, this) !== + knownValueLiteral + ) { this.markReassigned(); } } @@ -216,7 +209,8 @@ export default class ParameterVariable extends LocalVariable { this.deoptimizationInteractions.length >= MAX_TRACKED_INTERACTIONS || (path.length === 1 && (this.deoptimizedFields.has(UnknownKey) || - (interaction.type === INTERACTION_CALLED && this.deoptimizedFields.has(path[0])))) + (interaction.type === INTERACTION_CALLED && this.deoptimizedFields.has(path[0])))) || + this.initPath.length + path.length > MAX_PATH_DEPTH ) { deoptimizeInteraction(interaction); return; @@ -246,11 +240,15 @@ export default class ParameterVariable extends LocalVariable { if (this.deoptimizedFields.has(UnknownKey)) { return; } - const key = path[0]; + let key = path[0]; if (this.deoptimizedFields.has(key)) { return; } - this.deoptimizedFields.add(key); + if (this.deoptimizedFields.size > MAX_DEOPTIMIZED_FIELDS) { + key = UnknownKey; + } else { + this.deoptimizedFields.add(key); + } for (const entity of this.argumentsToBeDeoptimized) { // We do not need a recursion tracker here as we already track whether // this field is deoptimized From 8c80d5f657f0777d14bd75d446fee3fa4b7639fc Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 14 Jan 2025 06:41:14 +0100 Subject: [PATCH 28/32] 4.31.0-0 --- browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/package.json b/browser/package.json index 5814cd65fac..c45134e1018 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "4.30.1", + "version": "4.31.0-0", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index c140ae93cfd..46ea4e652e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "4.30.1", + "version": "4.31.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "4.30.1", + "version": "4.31.0-0", "license": "MIT", "dependencies": { "@types/estree": "1.0.6" diff --git a/package.json b/package.json index 84a96eff5db..73c25e4fea5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "4.30.1", + "version": "4.31.0-0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From 0b6114a2f01c3f1e319327007ba8d90de7b689ea Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 27 Jan 2025 06:58:34 +0100 Subject: [PATCH 29/32] Remove unnecessary array conversion --- src/ast/nodes/shared/ObjectEntity.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ast/nodes/shared/ObjectEntity.ts b/src/ast/nodes/shared/ObjectEntity.ts index 52fd6facd3b..dc8ea373cc3 100644 --- a/src/ast/nodes/shared/ObjectEntity.ts +++ b/src/ast/nodes/shared/ObjectEntity.ts @@ -372,12 +372,10 @@ export class ObjectEntity extends ExpressionEntity { const [includedMembers, includedPath] = typeof key === 'string' ? [ - [ - ...new Set([ - ...(this.propertiesAndGettersByKey[key] || this.unmatchablePropertiesAndGetters), - ...(this.propertiesAndSettersByKey[key] || this.unmatchablePropertiesAndSetters) - ]) - ], + new Set([ + ...(this.propertiesAndGettersByKey[key] || this.unmatchablePropertiesAndGetters), + ...(this.propertiesAndSettersByKey[key] || this.unmatchablePropertiesAndSetters) + ]), subPath ] : [this.allProperties, UNKNOWN_PATH]; From 1c155365abf1a4fe76338a761f4d378a6607d06c Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 27 Jan 2025 20:54:42 +0100 Subject: [PATCH 30/32] Only track top-level inclusions for parameters This is a massive performance improvement especially in scenarios with recursive calls where different properties of a function argument are passed to the same function. --- src/ast/scopes/ParameterScope.ts | 8 +- src/ast/utils/PathTracker.ts | 83 ++++++++++++++----- src/ast/variables/ArgumentsVariable.ts | 1 + src/ast/variables/LocalVariable.ts | 5 +- src/ast/variables/ParameterVariable.ts | 15 ++-- .../_expected.js | 4 +- .../recursive-property-access/_config.js | 8 ++ .../samples/recursive-property-access/main.js | 29 +++++++ 8 files changed, 117 insertions(+), 36 deletions(-) create mode 100644 test/function/samples/recursive-property-access/_config.js create mode 100644 test/function/samples/recursive-property-access/main.js diff --git a/src/ast/scopes/ParameterScope.ts b/src/ast/scopes/ParameterScope.ts index 9b656b4b30f..25914d86c82 100644 --- a/src/ast/scopes/ParameterScope.ts +++ b/src/ast/scopes/ParameterScope.ts @@ -81,16 +81,16 @@ export default class ParameterScope extends ChildScope { // handle empty destructuring to avoid destructuring undefined argumentIncluded = true; } else { - for (const variable of parameterVariables) { - if (variable.calledFromTryStatement) { + for (const parameterVariable of parameterVariables) { + if (parameterVariable.calledFromTryStatement) { calledFromTryStatement = true; } - if (variable.included) { + if (parameterVariable.included) { argumentIncluded = true; if (calledFromTryStatement) { argument.include(context, true); } else { - variable.includeArgumentPaths(argument, context); + parameterVariable.includeArgumentPaths(argument, context); argument.include(context, false); } } diff --git a/src/ast/utils/PathTracker.ts b/src/ast/utils/PathTracker.ts index e2eeff3b293..5592eeb9c97 100644 --- a/src/ast/utils/PathTracker.ts +++ b/src/ast/utils/PathTracker.ts @@ -112,6 +112,10 @@ export class DiscriminatedPathTracker { } } +export interface IncludedPathTracker { + includePathAndGetIfIncluded(path: ObjectPath): boolean; +} + interface IncludedPaths { [pathSegment: string]: IncludedPaths; [UnknownKey]?: IncludedPaths; @@ -119,7 +123,7 @@ interface IncludedPaths { const UNKNOWN_INCLUDED_PATH: IncludedPaths = Object.freeze({ [UnknownKey]: EMPTY_OBJECT }); -export class IncludedPathTracker { +export class IncludedFullPathTracker implements IncludedPathTracker { private includedPaths: IncludedPaths | null = null; includePathAndGetIfIncluded(path: ObjectPath): boolean { @@ -147,29 +151,68 @@ export class IncludedPathTracker { } return included; } +} + +// "true" means not sub-paths are included, "UnknownKey" means at least some sub-paths are included +interface IncludedTopLevelPaths { + [pathSegment: string]: true | typeof UnknownKey; + [UnknownKey]?: true; +} + +const UNKNOWN_INCLUDED_TOP_LEVEL_PATH: IncludedTopLevelPaths = Object.freeze({ + [UnknownKey]: true as const +}); + +export class IncludedTopLevelPathTracker implements IncludedPathTracker { + private includedPaths: IncludedTopLevelPaths | null = null; + + includePathAndGetIfIncluded(path: ObjectPath): boolean { + let included = true; + const includedPaths: IncludedTopLevelPaths = (this.includedPaths ||= + ((included = false), Object.create(null))); + if (includedPaths[UnknownKey]) { + return true; + } + const [firstPathSegment, secondPathSegment] = path; + if (!firstPathSegment) { + return included; + } + if (typeof firstPathSegment === 'symbol') { + this.includedPaths = UNKNOWN_INCLUDED_TOP_LEVEL_PATH; + return false; + } + if (secondPathSegment) { + if (includedPaths[firstPathSegment] === UnknownKey) { + return true; + } + includedPaths[firstPathSegment] = UnknownKey; + return false; + } + if (includedPaths[firstPathSegment]) { + return true; + } + includedPaths[firstPathSegment] = true; + return false; + } includeAllPaths(entity: ExpressionEntity, context: InclusionContext, basePath: ObjectPath) { const { includedPaths } = this; if (includedPaths) { - includeAllPaths(entity, context, basePath, includedPaths); + if (includedPaths[UnknownKey]) { + entity.includePath([...basePath, UnknownKey], context); + } else { + const inclusionEntries = Object.entries(includedPaths); + if (inclusionEntries.length === 0) { + entity.includePath(basePath, context); + } else { + for (const [key, value] of inclusionEntries) { + entity.includePath( + value === UnknownKey ? [...basePath, key, UnknownKey] : [...basePath, key], + context + ); + } + } + } } } } - -function includeAllPaths( - entity: ExpressionEntity, - context: InclusionContext, - basePath: ObjectPath, - currentPaths: IncludedPaths -): void { - if (currentPaths[UnknownKey]) { - return entity.includePath([...basePath, UnknownKey], context); - } - const keys = Object.keys(currentPaths); - if (keys.length === 0) { - return entity.includePath(basePath, context); - } - for (const key of keys) { - includeAllPaths(entity, context, [...basePath, key], currentPaths[key]); - } -} diff --git a/src/ast/variables/ArgumentsVariable.ts b/src/ast/variables/ArgumentsVariable.ts index 531d5e7f9a9..e5601f24ea0 100644 --- a/src/ast/variables/ArgumentsVariable.ts +++ b/src/ast/variables/ArgumentsVariable.ts @@ -15,6 +15,7 @@ export default class ArgumentsVariable extends LocalVariable { super('arguments', null, UNKNOWN_EXPRESSION, EMPTY_PATH, context, 'other'); } + // TODO Lukas can we detect if it is used and otherwise not push into deoptimizedArguments? addArgumentToBeDeoptimized(argument: ExpressionEntity): void { if (this.included) { argument.deoptimizePath(UNKNOWN_PATH); diff --git a/src/ast/variables/LocalVariable.ts b/src/ast/variables/LocalVariable.ts index a62398a5af5..755a6eeed22 100644 --- a/src/ast/variables/LocalVariable.ts +++ b/src/ast/variables/LocalVariable.ts @@ -22,9 +22,10 @@ import { import type { Node } from '../nodes/shared/Node'; import type { VariableKind } from '../nodes/shared/VariableKinds'; import { limitConcatenatedPathDepth, MAX_PATH_DEPTH } from '../utils/limitPathLength'; +import type { IncludedPathTracker } from '../utils/PathTracker'; import { type EntityPathTracker, - IncludedPathTracker, + IncludedFullPathTracker, type ObjectPath, UNKNOWN_PATH, UnknownKey @@ -41,7 +42,7 @@ export default class LocalVariable extends Variable { // Caching and deoptimization: // We track deoptimization when we do not return something unknown protected deoptimizationTracker: EntityPathTracker; - protected includedPathTracker = new IncludedPathTracker(); + protected includedPathTracker: IncludedPathTracker = new IncludedFullPathTracker(); private expressionsToBeDeoptimized: DeoptimizableEntity[] = []; constructor( diff --git a/src/ast/variables/ParameterVariable.ts b/src/ast/variables/ParameterVariable.ts index cfe5abf54a3..0f165360206 100644 --- a/src/ast/variables/ParameterVariable.ts +++ b/src/ast/variables/ParameterVariable.ts @@ -18,6 +18,7 @@ import { MAX_PATH_DEPTH } from '../utils/limitPathLength'; import type { ObjectPath, ObjectPathKey } from '../utils/PathTracker'; import { EntityPathTracker, + IncludedTopLevelPathTracker, SHARED_RECURSION_TRACKER, UNKNOWN_PATH, UnknownKey @@ -29,14 +30,14 @@ interface DeoptimizationInteraction { path: ObjectPath; } -const MAX_TRACKED_INTERACTIONS = 10; -const MAX_DEOPTIMIZED_FIELDS = 5; +const MAX_TRACKED_INTERACTIONS = 20; const NO_INTERACTIONS = EMPTY_ARRAY as unknown as DeoptimizationInteraction[]; const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]); const EMPTY_PATH_TRACKER = new EntityPathTracker(); const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]); export default class ParameterVariable extends LocalVariable { + protected includedPathTracker = new IncludedTopLevelPathTracker(); private argumentsToBeDeoptimized = new Set(); private deoptimizationInteractions: DeoptimizationInteraction[] = []; private deoptimizations = new EntityPathTracker(); @@ -72,6 +73,7 @@ export default class ParameterVariable extends LocalVariable { // track them entity.deoptimizePath([...this.initPath, UnknownKey]); } else if (!this.argumentsToBeDeoptimized.has(entity)) { + // TODO Lukas we should not track too many of these this.argumentsToBeDeoptimized.add(entity); for (const field of this.deoptimizedFields) { entity.deoptimizePath([...this.initPath, field]); @@ -201,6 +203,7 @@ export default class ParameterVariable extends LocalVariable { ); } + // TODO Lukas limit the number of tracked interactions if possible deoptimizeArgumentsOnInteractionAtPath(interaction: NodeInteraction, path: ObjectPath): void { // For performance reasons, we fully deoptimize all deeper interactions if ( @@ -240,15 +243,11 @@ export default class ParameterVariable extends LocalVariable { if (this.deoptimizedFields.has(UnknownKey)) { return; } - let key = path[0]; + const key = path[0]; if (this.deoptimizedFields.has(key)) { return; } - if (this.deoptimizedFields.size > MAX_DEOPTIMIZED_FIELDS) { - key = UnknownKey; - } else { - this.deoptimizedFields.add(key); - } + this.deoptimizedFields.add(key); for (const entity of this.argumentsToBeDeoptimized) { // We do not need a recursion tracker here as we already track whether // this field is deoptimized diff --git a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js index ed6b0d51236..00e03a61dce 100644 --- a/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js +++ b/test/form/samples/object-expression-treeshaking/remove-unused-parameter-props/_expected.js @@ -5,7 +5,7 @@ function test1(obj) { console.log( test1({ a: { b: 1, c: 2 }, - d: { e: 4}}) + d: { e: 4, f: 5 }}) ); function test2(obj) { @@ -15,4 +15,4 @@ function test2(obj) { test2({ a: { b: 1, c: 2 }, - d: { e: 4}}); + d: { e: 4, f: 5 }}); diff --git a/test/function/samples/recursive-property-access/_config.js b/test/function/samples/recursive-property-access/_config.js new file mode 100644 index 00000000000..f9baf190c44 --- /dev/null +++ b/test/function/samples/recursive-property-access/_config.js @@ -0,0 +1,8 @@ +const assert = require('assert'); + +module.exports = defineTest({ + description: 'handles accessing different properties in recursive calls with good performance', + exports(exports) { + assert.strictEqual(exports.test({ u: { s: { w: 42 } } }), 42); + } +}); diff --git a/test/function/samples/recursive-property-access/main.js b/test/function/samples/recursive-property-access/main.js new file mode 100644 index 00000000000..6409ae14d16 --- /dev/null +++ b/test/function/samples/recursive-property-access/main.js @@ -0,0 +1,29 @@ +export function test(arg) { + if (arg.a) return test(arg.a); + if (arg.b) return test(arg.b); + if (arg.c) return test(arg.c); + if (arg.d) return test(arg.d); + if (arg.e) return test(arg.e); + if (arg.f) return test(arg.f); + if (arg.g) return test(arg.g); + if (arg.h) return test(arg.h); + if (arg.i) return test(arg.i); + if (arg.j) return test(arg.j); + if (arg.k) return test(arg.k); + if (arg.l) return test(arg.l); + if (arg.m) return test(arg.m); + if (arg.n) return test(arg.n); + if (arg.o) return test(arg.o); + if (arg.p) return test(arg.p); + if (arg.q) return test(arg.q); + if (arg.r) return test(arg.r); + if (arg.s) return test(arg.s); + if (arg.t) return test(arg.t); + if (arg.u) return test(arg.u); + if (arg.v) return test(arg.v); + if (arg.w) return test(arg.w); + if (arg.x) return test(arg.x); + if (arg.y) return test(arg.y); + if (arg.z) return test(arg.z); + return arg; +} From e9f1e3a5311c5e52e248ee535a7bd12117db023e Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Mon, 27 Jan 2025 21:06:37 +0100 Subject: [PATCH 31/32] Only track arguments in the ArgumentsVariable if referenced This should save some memory which is rarely needed. --- src/ast/nodes/shared/Node.ts | 7 +++++-- src/ast/variables/ArgumentsVariable.ts | 28 +++++++++++++++++--------- src/ast/variables/ParameterVariable.ts | 2 -- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/ast/nodes/shared/Node.ts b/src/ast/nodes/shared/Node.ts index 4bfcf84c334..a56512f0b70 100644 --- a/src/ast/nodes/shared/Node.ts +++ b/src/ast/nodes/shared/Node.ts @@ -402,8 +402,11 @@ export function locateNode(node: Node): Location & { file: string } { return location; } -export function logNode(node: Node): string { - return node.scope.context.code.slice(node.start, node.end); +export function logNode(node: Node | ExpressionEntity): string { + if ('scope' in node) { + return node.scope.context.code.slice(node.start, node.end); + } + return node.constructor.name; } export function onlyIncludeSelf(this: NodeBase) { diff --git a/src/ast/variables/ArgumentsVariable.ts b/src/ast/variables/ArgumentsVariable.ts index e5601f24ea0..7201572c60e 100644 --- a/src/ast/variables/ArgumentsVariable.ts +++ b/src/ast/variables/ArgumentsVariable.ts @@ -9,19 +9,19 @@ import { EMPTY_PATH, UNKNOWN_PATH } from '../utils/PathTracker'; import LocalVariable from './LocalVariable'; export default class ArgumentsVariable extends LocalVariable { - private deoptimizedArguments: ExpressionEntity[] = []; + deoptimizedArguments?: ExpressionEntity[]; constructor(context: AstContext) { super('arguments', null, UNKNOWN_EXPRESSION, EMPTY_PATH, context, 'other'); } - // TODO Lukas can we detect if it is used and otherwise not push into deoptimizedArguments? - addArgumentToBeDeoptimized(argument: ExpressionEntity): void { - if (this.included) { - argument.deoptimizePath(UNKNOWN_PATH); - } else { - this.deoptimizedArguments.push(argument); - } + addArgumentToBeDeoptimized(_argument: ExpressionEntity) {} + + // Only If there is at least one reference, then we need to track all + // arguments in order to be able to deoptimize them. + addReference() { + this.deoptimizedArguments = []; + this.addArgumentToBeDeoptimized = addArgumentToBeDeoptimized; } hasEffectsOnInteractionAtPath(path: ObjectPath, { type }: NodeInteraction): boolean { @@ -30,9 +30,17 @@ export default class ArgumentsVariable extends LocalVariable { includePath(path: ObjectPath, context: InclusionContext) { super.includePath(path, context); - for (const argument of this.deoptimizedArguments) { + for (const argument of this.deoptimizedArguments!) { argument.deoptimizePath(UNKNOWN_PATH); } - this.deoptimizedArguments.length = 0; + this.deoptimizedArguments!.length = 0; + } +} + +function addArgumentToBeDeoptimized(this: ArgumentsVariable, argument: ExpressionEntity) { + if (this.included) { + argument.deoptimizePath(UNKNOWN_PATH); + } else { + this.deoptimizedArguments?.push(argument); } } diff --git a/src/ast/variables/ParameterVariable.ts b/src/ast/variables/ParameterVariable.ts index 0f165360206..3174389b759 100644 --- a/src/ast/variables/ParameterVariable.ts +++ b/src/ast/variables/ParameterVariable.ts @@ -73,7 +73,6 @@ export default class ParameterVariable extends LocalVariable { // track them entity.deoptimizePath([...this.initPath, UnknownKey]); } else if (!this.argumentsToBeDeoptimized.has(entity)) { - // TODO Lukas we should not track too many of these this.argumentsToBeDeoptimized.add(entity); for (const field of this.deoptimizedFields) { entity.deoptimizePath([...this.initPath, field]); @@ -203,7 +202,6 @@ export default class ParameterVariable extends LocalVariable { ); } - // TODO Lukas limit the number of tracked interactions if possible deoptimizeArgumentsOnInteractionAtPath(interaction: NodeInteraction, path: ObjectPath): void { // For performance reasons, we fully deoptimize all deeper interactions if ( From f854e1988542d09f9691923eddd80888e92240d3 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Tue, 28 Jan 2025 09:02:48 +0100 Subject: [PATCH 32/32] 4.33.0-0 --- browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/package.json b/browser/package.json index 04401c5cebc..16fac6aafdd 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "4.32.1", + "version": "4.33.0-0", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index fbe30b30dd4..b72bc57d87d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "4.32.1", + "version": "4.33.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "4.32.1", + "version": "4.33.0-0", "license": "MIT", "dependencies": { "@types/estree": "1.0.6" diff --git a/package.json b/package.json index 30da23a897c..631b18d61a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "4.32.1", + "version": "4.33.0-0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js",