support format g4 (#232)

* chore: install antlr-format-cli to format g4 files

* style: format all g4 files

* chore: apply antlr-format to lint-staged
This commit is contained in:
Hayden 2023-12-12 20:05:21 +08:00 committed by GitHub
parent 17eba1f2aa
commit 14a5214e82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 16763 additions and 13690 deletions

View File

@ -1,4 +1,5 @@
module.exports = { module.exports = {
'*.js': [`prettier --write`], '*.js': [`prettier --write`],
'*.ts': [`prettier --write`], '*.ts': [`prettier --write`],
'*.g4': [`antlr-format -c ./antlr.format.json -v`],
}; };

34
antlr.format.json Normal file
View File

@ -0,0 +1,34 @@
{
"main": {
"alignTrailingComments": true,
"columnLimit": 150,
"minEmptyLines": 1,
"maxEmptyLinesToKeep": 1,
"reflowComments": false,
"useTab": false,
"allowShortRulesOnASingleLine": false,
"allowShortBlocksOnASingleLine": true,
"alignSemicolons": "hanging",
"alignColons": "hanging",
"spaceBeforeAssignmentOperators": false,
"keepEmptyLinesAtTheStartOfBlocks": true
},
"lexer": {
"alignTrailingComments": true,
"columnLimit": 150,
"maxEmptyLinesToKeep": 1,
"reflowComments": false,
"useTab": false,
"allowShortRulesOnASingleLine": true,
"allowShortBlocksOnASingleLine": true,
"minEmptyLines": 0,
"alignSemicolons": "none",
"alignColons": "trailing",
"singleLineOverrulesHangingColon": true,
"alignLexerCommands": true,
"alignLabels": true,
"alignTrailers": true,
"spaceBeforeAssignmentOperators": false,
"groupedAlignments": true
}
}

View File

@ -28,6 +28,7 @@
"release": "node ./scripts/release.js", "release": "node ./scripts/release.js",
"lint": "prettier --check '**/*.ts' --config ./.prettierrc", "lint": "prettier --check '**/*.ts' --config ./.prettierrc",
"lint-fix": "prettier --write '**/*.ts' --config ./.prettierrc", "lint-fix": "prettier --write '**/*.ts' --config ./.prettierrc",
"format-g4": "antlr-format -c ./antlr.format.json -v ./src/grammar/**/*.g4",
"cleanComment": "node ./scripts/cleanCommentCli.js" "cleanComment": "node ./scripts/cleanCommentCli.js"
}, },
"license": "MIT", "license": "MIT",
@ -39,6 +40,7 @@
"@swc/jest": "^0.2.26", "@swc/jest": "^0.2.26",
"@types/jest": "^29.5.1", "@types/jest": "^29.5.1",
"@types/node": "^18.15.11", "@types/node": "^18.15.11",
"antlr-format-cli": "^1.2.1",
"antlr4ts-cli": "^0.5.0-alpha.4", "antlr4ts-cli": "^0.5.0-alpha.4",
"chalk": "4.1.2", "chalk": "4.1.2",
"commitizen": "^4.3.0", "commitizen": "^4.3.0",

View File

@ -8,6 +8,7 @@ specifiers:
'@swc/jest': ^0.2.26 '@swc/jest': ^0.2.26
'@types/jest': ^29.5.1 '@types/jest': ^29.5.1
'@types/node': ^18.15.11 '@types/node': ^18.15.11
antlr-format-cli: ^1.2.1
antlr4-c3: 3.1.1 antlr4-c3: 3.1.1
antlr4ts: 0.5.0-alpha.4 antlr4ts: 0.5.0-alpha.4
antlr4ts-cli: ^0.5.0-alpha.4 antlr4ts-cli: ^0.5.0-alpha.4
@ -35,6 +36,7 @@ devDependencies:
'@swc/jest': 0.2.26_@swc+core@1.3.60 '@swc/jest': 0.2.26_@swc+core@1.3.60
'@types/jest': 29.5.1 '@types/jest': 29.5.1
'@types/node': 18.16.16 '@types/node': 18.16.16
antlr-format-cli: 1.2.1
antlr4ts-cli: 0.5.0-alpha.4 antlr4ts-cli: 0.5.0-alpha.4
chalk: 4.1.2 chalk: 4.1.2
commitizen: 4.3.0_@swc+core@1.3.60 commitizen: 4.3.0_@swc+core@1.3.60
@ -351,6 +353,13 @@ packages:
'@babel/helper-plugin-utils': 7.21.5 '@babel/helper-plugin-utils': 7.21.5
dev: true dev: true
/@babel/runtime/7.23.6:
resolution: {integrity: sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==}
engines: {node: '>=6.9.0'}
dependencies:
regenerator-runtime: 0.14.0
dev: true
/@babel/template/7.21.9: /@babel/template/7.21.9:
resolution: {integrity: sha512-MK0X5k8NKOuWRamiEfc3KEJiHMTkGZNUjzMipqCGDDc6ijRl/B7RGSKVGncu4Ro/HdyzzY6cmoXuKI2Gffk7vQ==} resolution: {integrity: sha512-MK0X5k8NKOuWRamiEfc3KEJiHMTkGZNUjzMipqCGDDc6ijRl/B7RGSKVGncu4Ro/HdyzzY6cmoXuKI2Gffk7vQ==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
@ -587,6 +596,11 @@ packages:
'@jridgewell/trace-mapping': 0.3.9 '@jridgewell/trace-mapping': 0.3.9
dev: true dev: true
/@humanwhocodes/momoa/2.0.4:
resolution: {integrity: sha512-RE815I4arJFtt+FVeU1Tgp9/Xvecacji8w/V6XtXsWWH/wz/eNkNbhb+ny/+PlVZjV0rxQpRSQKNKE3lcktHEA==}
engines: {node: '>=10.10.0'}
dev: true
/@hutson/parse-repository-url/3.0.2: /@hutson/parse-repository-url/3.0.2:
resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==} resolution: {integrity: sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
@ -899,6 +913,22 @@ packages:
dev: true dev: true
optional: true optional: true
/@readme/better-ajv-errors/1.6.0_ajv@8.12.0:
resolution: {integrity: sha512-9gO9rld84Jgu13kcbKRU+WHseNhaVt76wYMeRDGsUGYxwJtI3RmEJ9LY9dZCYQGI8eUZLuxb5qDja0nqklpFjQ==}
engines: {node: '>=14'}
peerDependencies:
ajv: 4.11.8 - 8
dependencies:
'@babel/code-frame': 7.21.4
'@babel/runtime': 7.23.6
'@humanwhocodes/momoa': 2.0.4
ajv: 8.12.0
chalk: 4.1.2
json-to-ast: 2.1.0
jsonpointer: 5.0.1
leven: 3.1.0
dev: true
/@sinclair/typebox/0.25.24: /@sinclair/typebox/0.25.24:
resolution: {integrity: sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==} resolution: {integrity: sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==}
dev: true dev: true
@ -1112,6 +1142,10 @@ packages:
pretty-format: 29.5.0 pretty-format: 29.5.0
dev: true dev: true
/@types/json-schema/7.0.15:
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
dev: true
/@types/minimist/1.2.2: /@types/minimist/1.2.2:
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
dev: true dev: true
@ -1233,12 +1267,32 @@ packages:
engines: {node: '>=12'} engines: {node: '>=12'}
dev: true dev: true
/antlr-format-cli/1.2.1:
resolution: {integrity: sha512-vqpoL9x3bXiNnC/vzZG3XOyk2vUAHPmBbI/ufyAqbxQHD27OPuUM4n/6m6NBEZZ7V4U2aEiefnZg2SCaSU89oA==}
hasBin: true
dependencies:
'@readme/better-ajv-errors': 1.6.0_ajv@8.12.0
ajv: 8.12.0
antlr4ng: 2.0.2
commander: 11.1.0
glob: 10.3.10
ts-json-schema-generator: 1.4.0
transitivePeerDependencies:
- antlr4ng-cli
dev: true
/antlr4-c3/3.1.1: /antlr4-c3/3.1.1:
resolution: {integrity: sha512-S7DixV12kxWexTkQYGvooCgHYU5AjF74oYio+ZNgm0XN3EzxDY3J6Si9GprQ4KksvgWwK//EgZnL/26WB+bOpw==} resolution: {integrity: sha512-S7DixV12kxWexTkQYGvooCgHYU5AjF74oYio+ZNgm0XN3EzxDY3J6Si9GprQ4KksvgWwK//EgZnL/26WB+bOpw==}
dependencies: dependencies:
antlr4ts: 0.5.0-alpha.4 antlr4ts: 0.5.0-alpha.4
dev: false dev: false
/antlr4ng/2.0.2:
resolution: {integrity: sha512-Fhs3AvhoGigRt3RpHw0wGA7n03j9BpskH9yCUViNB7NtKuCA+imy2orEZ8qcgPG98f7IryEPYlG9sx99f3ZOyw==}
peerDependencies:
antlr4ng-cli: 1.0.4
dev: true
/antlr4ts-cli/0.5.0-alpha.4: /antlr4ts-cli/0.5.0-alpha.4:
resolution: {integrity: sha512-lVPVBTA2CVHRYILSKilL6Jd4hAumhSZZWA7UbQNQrmaSSj7dPmmYaN4bOmZG79cOy0lS00i4LY68JZZjZMWVrw==} resolution: {integrity: sha512-lVPVBTA2CVHRYILSKilL6Jd4hAumhSZZWA7UbQNQrmaSSj7dPmmYaN4bOmZG79cOy0lS00i4LY68JZZjZMWVrw==}
hasBin: true hasBin: true
@ -1558,6 +1612,11 @@ packages:
engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'}
dev: true dev: true
/code-error-fragment/0.0.230:
resolution: {integrity: sha512-cadkfKp6932H8UkhzE/gcUqhRMNf8jHzkAN7+5Myabswaghu4xABTgPHDCjW+dBAJxj/SpkTYokpzDqY4pCzQw==}
engines: {node: '>= 4'}
dev: true
/collect-v8-coverage/1.0.1: /collect-v8-coverage/1.0.1:
resolution: {integrity: sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==} resolution: {integrity: sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==}
dev: true dev: true
@ -1587,6 +1646,11 @@ packages:
resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==}
dev: true dev: true
/commander/11.1.0:
resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}
engines: {node: '>=16'}
dev: true
/commander/9.5.0: /commander/9.5.0:
resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==} resolution: {integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==}
engines: {node: ^12.20.0 || >=14} engines: {node: ^12.20.0 || >=14}
@ -2312,6 +2376,17 @@ packages:
path-is-absolute: 1.0.1 path-is-absolute: 1.0.1
dev: true dev: true
/glob/8.1.0:
resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==}
engines: {node: '>=12'}
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
inherits: 2.0.4
minimatch: 5.1.6
once: 1.4.0
dev: true
/global-dirs/0.1.1: /global-dirs/0.1.1:
resolution: {integrity: sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==} resolution: {integrity: sha512-NknMLn7F2J7aflwFOlGdNIuCDpN3VGoSoB+aap3KABFWbHVn1TCgFC+np23J8W2BiZbjfEw3BFBycSMv1AFblg==}
engines: {node: '>=4'} engines: {node: '>=4'}
@ -2348,6 +2423,10 @@ packages:
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
dev: true dev: true
/grapheme-splitter/1.0.4:
resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==}
dev: true
/handlebars/4.7.7: /handlebars/4.7.7:
resolution: {integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==} resolution: {integrity: sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==}
engines: {node: '>=0.4.7'} engines: {node: '>=0.4.7'}
@ -3107,6 +3186,14 @@ packages:
resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==}
dev: true dev: true
/json-to-ast/2.1.0:
resolution: {integrity: sha512-W9Lq347r8tA1DfMvAGn9QNcgYm4Wm7Yc+k8e6vezpMnRT+NHbtlxgNBXRVjXe9YM6eTn6+p/MKOlV/aABJcSnQ==}
engines: {node: '>= 4'}
dependencies:
code-error-fragment: 0.0.230
grapheme-splitter: 1.0.4
dev: true
/json5/2.2.3: /json5/2.2.3:
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -3130,6 +3217,11 @@ packages:
engines: {'0': node >= 0.2.0} engines: {'0': node >= 0.2.0}
dev: true dev: true
/jsonpointer/5.0.1:
resolution: {integrity: sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==}
engines: {node: '>=0.10.0'}
dev: true
/kind-of/6.0.3: /kind-of/6.0.3:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -3405,6 +3497,13 @@ packages:
brace-expansion: 1.1.11 brace-expansion: 1.1.11
dev: true dev: true
/minimatch/5.1.6:
resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
engines: {node: '>=10'}
dependencies:
brace-expansion: 2.0.1
dev: true
/minimatch/9.0.3: /minimatch/9.0.3:
resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==}
engines: {node: '>=16 || 14 >=14.17'} engines: {node: '>=16 || 14 >=14.17'}
@ -3823,6 +3922,10 @@ packages:
strip-indent: 3.0.0 strip-indent: 3.0.0
dev: true dev: true
/regenerator-runtime/0.14.0:
resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==}
dev: true
/require-directory/2.1.1: /require-directory/2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -3910,6 +4013,11 @@ packages:
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
dev: true dev: true
/safe-stable-stringify/2.4.3:
resolution: {integrity: sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==}
engines: {node: '>=10'}
dev: true
/safer-buffer/2.1.2: /safer-buffer/2.1.2:
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
dev: true dev: true
@ -4253,6 +4361,20 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true dev: true
/ts-json-schema-generator/1.4.0:
resolution: {integrity: sha512-wm8vyihmGgYpxrqRshmYkWGNwEk+sf3xV2rUgxv8Ryeh7bSpMO7pZQOht+2rS002eDkFTxR7EwRPXVzrS0WJTg==}
engines: {node: '>=10.0.0'}
hasBin: true
dependencies:
'@types/json-schema': 7.0.15
commander: 11.1.0
glob: 8.1.0
json5: 2.2.3
normalize-path: 3.0.0
safe-stable-stringify: 2.4.3
typescript: 5.2.2
dev: true
/ts-node/10.9.1_0d2585e4297d96d8e906ef9bffd6d443: /ts-node/10.9.1_0d2585e4297d96d8e906ef9bffd6d443:
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true hasBin: true
@ -4324,6 +4446,12 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/typescript/5.2.2:
resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==}
engines: {node: '>=14.17'}
hasBin: true
dev: true
/uglify-js/3.17.4: /uglify-js/3.17.4:
resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==}
engines: {node: '>=0.8.0'} engines: {node: '>=0.8.0'}

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,16 @@
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
// $antlr-format spaceBeforeAssignmentOperators false, keepEmptyLinesAtTheStartOfBlocks true
parser grammar FlinkSqlParser; parser grammar FlinkSqlParser;
options { tokenVocab=FlinkSqlLexer; } options {
tokenVocab=FlinkSqlLexer;
}
program: singleStatement* EOF; program
: singleStatement* EOF
;
singleStatement singleStatement
: sqlStatement SEMICOLON? : sqlStatement SEMICOLON?
@ -10,10 +18,18 @@ singleStatement
; ;
sqlStatement sqlStatement
: ddlStatement | dmlStatement | describeStatement : ddlStatement
| explainStatement | useStatement | showStatememt | dmlStatement
| loadStatement | unloadStatememt | setStatememt | describeStatement
| resetStatememt | jarStatememt | dtAddStatement | explainStatement
| useStatement
| showStatememt
| loadStatement
| unloadStatememt
| setStatememt
| resetStatememt
| jarStatememt
| dtAddStatement
; ;
emptyStatement emptyStatement
@ -21,13 +37,25 @@ emptyStatement
; ;
ddlStatement ddlStatement
: createTable | createDatabase | createView | createFunction | createCatalog : createTable
| alterTable | alertView | alterDatabase | alterFunction | createDatabase
| dropCatalog | dropTable | dropDatabase | dropView | dropFunction | createView
| createFunction
| createCatalog
| alterTable
| alertView
| alterDatabase
| alterFunction
| dropCatalog
| dropTable
| dropDatabase
| dropView
| dropFunction
; ;
dmlStatement dmlStatement
: queryStatement | insertStatement : queryStatement
| insertStatement
; ;
// some statemen // some statemen
@ -36,7 +64,11 @@ describeStatement
; ;
explainStatement explainStatement
: KW_EXPLAIN (explainDetails | KW_PLAN KW_FOR)? (dmlStatement | insertSimpleStatement | insertMulStatement) : KW_EXPLAIN (explainDetails | KW_PLAN KW_FOR)? (
dmlStatement
| insertSimpleStatement
| insertMulStatement
)
; ;
explainDetails explainDetails
@ -44,7 +76,9 @@ explainDetails
; ;
explainDetail explainDetail
: KW_CHANGELOG_MODE | KW_JSON_EXECUTION_PLAN | KW_ESTIMATED_COST : KW_CHANGELOG_MODE
| KW_JSON_EXECUTION_PLAN
| KW_ESTIMATED_COST
; ;
useStatement useStatement
@ -60,8 +94,8 @@ useModuleStatement
showStatememt showStatememt
: KW_SHOW (KW_CATALOGS | KW_DATABASES | KW_VIEWS | KW_JARS) : KW_SHOW (KW_CATALOGS | KW_DATABASES | KW_VIEWS | KW_JARS)
| KW_SHOW KW_CURRENT (KW_CATALOG | KW_DATABASE) | KW_SHOW KW_CURRENT (KW_CATALOG | KW_DATABASE)
| KW_SHOW KW_TABLES (( KW_FROM | KW_IN ) databasePath)? likePredicate? | KW_SHOW KW_TABLES (( KW_FROM | KW_IN) databasePath)? likePredicate?
| KW_SHOW KW_COLUMNS ( KW_FROM | KW_IN ) (viewPath| tablePath) likePredicate? | KW_SHOW KW_COLUMNS ( KW_FROM | KW_IN) (viewPath | tablePath) likePredicate?
| KW_SHOW KW_CREATE (KW_TABLE tablePath | KW_VIEW viewPath) | KW_SHOW KW_CREATE (KW_TABLE tablePath | KW_VIEW viewPath)
| KW_SHOW KW_USER? KW_FUNCTIONS | KW_SHOW KW_USER? KW_FUNCTIONS
| KW_SHOW KW_FULL? KW_MODULES | KW_SHOW KW_FULL? KW_MODULES
@ -91,7 +125,13 @@ jarStatememt
dtAddStatement dtAddStatement
: KW_ADD KW_JAR KW_WITH dtFilePath (KW_AS uid)? : KW_ADD KW_JAR KW_WITH dtFilePath (KW_AS uid)?
| KW_ADD KW_FILE KW_WITH dtFilePath (KW_AS uid)? (KW_RENAME uid)? | KW_ADD KW_FILE KW_WITH dtFilePath (KW_AS uid)? (KW_RENAME uid)?
| KW_ADD (KW_PYTHON_FILES | KW_PYTHON_REQUIREMENTS | KW_PYTHON_DEPENDENCIES | KW_PYTHON_JAR | KW_PYTHON_ARCHIVES) KW_WITH dtFilePath KW_RENAME uid | KW_ADD (
KW_PYTHON_FILES
| KW_PYTHON_REQUIREMENTS
| KW_PYTHON_DEPENDENCIES
| KW_PYTHON_JAR
| KW_PYTHON_ARCHIVES
) KW_WITH dtFilePath KW_RENAME uid
| KW_ADD KW_PYTHON_PARAMETER dtFilePath | KW_ADD KW_PYTHON_PARAMETER dtFilePath
| KW_ADD KW_ENGINE KW_FILE KW_WITH dtFilePath KW_RENAME uid KW_KEY uid | KW_ADD KW_ENGINE KW_FILE KW_WITH dtFilePath KW_RENAME uid KW_KEY uid
| KW_ADD KW_CONFIG KW_FILE KW_WITH dtFilePath KW_FOR uid KW_AS uid | KW_ADD KW_CONFIG KW_FILE KW_WITH dtFilePath KW_FOR uid KW_AS uid
@ -108,16 +148,9 @@ createTable
; ;
simpleCreateTable simpleCreateTable
: KW_CREATE KW_TEMPORARY? KW_TABLE ifNotExists? tablePathCreate : KW_CREATE KW_TEMPORARY? KW_TABLE ifNotExists? tablePathCreate LR_BRACKET columnOptionDefinition (
LR_BRACKET COMMA columnOptionDefinition
columnOptionDefinition (COMMA columnOptionDefinition)* )* (COMMA watermarkDefinition)? (COMMA tableConstraint)? (COMMA selfDefinitionClause)? RR_BRACKET commentSpec? partitionDefinition? withOption
(COMMA watermarkDefinition)?
(COMMA tableConstraint)?
(COMMA selfDefinitionClause)?
RR_BRACKET
commentSpec?
partitionDefinition?
withOption
likeDefinition? likeDefinition?
; ;
@ -141,10 +174,12 @@ physicalColumnDefinition
columnNameCreate columnNameCreate
: uid : uid
| expression; | expression
;
columnName columnName
: uid | expression : uid
| expression
; ;
columnNameList columnNameList
@ -153,9 +188,21 @@ columnNameList
columnType columnType
: typeName=(KW_DATE | KW_BOOLEAN | KW_NULL) : typeName=(KW_DATE | KW_BOOLEAN | KW_NULL)
| typeName=(KW_CHAR | KW_VARCHAR | KW_STRING | KW_BINARY | KW_VARBINARY | KW_BYTES | typeName=(
| KW_TINYINT | KW_SMALLINT |KW_INT | KW_INTEGER | KW_BIGINT KW_CHAR
| KW_TIME | KW_TIMESTAMP_LTZ | KW_DATETIME | KW_VARCHAR
| KW_STRING
| KW_BINARY
| KW_VARBINARY
| KW_BYTES
| KW_TINYINT
| KW_SMALLINT
| KW_INT
| KW_INTEGER
| KW_BIGINT
| KW_TIME
| KW_TIMESTAMP_LTZ
| KW_DATETIME
) lengthOneDimension? ) lengthOneDimension?
| typeName=KW_TIMESTAMP lengthOneDimension? ((KW_WITHOUT | KW_WITH) KW_LOCAL? KW_TIME KW_ZONE)? | typeName=KW_TIMESTAMP lengthOneDimension? ((KW_WITHOUT | KW_WITH) KW_LOCAL? KW_TIME KW_ZONE)?
| typeName=(KW_DECIMAL | KW_DEC | KW_NUMERIC | KW_FLOAT | KW_DOUBLE) lengthTwoOptionalDimension? | typeName=(KW_DECIMAL | KW_DEC | KW_NUMERIC | KW_FLOAT | KW_DOUBLE) lengthTwoOptionalDimension?
@ -190,7 +237,8 @@ rowTypeDimension
; ;
columnConstraint columnConstraint
:(KW_CONSTRAINT constraintName)? KW_PRIMARY KW_KEY (KW_NOT KW_ENFORCED)? | KW_NOT? KW_NULL : (KW_CONSTRAINT constraintName)? KW_PRIMARY KW_KEY (KW_NOT KW_ENFORCED)?
| KW_NOT? KW_NULL
; ;
commentSpec commentSpec
@ -239,9 +287,9 @@ transformList
; ;
transform transform
: columnName #identityTransform : columnName # identityTransform
| qualifiedName #columnTransform | qualifiedName # columnTransform
| LR_BRACKET transformArgument (COMMA transformArgument)* RR_BRACKET #applyTransform | LR_BRACKET transformArgument (COMMA transformArgument)* RR_BRACKET # applyTransform
; ;
transformArgument transformArgument
@ -271,7 +319,9 @@ createView
; ;
createFunction createFunction
: KW_CREATE (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifNotExists? functionNameCreate KW_AS identifier (KW_LANGUAGE (KW_JAVA|KW_SCALA|KW_PYTHON))? usingClause? : KW_CREATE (KW_TEMPORARY | KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifNotExists? functionNameCreate KW_AS identifier (
KW_LANGUAGE (KW_JAVA | KW_SCALA | KW_PYTHON)
)? usingClause?
; ;
usingClause usingClause
@ -287,7 +337,13 @@ jarFileName
// it only includes rename, set key, add constraint, drop constraint, add unique // it only includes rename, set key, add constraint, drop constraint, add unique
alterTable alterTable
: KW_ALTER KW_TABLE ifExists? tablePath (renameDefinition | setKeyValueDefinition | addConstraint | dropConstraint | addUnique) : KW_ALTER KW_TABLE ifExists? tablePath (
renameDefinition
| setKeyValueDefinition
| addConstraint
| dropConstraint
| addUnique
)
; ;
renameDefinition renameDefinition
@ -323,10 +379,11 @@ alterDatabase
; ;
alterFunction alterFunction
: KW_ALTER (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifExists? functionName KW_AS identifier (KW_LANGUAGE (KW_JAVA|KW_SCALA|KW_PYTHON))? // TODO : KW_ALTER (KW_TEMPORARY | KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifExists? functionName KW_AS identifier (
KW_LANGUAGE (KW_JAVA | KW_SCALA | KW_PYTHON)
)? // TODO
; ;
// Drop statements // Drop statements
dropCatalog dropCatalog
@ -346,20 +403,19 @@ dropView
; ;
dropFunction dropFunction
: KW_DROP (KW_TEMPORARY|KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifExists? functionName : KW_DROP (KW_TEMPORARY | KW_TEMPORARY KW_SYSTEM)? KW_FUNCTION ifExists? functionName
; ;
// Insert statements // Insert statements
insertStatement insertStatement
: (KW_EXECUTE? insertSimpleStatement) : (KW_EXECUTE? insertSimpleStatement)
| insertMulStatementCompatibility | (KW_EXECUTE insertMulStatement) | insertMulStatementCompatibility
| (KW_EXECUTE insertMulStatement)
; ;
insertSimpleStatement insertSimpleStatement
: KW_INSERT (KW_INTO | KW_OVERWRITE) tablePath : KW_INSERT (KW_INTO | KW_OVERWRITE) tablePath (
(
insertPartitionDefinition? columnNameList? queryStatement insertPartitionDefinition? columnNameList? queryStatement
| valuesDefinition | valuesDefinition
) )
@ -374,9 +430,7 @@ valuesDefinition
; ;
valuesRowDefinition valuesRowDefinition
: LR_BRACKET : LR_BRACKET constant (COMMA constant)* RR_BRACKET
constant (COMMA constant)*
RR_BRACKET
; ;
insertMulStatementCompatibility insertMulStatementCompatibility
@ -399,7 +453,7 @@ queryStatement
; ;
valuesCaluse valuesCaluse
: KW_VALUES expression (COMMA expression )* : KW_VALUES expression (COMMA expression)*
; ;
withClause withClause
@ -420,12 +474,15 @@ selectStatement
; ;
selectClause selectClause
: KW_SELECT setQuantifier? (ASTERISK_SIGN | projectItemDefinition (COMMA projectItemDefinition)*) : KW_SELECT setQuantifier? (
ASTERISK_SIGN
| projectItemDefinition (COMMA projectItemDefinition)*
)
; ;
projectItemDefinition projectItemDefinition
: overWindowItem : overWindowItem
| columnName (KW_AS? expression )? | columnName (KW_AS? expression)?
; ;
overWindowItem overWindowItem
@ -481,7 +538,7 @@ windoTVFName
: KW_TUMBLE : KW_TUMBLE
| KW_HOP | KW_HOP
| KW_CUMULATE | KW_CUMULATE
; ;
windowTVFParam windowTVFParam
: KW_TABLE timeAttrColumn : KW_TABLE timeAttrColumn
@ -563,25 +620,12 @@ namedWindow
; ;
windowSpec windowSpec
: name=errorCapturingIdentifier? : name=errorCapturingIdentifier? LR_BRACKET partitionByClause? orderByCaluse? windowFrame? RR_BRACKET
LR_BRACKET
partitionByClause?
orderByCaluse?
windowFrame?
RR_BRACKET
; ;
matchRecognizeClause matchRecognizeClause
: KW_MATCH_RECOGNIZE : KW_MATCH_RECOGNIZE LR_BRACKET partitionByClause? orderByCaluse? measuresClause? outputMode? afterMatchStrategy? patternDefination?
LR_BRACKET patternVariablesDefination RR_BRACKET (KW_AS? identifier)?
partitionByClause?
orderByCaluse?
measuresClause?
outputMode?
afterMatchStrategy?
patternDefination?
patternVariablesDefination
RR_BRACKET ( KW_AS? identifier )?
; ;
orderByCaluse orderByCaluse
@ -614,11 +658,7 @@ measuresClause
; ;
patternDefination patternDefination
: KW_PATTERN : KW_PATTERN LR_BRACKET patternVariable+ RR_BRACKET withinClause?
LR_BRACKET
patternVariable+
RR_BRACKET
withinClause?
; ;
patternVariable patternVariable
@ -654,7 +694,6 @@ withinClause
: KW_WITHIN timeIntervalExpression : KW_WITHIN timeIntervalExpression
; ;
// expression // expression
expression expression
@ -662,19 +701,16 @@ expression
; ;
booleanExpression booleanExpression
: KW_NOT booleanExpression #logicalNot : KW_NOT booleanExpression # logicalNot
| KW_EXISTS LR_BRACKET queryStatement RR_BRACKET #exists | KW_EXISTS LR_BRACKET queryStatement RR_BRACKET # exists
| valueExpression predicate? #predicated | valueExpression predicate? # predicated
| left=booleanExpression operator=KW_AND right=booleanExpression #logicalBinary | left=booleanExpression operator=KW_AND right=booleanExpression # logicalBinary
| left=booleanExpression operator=KW_OR right=booleanExpression #logicalBinary | left=booleanExpression operator=KW_OR right=booleanExpression # logicalBinary
| booleanExpression KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE | KW_UNKNOWN | KW_NULL) #logicalNested | booleanExpression KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE | KW_UNKNOWN | KW_NULL) # logicalNested
; ;
predicate predicate
: KW_NOT? : KW_NOT? kind=KW_BETWEEN (KW_ASYMMETRIC | KW_SYMMETRIC)? lower=valueExpression KW_AND upper=valueExpression
kind=KW_BETWEEN (KW_ASYMMETRIC | KW_SYMMETRIC)?
lower=valueExpression KW_AND
upper=valueExpression
| KW_NOT? kind=KW_IN LR_BRACKET expression (COMMA expression)* RR_BRACKET | KW_NOT? kind=KW_IN LR_BRACKET expression (COMMA expression)* RR_BRACKET
| KW_NOT? kind=KW_IN LR_BRACKET queryStatement RR_BRACKET | KW_NOT? kind=KW_IN LR_BRACKET queryStatement RR_BRACKET
| kind=KW_EXISTS LR_BRACKET queryStatement RR_BRACKET | kind=KW_EXISTS LR_BRACKET queryStatement RR_BRACKET
@ -686,42 +722,45 @@ predicate
; ;
likePredicate likePredicate
: KW_NOT? kind=KW_LIKE quantifier=(KW_ANY | KW_ALL) (LR_BRACKET RR_BRACKET | LR_BRACKET expression (COMMA expression)* RR_BRACKET) : KW_NOT? kind=KW_LIKE quantifier=(KW_ANY | KW_ALL) (
LR_BRACKET RR_BRACKET
| LR_BRACKET expression (COMMA expression)* RR_BRACKET
)
| KW_NOT? kind=KW_LIKE pattern=valueExpression (KW_ESCAPE stringLiteral)? | KW_NOT? kind=KW_LIKE pattern=valueExpression (KW_ESCAPE stringLiteral)?
; ;
valueExpression valueExpression
: primaryExpression #valueExpressionDefault : primaryExpression # valueExpressionDefault
| operator=(HYPNEN_SIGN | ADD_SIGN | BIT_NOT_OP) valueExpression #arithmeticUnary | operator=(HYPNEN_SIGN | ADD_SIGN | BIT_NOT_OP) valueExpression # arithmeticUnary
| left=valueExpression operator=(ASTERISK_SIGN | SLASH_SIGN | PENCENT_SIGN | KW_DIV) right=valueExpression #arithmeticBinary | left=valueExpression operator=(ASTERISK_SIGN | SLASH_SIGN | PENCENT_SIGN | KW_DIV) right=valueExpression # arithmeticBinary
| left=valueExpression operator=(ADD_SIGN | HYPNEN_SIGN | DOUBLE_VERTICAL_SIGN) right=valueExpression #arithmeticBinary | left=valueExpression operator=(ADD_SIGN | HYPNEN_SIGN | DOUBLE_VERTICAL_SIGN) right=valueExpression # arithmeticBinary
| left=valueExpression operator=BIT_AND_OP right=valueExpression #arithmeticBinary | left=valueExpression operator=BIT_AND_OP right=valueExpression # arithmeticBinary
| left=valueExpression operator=BIT_XOR_OP right=valueExpression #arithmeticBinary | left=valueExpression operator=BIT_XOR_OP right=valueExpression # arithmeticBinary
| left=valueExpression operator=BIT_OR_OP right=valueExpression #arithmeticBinary | left=valueExpression operator=BIT_OR_OP right=valueExpression # arithmeticBinary
| left=valueExpression comparisonOperator right=valueExpression #comparison | left=valueExpression comparisonOperator right=valueExpression # comparison
; ;
primaryExpression primaryExpression
: KW_CASE whenClause+ (KW_ELSE elseExpression=expression)? KW_END #searchedCase : KW_CASE whenClause+ (KW_ELSE elseExpression=expression)? KW_END # searchedCase
| KW_CASE value=expression whenClause+ (KW_ELSE elseExpression=expression)? KW_END #simpleCase | KW_CASE value=expression whenClause+ (KW_ELSE elseExpression=expression)? KW_END # simpleCase
| KW_CAST LR_BRACKET expression KW_AS columnType RR_BRACKET #cast | KW_CAST LR_BRACKET expression KW_AS columnType RR_BRACKET # cast
// | STRUCT LR_BRACKET (argument+=namedExpression (COMMA argument+=namedExpression)*)? RR_BRACKET #struct // | STRUCT LR_BRACKET (argument+=namedExpression (COMMA argument+=namedExpression)*)? RR_BRACKET #struct
| KW_FIRST LR_BRACKET expression (KW_IGNORE KW_NULLS)? RR_BRACKET #first | KW_FIRST LR_BRACKET expression (KW_IGNORE KW_NULLS)? RR_BRACKET # first
| KW_LAST LR_BRACKET expression (KW_IGNORE KW_NULLS)? RR_BRACKET #last | KW_LAST LR_BRACKET expression (KW_IGNORE KW_NULLS)? RR_BRACKET # last
| KW_POSITION LR_BRACKET substr=valueExpression KW_IN str=valueExpression RR_BRACKET #position | KW_POSITION LR_BRACKET substr=valueExpression KW_IN str=valueExpression RR_BRACKET # position
| constant #constantDefault | constant # constantDefault
| ASTERISK_SIGN #star | ASTERISK_SIGN # star
| uid DOT ASTERISK_SIGN #star | uid DOT ASTERISK_SIGN # star
// | LR_BRACKET namedExpression (COMMA namedExpression)+ RR_BRACKET #rowConstructor // | LR_BRACKET namedExpression (COMMA namedExpression)+ RR_BRACKET #rowConstructor
| LR_BRACKET queryStatement RR_BRACKET #subqueryExpression | LR_BRACKET queryStatement RR_BRACKET # subqueryExpression
| functionName LR_BRACKET (setQuantifier? functionParam (COMMA functionParam)*)? RR_BRACKET #functionCall | functionName LR_BRACKET (setQuantifier? functionParam (COMMA functionParam)*)? RR_BRACKET # functionCall
// | identifier '->' expression #lambda // | identifier '->' expression #lambda
// | '(' identifier (',' identifier)+ ')' '->' expression #lambda // | '(' identifier (',' identifier)+ ')' '->' expression #lambda
| value=primaryExpression LS_BRACKET index=valueExpression RS_BRACKET #subscript | value=primaryExpression LS_BRACKET index=valueExpression RS_BRACKET # subscript
| identifier #columnReference | identifier # columnReference
| dereferenceDefinition #dereference | dereferenceDefinition # dereference
| LR_BRACKET expression RR_BRACKET #parenthesizedExpression | LR_BRACKET expression RR_BRACKET # parenthesizedExpression
| KW_CURRENT_TIMESTAMP #dateFunctionExpression | KW_CURRENT_TIMESTAMP # dateFunctionExpression
// | EXTRACT LR_BRACKET field=identifier KW_FROM source=valueExpression RR_BRACKET #extract // | EXTRACT LR_BRACKET field=identifier KW_FROM source=valueExpression RR_BRACKET #extract
// | (SUBSTR | SUBSTRING) LR_BRACKET str=valueExpression (KW_FROM | COMMA) pos=valueExpression // | (SUBSTR | SUBSTRING) LR_BRACKET str=valueExpression (KW_FROM | COMMA) pos=valueExpression
// ((KW_FOR | COMMA) len=valueExpression)? RR_BRACKET #substring // ((KW_FOR | COMMA) len=valueExpression)? RR_BRACKET #substring
@ -758,7 +797,8 @@ correlationName
; ;
qualifiedName qualifiedName
: identifier | dereferenceDefinition : identifier
| dereferenceDefinition
; ;
timeIntervalExpression timeIntervalExpression
@ -795,8 +835,8 @@ errorCapturingIdentifier
; ;
errorCapturingIdentifierExtra errorCapturingIdentifierExtra
: (KW_MINUS identifier)+ #errorIdent : (KW_MINUS identifier)+ # errorIdent
| #realIdent | # realIdent
; ;
identifierList identifierList
@ -808,13 +848,14 @@ identifierSeq
; ;
identifier identifier
: unquotedIdentifier #unquotedIdentifierAlternative : unquotedIdentifier # unquotedIdentifierAlternative
| quotedIdentifier #quotedIdentifierAlternative | quotedIdentifier # quotedIdentifierAlternative
| nonReservedKeywords #nonReservedKeywordsAlternative | nonReservedKeywords # nonReservedKeywordsAlternative
; ;
unquotedIdentifier unquotedIdentifier
: DIG_LITERAL | ID_LITERAL : DIG_LITERAL
| ID_LITERAL
; ;
quotedIdentifier quotedIdentifier
@ -870,10 +911,12 @@ withOption
; ;
ifNotExists ifNotExists
: KW_IF KW_NOT KW_EXISTS; : KW_IF KW_NOT KW_EXISTS
;
ifExists ifExists
: KW_IF KW_EXISTS; : KW_IF KW_EXISTS
;
tablePropertyList tablePropertyList
: LR_BRACKET tableProperty (COMMA tableProperty)* RR_BRACKET : LR_BRACKET tableProperty (COMMA tableProperty)* RR_BRACKET
@ -884,7 +927,8 @@ tableProperty
; ;
tablePropertyKey tablePropertyKey
: identifier | dereferenceDefinition : identifier
| dereferenceDefinition
| STRING_LITERAL | STRING_LITERAL
; ;
@ -963,7 +1007,9 @@ decimalLiteral
; ;
booleanLiteral booleanLiteral
: KW_TRUE | KW_FALSE; : KW_TRUE
| KW_FALSE
;
setQuantifier setQuantifier
: KW_DISTINCT : KW_DISTINCT

View File

@ -20,6 +20,11 @@
* Reference: https://github.com/antlr/grammars-v4/blob/master/sql/hive/v4/HiveLexer.g4 * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/hive/v4/HiveLexer.g4
*/ */
// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons none, alignColons trailing
// $antlr-format singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true
// $antlr-format spaceBeforeAssignmentOperators false, groupedAlignments true
lexer grammar HiveSqlLexer; lexer grammar HiveSqlLexer;
// unsupported option caseInsensitive in antlr4@4.9 // unsupported option caseInsensitive in antlr4@4.9
@ -423,14 +428,14 @@ KW_ZONE : 'ZONE';
// Operators // Operators
// NOTE: if you add a new function/operator, add it to sysFuncNames so that describe function _FUNC_ will work. // NOTE: if you add a new function/operator, add it to sysFuncNames so that describe function _FUNC_ will work.
DOT : '.'; // generated as a part of Number rule DOT : '.'; // generated as a part of Number rule
COLON : ':' ; COLON : ':';
COMMA : ',' ; COMMA : ',';
SEMICOLON : ';' ; SEMICOLON : ';';
LPAREN : '(' ; LPAREN : '(';
RPAREN : ')' ; RPAREN : ')';
LSQUARE : '[' ; LSQUARE : '[';
RSQUARE : ']' ; RSQUARE : ']';
LCURLY : '{'; LCURLY : '{';
RCURLY : '}'; RCURLY : '}';
@ -449,7 +454,7 @@ STAR : '*';
MOD : '%'; MOD : '%';
DIV : 'DIV'; DIV : 'DIV';
BITWISENOT: '!'; BITWISENOT : '!';
AMPERSAND : '&'; AMPERSAND : '&';
TILDE : '~'; TILDE : '~';
BITWISEOR : '|'; BITWISEOR : '|';
@ -460,32 +465,17 @@ DOLLAR : '$';
// LITERALS // LITERALS
StringLiteral StringLiteral: ( '\'' ( ~('\'' | '\\') | ('\\' .))* '\'' | '"' ( ~('"' | '\\') | ('\\' .))* '"')+;
: ( '\'' ( ~('\''|'\\') | ('\\' .) )* '\''
| '"' ( ~('"'|'\\') | ('\\' .) )* '"'
)+
;
CharSetLiteral CharSetLiteral: StringLiteral | '0' 'X' (HexDigit | Digit)+;
: StringLiteral
| '0' 'X' (HexDigit | Digit)+
;
IntegralLiteral IntegralLiteral: Digit+ ('L' | 'S' | 'Y');
: Digit+ ('L' | 'S' | 'Y')
;
NumberLiteral NumberLiteral: Number ('B'? 'D');
: Number ('B'? 'D')
;
ByteLengthLiteral ByteLengthLiteral: Digit+ [BKMG];
: Digit+ [BKMG]
;
Number Number: Digit+ (DOT Digit* Exponent? | Exponent)?;
: Digit+ (DOT Digit* Exponent? | Exponent)?
;
/* /*
An Identifier can be: An Identifier can be:
@ -508,67 +498,46 @@ An Identifier can be:
- hint name - hint name
- window name - window name
*/ */
Identifier Identifier: (Letter | Digit) (Letter | Digit | '_')* | QuotedIdentifier | '`' RegexComponent+ '`';
: (Letter | Digit) (Letter | Digit | '_')*
| QuotedIdentifier
| '`' RegexComponent+ '`'
;
fragment fragment QuotedIdentifier: '`' ('``' | ~'`')* '`';
QuotedIdentifier
: '`' ('``' | ~'`')* '`'
;
fragment fragment Letter: 'A' ..'Z' | 'a' ..'z';
Letter
: 'A'..'Z'
| 'a'..'z'
;
fragment fragment HexDigit: 'A' ..'F';
HexDigit
: 'A'..'F'
;
fragment fragment Digit: '0' ..'9';
Digit
: '0'..'9'
;
fragment fragment Exponent: ('E') ( PLUS | MINUS)? (Digit)+;
Exponent
: ('E') ( PLUS|MINUS )? (Digit)+
;
fragment fragment RegexComponent:
RegexComponent 'A' ..'Z'
: 'A'..'Z' | '0'..'9' | '_' | '0' ..'9'
| PLUS | STAR | QUESTION | MINUS | DOT | '_'
| LPAREN | RPAREN | LSQUARE | RSQUARE | LCURLY | RCURLY | PLUS
| BITWISEXOR | BITWISEOR | DOLLAR | BITWISENOT | STAR
; | QUESTION
| MINUS
| DOT
| LPAREN
| RPAREN
| LSQUARE
| RSQUARE
| LCURLY
| RCURLY
| BITWISEXOR
| BITWISEOR
| DOLLAR
| BITWISENOT;
CharSetName CharSetName: '_' (Letter | Digit | '_' | '-' | '.' | ':')+;
: '_' (Letter | Digit | '_' | '-' | '.' | ':')+
;
WHITE_SPACE WHITE_SPACE: (' ' | '\r' | '\t' | '\n') -> channel(HIDDEN);
: (' '|'\r'|'\t'|'\n') -> channel(HIDDEN)
;
LINE_COMMENT LINE_COMMENT: '--' ~('\n' | '\r')* -> channel(HIDDEN);
: '--' ~('\n' | '\r')* -> channel(HIDDEN)
;
QUERY_HINT QUERY_HINT: SHOW_HINT | HIDDEN_HINT;
: SHOW_HINT
| HIDDEN_HINT
;
SHOW_HINT SHOW_HINT: '/*+' (QUERY_HINT | .)*? '*/' -> channel(HIDDEN);
: '/*+' (QUERY_HINT | .)*? '*/' ->channel(HIDDEN)
;
HIDDEN_HINT HIDDEN_HINT: '/*' (QUERY_HINT | .)*? '*/' -> channel(HIDDEN);
: '/*' (QUERY_HINT | .)*? '*/' -> channel(HIDDEN)
;

View File

@ -20,6 +20,10 @@
* Reference: https://github.com/antlr/grammars-v4/blob/master/sql/hive/v4/HiveParser.g4 * Reference: https://github.com/antlr/grammars-v4/blob/master/sql/hive/v4/HiveParser.g4
*/ */
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
// $antlr-format spaceBeforeAssignmentOperators false, keepEmptyLinesAtTheStartOfBlocks true
parser grammar HiveSqlParser; parser grammar HiveSqlParser;
options options
@ -27,7 +31,9 @@ options
tokenVocab=HiveSqlLexer; tokenVocab=HiveSqlLexer;
} }
program : statement* EOF; program
: statement* EOF
;
// starting rule // starting rule
statement statement
@ -35,10 +41,7 @@ statement
; ;
explainStatement explainStatement
: KW_EXPLAIN ( : KW_EXPLAIN (explainOption* execStatement | KW_REWRITE queryStatementExpression)
explainOption* execStatement
| KW_REWRITE queryStatementExpression
)
; ;
explainOption explainOption
@ -98,24 +101,17 @@ replicationClause
; ;
exportStatement exportStatement
: KW_EXPORT : KW_EXPORT KW_TABLE tableOrPartition KW_TO StringLiteral replicationClause?
KW_TABLE tableOrPartition
KW_TO StringLiteral
replicationClause?
; ;
importStatement importStatement
: KW_IMPORT : KW_IMPORT (KW_EXTERNAL? KW_TABLE tableOrPartition)? KW_FROM path=StringLiteral tableLocation?
(KW_EXTERNAL? KW_TABLE tableOrPartition)?
KW_FROM path=StringLiteral
tableLocation?
; ;
replDumpStatement replDumpStatement
: KW_REPL KW_DUMP : KW_REPL KW_DUMP dbPolicy=replDbPolicy (KW_REPLACE oldDbPolicy=replDbPolicy)? (
dbPolicy=replDbPolicy KW_WITH replConf=replConfigs
(KW_REPLACE oldDbPolicy=replDbPolicy)? )?
(KW_WITH replConf=replConfigs)?
; ;
replDbPolicy replDbPolicy
@ -123,10 +119,9 @@ replDbPolicy
; ;
replLoadStatement replLoadStatement
: KW_REPL KW_LOAD : KW_REPL KW_LOAD sourceDbPolicy=replDbPolicy (KW_INTO dbName=dbSchemaName)? (
sourceDbPolicy=replDbPolicy KW_WITH replConf=replConfigs
(KW_INTO dbName=dbSchemaName)? )?
(KW_WITH replConf=replConfigs)?
; ;
replConfigs replConfigs
@ -142,9 +137,7 @@ replTableLevelPolicy
; ;
replStatusStatement replStatusStatement
: KW_REPL KW_STATUS : KW_REPL KW_STATUS dbName=dbSchemaName (KW_WITH replConf=replConfigs)?
dbName=dbSchemaName
(KW_WITH replConf=replConfigs)?
; ;
ddlStatement ddlStatement
@ -231,19 +224,12 @@ orReplace
; ;
createDatabaseStatement createDatabaseStatement
: KW_CREATE KW_REMOTE? db_schema : KW_CREATE KW_REMOTE? db_schema ifNotExists? name=dbSchemaNameCreate databaseComment? dbLocation? dbManagedLocation? (
ifNotExists? KW_WITH KW_DBPROPERTIES dbprops=dbProperties
name=dbSchemaNameCreate )?
databaseComment? | KW_CREATE KW_REMOTE db_schema ifNotExists? name=dbSchemaNameCreate databaseComment? dbConnectorName (
dbLocation? KW_WITH KW_DBPROPERTIES dbprops=dbProperties
dbManagedLocation? )?
(KW_WITH KW_DBPROPERTIES dbprops=dbProperties)?
| KW_CREATE KW_REMOTE db_schema
ifNotExists?
name=dbSchemaNameCreate
databaseComment?
dbConnectorName
(KW_WITH KW_DBPROPERTIES dbprops=dbProperties)?
; ;
dbLocation dbLocation
@ -291,8 +277,7 @@ inputFileFormat
; ;
tabTypeExpr tabTypeExpr
: id_ (DOT id_)? : id_ (DOT id_)? (id_ (DOT (KW_ELEM_TYPE | KW_KEY_TYPE | KW_VALUE_TYPE | id_))*)?
(id_ (DOT (KW_ELEM_TYPE | KW_KEY_TYPE | KW_VALUE_TYPE | id_))*)?
; ;
partTypeExpr partTypeExpr
@ -304,8 +289,7 @@ tabPartColTypeExpr
; ;
descStatement descStatement
: (KW_DESCRIBE | KW_DESC) : (KW_DESCRIBE | KW_DESC) (
(
db_schema KW_EXTENDED? dbName=dbSchemaName db_schema KW_EXTENDED? dbName=dbSchemaName
| KW_DATACONNECTOR KW_EXTENDED? dcName=dbSchemaName | KW_DATACONNECTOR KW_EXTENDED? dcName=dbSchemaName
| KW_FUNCTION KW_EXTENDED? name=functionNameForDDL | KW_FUNCTION KW_EXTENDED? name=functionNameForDDL
@ -315,8 +299,11 @@ descStatement
; ;
analyzeStatement analyzeStatement
: KW_ANALYZE KW_TABLE parttype=tableOrPartition : KW_ANALYZE KW_TABLE parttype=tableOrPartition (
( KW_COMPUTE KW_STATISTICS (noscan=KW_NOSCAN | KW_FOR KW_COLUMNS statsColumnName=columnNameList?)? KW_COMPUTE KW_STATISTICS (
noscan=KW_NOSCAN
| KW_FOR KW_COLUMNS statsColumnName=columnNameList?
)?
| KW_CACHE KW_METADATA | KW_CACHE KW_METADATA
) )
; ;
@ -334,17 +321,29 @@ db_schema
showStatement showStatement
: KW_SHOW (KW_DATABASES | KW_SCHEMAS) (KW_LIKE showStmtIdentifier)? : KW_SHOW (KW_DATABASES | KW_SCHEMAS) (KW_LIKE showStmtIdentifier)?
| KW_SHOW isExtended=KW_EXTENDED? KW_TABLES (from_in db_name=dbSchemaName)? filter=showTablesFilterExpr? | KW_SHOW isExtended=KW_EXTENDED? KW_TABLES (from_in db_name=dbSchemaName)? filter=showTablesFilterExpr?
| KW_SHOW KW_VIEWS (from_in db_name=dbSchemaName)? (KW_LIKE showStmtIdentifier | showStmtIdentifier)? | KW_SHOW KW_VIEWS (from_in db_name=dbSchemaName)? (
| KW_SHOW KW_MATERIALIZED KW_VIEWS (from_in db_name=dbSchemaName)? (KW_LIKE showStmtIdentifier|showStmtIdentifier)? KW_LIKE showStmtIdentifier
| KW_SHOW KW_SORTED? KW_COLUMNS from_in tableOrView (from_in db_name=dbSchemaName)? (KW_LIKE showStmtIdentifier|showStmtIdentifier)? | showStmtIdentifier
)?
| KW_SHOW KW_MATERIALIZED KW_VIEWS (from_in db_name=dbSchemaName)? (
KW_LIKE showStmtIdentifier
| showStmtIdentifier
)?
| KW_SHOW KW_SORTED? KW_COLUMNS from_in tableOrView (from_in db_name=dbSchemaName)? (
KW_LIKE showStmtIdentifier
| showStmtIdentifier
)?
| KW_SHOW KW_FUNCTIONS (KW_LIKE functionNameForDDL)? | KW_SHOW KW_FUNCTIONS (KW_LIKE functionNameForDDL)?
| KW_SHOW KW_PARTITIONS tabOrViewName=tableOrView partitionSpec? whereClause? orderByClause? limitClause? | KW_SHOW KW_PARTITIONS tabOrViewName=tableOrView partitionSpec? whereClause? orderByClause? limitClause?
| KW_SHOW KW_CREATE (db_schema db_name=dbSchemaName | KW_TABLE tabName=tableName) | KW_SHOW KW_CREATE (db_schema db_name=dbSchemaName | KW_TABLE tabName=tableName)
| KW_SHOW KW_TABLE KW_EXTENDED (from_in db_name=dbSchemaName)? KW_LIKE showStmtIdentifier partitionSpec? | KW_SHOW KW_TABLE KW_EXTENDED (from_in db_name=dbSchemaName)? KW_LIKE showStmtIdentifier partitionSpec?
| KW_SHOW KW_TBLPROPERTIES tableName (LPAREN prptyName=StringLiteral RPAREN)? | KW_SHOW KW_TBLPROPERTIES tableName (LPAREN prptyName=StringLiteral RPAREN)?
| KW_SHOW KW_LOCKS (db_schema dbName=dbSchemaName isExtended=KW_EXTENDED? | parttype=partTypeExpr? isExtended=KW_EXTENDED?) | KW_SHOW KW_LOCKS (
| KW_SHOW KW_COMPACTIONS db_schema dbName=dbSchemaName isExtended=KW_EXTENDED?
( compactionId | parttype=partTypeExpr? isExtended=KW_EXTENDED?
)
| KW_SHOW KW_COMPACTIONS (
compactionId
| db_schema dbName=dbSchemaName compactionPool? compactionType? compactionStatus? orderByClause? limitClause? | db_schema dbName=dbSchemaName compactionPool? compactionType? compactionStatus? orderByClause? limitClause?
| parttype=partTypeExpr? compactionPool? compactionType? compactionStatus? orderByClause? limitClause? | parttype=partTypeExpr? compactionPool? compactionType? compactionStatus? orderByClause? limitClause?
) )
@ -352,7 +351,7 @@ showStatement
| KW_SHOW KW_CONF StringLiteral | KW_SHOW KW_CONF StringLiteral
| KW_SHOW KW_RESOURCE (KW_PLAN rp_name=id_ | KW_PLANS) | KW_SHOW KW_RESOURCE (KW_PLAN rp_name=id_ | KW_PLANS)
| KW_SHOW KW_DATACONNECTORS | KW_SHOW KW_DATACONNECTORS
| KW_SHOW KW_FORMATTED? ( KW_INDEX | KW_INDEXES ) KW_ON tableName (from_in dbSchemaName)? | KW_SHOW KW_FORMATTED? (KW_INDEX | KW_INDEXES) KW_ON tableName (from_in dbSchemaName)?
; ;
showTablesFilterExpr showTablesFilterExpr
@ -391,10 +390,7 @@ dropRoleStatement
; ;
grantPrivileges grantPrivileges
: KW_GRANT privList=privilegeList : KW_GRANT privList=privilegeList privilegeObject? KW_TO principalSpecification withGrantOption?
privilegeObject?
KW_TO principalSpecification
withGrantOption?
; ;
revokePrivileges revokePrivileges
@ -422,11 +418,7 @@ showCurrentRole
; ;
setRole setRole
: KW_SET KW_ROLE : KW_SET KW_ROLE (all=KW_ALL | none=KW_NONE | id_)
( all=KW_ALL
| none=KW_NONE
| id_
)
; ;
showGrants showGrants
@ -518,9 +510,10 @@ withAdminOption
; ;
metastoreCheck metastoreCheck
: KW_MSCK repair=KW_REPAIR? : KW_MSCK repair=KW_REPAIR? (
(KW_TABLE tableName KW_TABLE tableName (
(opt=(KW_ADD | KW_DROP | KW_SYNC) parts=KW_PARTITIONS partitionSelectorSpec?)? opt=(KW_ADD | KW_DROP | KW_SYNC) parts=KW_PARTITIONS partitionSelectorSpec?
)?
) )
; ;
@ -539,8 +532,9 @@ resourceType
; ;
createFunctionStatement createFunctionStatement
: KW_CREATE temp=KW_TEMPORARY? KW_FUNCTION functionNameCreate KW_AS StringLiteral : KW_CREATE temp=KW_TEMPORARY? KW_FUNCTION functionNameCreate KW_AS StringLiteral (
(KW_USING rList=resourceList)? KW_USING rList=resourceList
)?
; ;
dropFunctionStatement dropFunctionStatement
@ -552,8 +546,7 @@ reloadFunctionsStatement
; ;
createMacroStatement createMacroStatement
: KW_CREATE KW_TEMPORARY KW_MACRO Identifier : KW_CREATE KW_TEMPORARY KW_MACRO Identifier LPAREN columnNameTypeList? RPAREN expression
LPAREN columnNameTypeList? RPAREN expression
; ;
dropMacroStatement dropMacroStatement
@ -561,25 +554,21 @@ dropMacroStatement
; ;
createIndexStatement createIndexStatement
: KW_CREATE KW_INDEX id_ KW_ON KW_TABLE tableName columnParenthesesList KW_AS indextype=StringLiteral : KW_CREATE KW_INDEX id_ KW_ON KW_TABLE tableName columnParenthesesList KW_AS indextype=StringLiteral (
(KW_WITH KW_DEFERRED KW_REBUILD)? KW_WITH KW_DEFERRED KW_REBUILD
(KW_IDXPROPERTIES tableProperties)? )? (KW_IDXPROPERTIES tableProperties)? (KW_IN KW_TABLE tableName)? (
(KW_IN KW_TABLE tableName)? KW_PARTITIONED KW_BY columnParenthesesList
(KW_PARTITIONED KW_BY columnParenthesesList)? )? (tableRowFormat? tableFileFormat)? (KW_LOCATION locn=StringLiteral)? tablePropertiesPrefixed? tableComment?
(tableRowFormat? tableFileFormat)? ;
(KW_LOCATION locn=StringLiteral)?
tablePropertiesPrefixed?
tableComment?;
dropIndexStatement dropIndexStatement
: KW_DROP KW_INDEX ifExists? id_ KW_ON tableName; : KW_DROP KW_INDEX ifExists? id_ KW_ON tableName
;
createViewStatement createViewStatement
: KW_CREATE orReplace? KW_VIEW ifNotExists? name=viewNameCreate : KW_CREATE orReplace? KW_VIEW ifNotExists? name=viewNameCreate (
(LPAREN columnNameCommentList RPAREN)? tableComment? viewPartition? LPAREN columnNameCommentList RPAREN
tablePropertiesPrefixed? )? tableComment? viewPartition? tablePropertiesPrefixed? KW_AS selectStatementWithCTE
KW_AS
selectStatementWithCTE
; ;
viewPartition viewPartition
@ -612,10 +601,8 @@ dropViewStatement
; ;
createMaterializedViewStatement createMaterializedViewStatement
: KW_CREATE KW_MATERIALIZED KW_VIEW ifNotExists? name=viewNameCreate : KW_CREATE KW_MATERIALIZED KW_VIEW ifNotExists? name=viewNameCreate rewriteDisabled? tableComment? viewPartition? viewOrganization?
rewriteDisabled? tableComment? viewPartition? viewOrganization? tableRowFormat? tableFileFormat? tableLocation? tablePropertiesPrefixed? KW_AS selectStatementWithCTE
tableRowFormat? tableFileFormat? tableLocation?
tablePropertiesPrefixed? KW_AS selectStatementWithCTE
; ;
dropMaterializedViewStatement dropMaterializedViewStatement
@ -623,11 +610,7 @@ dropMaterializedViewStatement
; ;
createScheduledQueryStatement createScheduledQueryStatement
: KW_CREATE KW_SCHEDULED KW_QUERY name=id_ : KW_CREATE KW_SCHEDULED KW_QUERY name=id_ scheduleSpec executedAsSpec? enableSpecification? definedAsSpec
scheduleSpec
executedAsSpec?
enableSpecification?
definedAsSpec
; ;
dropScheduledQueryStatement dropScheduledQueryStatement
@ -648,8 +631,9 @@ alterScheduledQueryChange
scheduleSpec scheduleSpec
: KW_CRON cronString=StringLiteral : KW_CRON cronString=StringLiteral
| KW_EVERY value=Number? qualifier=intervalQualifiers | KW_EVERY value=Number? qualifier=intervalQualifiers (
((KW_AT | KW_OFFSET KW_BY) offsetTs=StringLiteral)? (KW_AT | KW_OFFSET KW_BY) offsetTs=StringLiteral
)?
; ;
executedAsSpec executedAsSpec
@ -670,8 +654,8 @@ tableComment
; ;
createTablePartitionSpec createTablePartitionSpec
: KW_PARTITIONED KW_BY : KW_PARTITIONED KW_BY (
( LPAREN (opt1=createTablePartitionColumnTypeSpec | opt2=createTablePartitionColumnSpec) LPAREN (opt1=createTablePartitionColumnTypeSpec | opt2=createTablePartitionColumnSpec)
| KW_SPEC LPAREN spec=partitionTransformSpec | KW_SPEC LPAREN spec=partitionTransformSpec
) RPAREN ) RPAREN
; ;
@ -699,8 +683,9 @@ partitionTransformType
; ;
tableBuckets tableBuckets
: KW_CLUSTERED KW_BY LPAREN bucketCols=columnNameList RPAREN : KW_CLUSTERED KW_BY LPAREN bucketCols=columnNameList RPAREN (
(KW_SORTED KW_BY LPAREN sortCols=columnNameOrderList RPAREN)? KW_INTO num=Number KW_BUCKETS KW_SORTED KW_BY LPAREN sortCols=columnNameOrderList RPAREN
)? KW_INTO num=Number KW_BUCKETS
; ;
tableImplBuckets tableImplBuckets
@ -725,12 +710,14 @@ recordWriter
; ;
rowFormatSerde rowFormatSerde
: KW_ROW KW_FORMAT KW_SERDE name=StringLiteral (KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties)? : KW_ROW KW_FORMAT KW_SERDE name=StringLiteral (
KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties
)?
; ;
rowFormatDelimited rowFormatDelimited
: KW_ROW KW_FORMAT KW_DELIMITED tableRowFormatFieldIdentifier? tableRowFormatCollItemsIdentifier? : KW_ROW KW_FORMAT KW_DELIMITED tableRowFormatFieldIdentifier? tableRowFormatCollItemsIdentifier? tableRowFormatMapKeysIdentifier?
tableRowFormatMapKeysIdentifier? tableRowFormatLinesIdentifier? tableRowNullFormat? tableRowFormatLinesIdentifier? tableRowNullFormat?
; ;
tableRowFormat tableRowFormat
@ -760,7 +747,9 @@ keyProperty
; ;
tableRowFormatFieldIdentifier tableRowFormatFieldIdentifier
: KW_FIELDS KW_TERMINATED KW_BY fldIdnt=StringLiteral (KW_ESCAPED KW_BY fldEscape=StringLiteral)? : KW_FIELDS KW_TERMINATED KW_BY fldIdnt=StringLiteral (
KW_ESCAPED KW_BY fldEscape=StringLiteral
)?
; ;
tableRowFormatCollItemsIdentifier tableRowFormatCollItemsIdentifier
@ -780,16 +769,15 @@ tableRowNullFormat
; ;
tableFileFormat tableFileFormat
: KW_STORED KW_AS KW_INPUTFORMAT : KW_STORED KW_AS KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral (
inFmt=StringLiteral KW_OUTPUTFORMAT KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral
outFmt=StringLiteral )?
(KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral)? | KW_STORED KW_BY storageHandler=StringLiteral (
| KW_STORED KW_BY storageHandler=StringLiteral KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties
(KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties)? )? (KW_STORED KW_AS fileformat=id_)?
(KW_STORED KW_AS fileformat=id_)? | KW_STORED KW_BY genericSpec=id_ (KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties)? (
| KW_STORED KW_BY genericSpec=id_ KW_STORED KW_AS fileformat=id_
(KW_WITH KW_SERDEPROPERTIES serdeprops=tableProperties)? )?
(KW_STORED KW_AS fileformat=id_)?
| KW_STORED KW_AS genericSpec=id_ | KW_STORED KW_AS genericSpec=id_
; ;
@ -880,13 +868,13 @@ checkConstraint
; ;
createForeignKey createForeignKey
: (KW_CONSTRAINT constraintName=id_)? KW_FOREIGN KW_KEY fkCols=columnParenthesesList : (KW_CONSTRAINT constraintName=id_)? KW_FOREIGN KW_KEY fkCols=columnParenthesesList KW_REFERENCES tabName=tableName parCols=columnParenthesesList
KW_REFERENCES tabName=tableName parCols=columnParenthesesList constraintOptsCreate? constraintOptsCreate?
; ;
alterForeignKeyWithName alterForeignKeyWithName
: KW_CONSTRAINT constraintName=id_ KW_FOREIGN KW_KEY fkCols=columnParenthesesList : KW_CONSTRAINT constraintName=id_ KW_FOREIGN KW_KEY fkCols=columnParenthesesList KW_REFERENCES tabName=tableName parCols=columnParenthesesList
KW_REFERENCES tabName=tableName parCols=columnParenthesesList constraintOptsAlter? constraintOptsAlter?
; ;
skewedValueElement skewedValueElement
@ -1032,7 +1020,8 @@ type
| listType | listType
| structType | structType
| mapType | mapType
| unionType; | unionType
;
primitiveType primitiveType
: KW_TINYINT : KW_TINYINT
@ -1121,25 +1110,13 @@ regularBody
; ;
atomSelectStatement atomSelectStatement
: s=selectClause : s=selectClause f=fromClause? w=whereClause? g=groupByClause? h=havingClause? win=window_clause? q=qualifyClause?
f=fromClause?
w=whereClause?
g=groupByClause?
h=havingClause?
win=window_clause?
q=qualifyClause?
| LPAREN selectStatement RPAREN | LPAREN selectStatement RPAREN
| valuesSource | valuesSource
; ;
selectStatement selectStatement
: a=atomSelectStatement : a=atomSelectStatement set=setOpSelectStatement? o=orderByClause? c=clusterByClause? d=distributeByClause? sort=sortByClause? l=limitClause?
set=setOpSelectStatement?
o=orderByClause?
c=clusterByClause?
d=distributeByClause?
sort=sortByClause?
l=limitClause?
; ;
setOpSelectStatement setOpSelectStatement
@ -1151,35 +1128,15 @@ selectStatementWithCTE
; ;
body body
: insertClause : insertClause selectClause lateralView? whereClause? groupByClause? havingClause? window_clause? qualifyClause? orderByClause? clusterByClause?
selectClause distributeByClause? sortByClause? limitClause?
lateralView? | selectClause lateralView? whereClause? groupByClause? havingClause? window_clause? qualifyClause? orderByClause? clusterByClause?
whereClause? distributeByClause? sortByClause? limitClause?
groupByClause?
havingClause?
window_clause?
qualifyClause?
orderByClause?
clusterByClause?
distributeByClause?
sortByClause?
limitClause?
| selectClause
lateralView?
whereClause?
groupByClause?
havingClause?
window_clause?
qualifyClause?
orderByClause?
clusterByClause?
distributeByClause?
sortByClause?
limitClause?
; ;
insertClause insertClause
: KW_INSERT ( KW_OVERWRITE destination ifNotExists? : KW_INSERT (
KW_OVERWRITE destination ifNotExists?
| KW_INTO KW_TABLE? tableOrPartition (LPAREN targetCols=columnNameList RPAREN)? | KW_INTO KW_TABLE? tableOrPartition (LPAREN targetCols=columnNameList RPAREN)?
) )
; ;
@ -1235,7 +1192,7 @@ sqlTransactionStatement
; ;
startTransactionStatement startTransactionStatement
: KW_START KW_TRANSACTION (transactionMode (COMMA transactionMode)* )? : KW_START KW_TRANSACTION (transactionMode (COMMA transactionMode)*)?
; ;
transactionMode transactionMode
@ -1267,6 +1224,7 @@ rollbackStatement
setAutoCommitStatement setAutoCommitStatement
: KW_SET KW_AUTOCOMMIT booleanValueTok : KW_SET KW_AUTOCOMMIT booleanValueTok
; ;
/* /*
END user defined transaction boundaries END user defined transaction boundaries
*/ */
@ -1285,6 +1243,7 @@ BEGIN SQL Merge statement
mergeStatement mergeStatement
: KW_MERGE QUERY_HINT? KW_INTO tableName (KW_AS? id_)? KW_USING joinSourcePart KW_ON expression whenClauses : KW_MERGE QUERY_HINT? KW_INTO tableName (KW_AS? id_)? KW_USING joinSourcePart KW_ON expression whenClauses
; ;
/* /*
Allow 0,1 or 2 WHEN MATCHED clauses and 0 or 1 WHEN NOT MATCHED Allow 0,1 or 2 WHEN MATCHED clauses and 0 or 1 WHEN NOT MATCHED
Each WHEN clause may have AND <boolean predicate>. Each WHEN clause may have AND <boolean predicate>.
@ -1311,6 +1270,7 @@ updateOrDelete
: KW_UPDATE setColumnsClause : KW_UPDATE setColumnsClause
| KW_DELETE | KW_DELETE
; ;
/* /*
END SQL Merge statement END SQL Merge statement
*/ */
@ -1343,7 +1303,8 @@ END SHOW COMPACTIONS statement
*/ */
alterStatement alterStatement
: KW_ALTER ( KW_TABLE tableName alterTableStatementSuffix : KW_ALTER (
KW_TABLE tableName alterTableStatementSuffix
| KW_VIEW viewName KW_AS? alterViewStatementSuffix | KW_VIEW viewName KW_AS? alterViewStatementSuffix
| KW_MATERIALIZED KW_VIEW tableNameTree=viewName alterMaterializedViewStatementSuffix | KW_MATERIALIZED KW_VIEW tableNameTree=viewName alterMaterializedViewStatementSuffix
| db_schema alterDatabaseStatementSuffix | db_schema alterDatabaseStatementSuffix
@ -1465,12 +1426,15 @@ alterStatementSuffixDropConstraint
; ;
alterStatementSuffixRenameCol alterStatementSuffixRenameCol
: KW_CHANGE KW_COLUMN? oldName=columnName newName=columnNameCreate colType alterColumnConstraint? : KW_CHANGE KW_COLUMN? oldName=columnName newName=columnNameCreate colType alterColumnConstraint? (
(KW_COMMENT comment=StringLiteral)? alterStatementChangeColPosition? restrictOrCascade? KW_COMMENT comment=StringLiteral
)? alterStatementChangeColPosition? restrictOrCascade?
; ;
alterStatementSuffixUpdateStatsCol alterStatementSuffixUpdateStatsCol
: KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=columnName KW_SET tableProperties (KW_COMMENT comment=StringLiteral)? : KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=columnName KW_SET tableProperties (
KW_COMMENT comment=StringLiteral
)?
; ;
alterStatementSuffixUpdateStats alterStatementSuffixUpdateStats
@ -1511,7 +1475,9 @@ alterStatementSuffixRecoverPartitions
; ;
alterStatementSuffixDropPartitions alterStatementSuffixDropPartitions
: KW_DROP ifExists? KW_PARTITION partitionSelectorSpec (COMMA KW_PARTITION partitionSelectorSpec)* dropPartitionsIgnoreClause? KW_PURGE? replicationClause? : KW_DROP ifExists? KW_PARTITION partitionSelectorSpec (
COMMA KW_PARTITION partitionSelectorSpec
)* dropPartitionsIgnoreClause? KW_PURGE? replicationClause?
; ;
alterStatementSuffixProperties alterStatementSuffixProperties
@ -1525,7 +1491,8 @@ alterViewSuffixProperties
; ;
alterStatementSuffixSerdeProperties alterStatementSuffixSerdeProperties
: KW_SET ( KW_SERDE serdeName=StringLiteral (KW_WITH KW_SERDEPROPERTIES tableProperties)? : KW_SET (
KW_SERDE serdeName=StringLiteral (KW_WITH KW_SERDEPROPERTIES tableProperties)?
| KW_SERDEPROPERTIES tableProperties | KW_SERDEPROPERTIES tableProperties
) )
| KW_UNSET KW_SERDEPROPERTIES tableProperties | KW_UNSET KW_SERDEPROPERTIES tableProperties
@ -1578,7 +1545,9 @@ alterStatementSuffixRenamePart
; ;
alterStatementSuffixStatsPart alterStatementSuffixStatsPart
: KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=columnName KW_SET tableProperties (KW_COMMENT comment=StringLiteral)? : KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=columnName KW_SET tableProperties (
KW_COMMENT comment=StringLiteral
)?
; ;
alterStatementSuffixMergeFiles alterStatementSuffixMergeFiles
@ -1598,7 +1567,9 @@ compactPool
; ;
alterStatementSuffixCompact alterStatementSuffixCompact
: KW_COMPACT compactType=StringLiteral blocking? tableImplBuckets? orderByClause? compactPool? (KW_WITH KW_OVERWRITE KW_TBLPROPERTIES tableProperties)? : KW_COMPACT compactType=StringLiteral blocking? tableImplBuckets? orderByClause? compactPool? (
KW_WITH KW_OVERWRITE KW_TBLPROPERTIES tableProperties
)?
; ;
alterStatementSuffixSetOwner alterStatementSuffixSetOwner
@ -1610,20 +1581,21 @@ alterStatementSuffixSetPartSpec
; ;
alterStatementSuffixExecute alterStatementSuffixExecute
: KW_EXECUTE ( KW_ROLLBACK LPAREN rollbackParam=(StringLiteral | Number) : KW_EXECUTE (
KW_ROLLBACK LPAREN rollbackParam=(StringLiteral | Number)
| KW_EXPIRE_SNAPSHOTS LPAREN expireParam=StringLiteral | KW_EXPIRE_SNAPSHOTS LPAREN expireParam=StringLiteral
| KW_SET_CURRENT_SNAPSHOT LPAREN snapshotParam=Number | KW_SET_CURRENT_SNAPSHOT LPAREN snapshotParam=Number
) RPAREN ) RPAREN
; ;
alterIndexStatementSuffix alterIndexStatementSuffix
: id_ KW_ON tableName : id_ KW_ON tableName partitionSpec? KW_REBUILD
partitionSpec? ;
KW_REBUILD;
fileFormat fileFormat
: KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral KW_SERDE serdeCls=StringLiteral : KW_INPUTFORMAT inFmt=StringLiteral KW_OUTPUTFORMAT outFmt=StringLiteral KW_SERDE serdeCls=StringLiteral (
(KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral)? KW_INPUTDRIVER inDriver=StringLiteral KW_OUTPUTDRIVER outDriver=StringLiteral
)?
| genericSpec=id_ | genericSpec=id_
; ;
@ -1655,46 +1627,22 @@ likeTableOrFile
Rules for parsing createtable Rules for parsing createtable
*/ */
createTableStatement createTableStatement
: KW_CREATE temp=KW_TEMPORARY? trans=KW_TRANSACTIONAL? ext=KW_EXTERNAL? KW_TABLE ifNotExists? name=tableNameCreate : KW_CREATE temp=KW_TEMPORARY? trans=KW_TRANSACTIONAL? ext=KW_EXTERNAL? KW_TABLE ifNotExists? name=tableNameCreate (
( likeTableOrFile likeTableOrFile createTablePartitionSpec? tableRowFormat? tableFileFormat? tableLocation? tablePropertiesPrefixed?
createTablePartitionSpec? | (LPAREN columnNameTypeOrConstraintList RPAREN)? tableComment? createTablePartitionSpec? tableBuckets? tableSkewed? tableRowFormat?
tableRowFormat? tableFileFormat? tableLocation? tablePropertiesPrefixed? (KW_AS selectStatementWithCTE)?
tableFileFormat?
tableLocation?
tablePropertiesPrefixed?
| (LPAREN columnNameTypeOrConstraintList RPAREN)?
tableComment?
createTablePartitionSpec?
tableBuckets?
tableSkewed?
tableRowFormat?
tableFileFormat?
tableLocation?
tablePropertiesPrefixed?
(KW_AS selectStatementWithCTE)?
) )
| KW_CREATE mgd=KW_MANAGED KW_TABLE ifNotExists? name=tableNameCreate | KW_CREATE mgd=KW_MANAGED KW_TABLE ifNotExists? name=tableNameCreate (
( likeTableOrFile likeTableOrFile tableRowFormat? tableFileFormat? tableLocation? tablePropertiesPrefixed?
tableRowFormat? | (LPAREN columnNameTypeOrConstraintList RPAREN)? tableComment? createTablePartitionSpec? tableBuckets? tableSkewed? tableRowFormat?
tableFileFormat? tableFileFormat? tableLocation? tablePropertiesPrefixed? (KW_AS selectStatementWithCTE)?
tableLocation?
tablePropertiesPrefixed?
| (LPAREN columnNameTypeOrConstraintList RPAREN)?
tableComment?
createTablePartitionSpec?
tableBuckets?
tableSkewed?
tableRowFormat?
tableFileFormat?
tableLocation?
tablePropertiesPrefixed?
(KW_AS selectStatementWithCTE)?
) )
; ;
createDataConnectorStatement createDataConnectorStatement
: KW_CREATE KW_DATACONNECTOR ifNotExists? name=id_ dataConnectorType? dataConnectorUrl? dataConnectorComment? : KW_CREATE KW_DATACONNECTOR ifNotExists? name=id_ dataConnectorType? dataConnectorUrl? dataConnectorComment? (
(KW_WITH KW_DCPROPERTIES dcprops=dcProperties)? KW_WITH KW_DCPROPERTIES dcprops=dcProperties
)?
; ;
dataConnectorComment dataConnectorComment
@ -1756,7 +1704,9 @@ atomjoinSource
; ;
joinSource joinSource
: atomjoinSource (joinToken joinSourcePart (KW_ON expression | KW_USING columnParenthesesList)?)* : atomjoinSource (
joinToken joinSourcePart (KW_ON expression | KW_USING columnParenthesesList)?
)*
; ;
joinSourcePart joinSourcePart
@ -1777,7 +1727,8 @@ uniqueJoinToken
joinToken joinToken
: COMMA : COMMA
| ( KW_INNER | (
KW_INNER
| KW_CROSS | KW_CROSS
| (KW_RIGHT | KW_FULL) KW_OUTER? | (KW_RIGHT | KW_FULL) KW_OUTER?
| KW_LEFT (KW_SEMI | KW_ANTI | KW_OUTER)? | KW_LEFT (KW_SEMI | KW_ANTI | KW_OUTER)?
@ -1786,7 +1737,8 @@ joinToken
lateralView lateralView
: KW_LATERAL KW_VIEW KW_OUTER function_ tableAlias (KW_AS id_ (COMMA id_)*)? : KW_LATERAL KW_VIEW KW_OUTER function_ tableAlias (KW_AS id_ (COMMA id_)*)?
| COMMA? KW_LATERAL ( KW_VIEW function_ tableAlias (KW_AS id_ (COMMA id_)*)? | COMMA? KW_LATERAL (
KW_VIEW function_ tableAlias (KW_AS id_ (COMMA id_)*)?
| KW_TABLE LPAREN valuesClause RPAREN KW_AS? tableAlias (LPAREN id_ (COMMA id_)* RPAREN)? | KW_TABLE LPAREN valuesClause RPAREN KW_AS? tableAlias (LPAREN id_ (COMMA id_)* RPAREN)?
) )
; ;
@ -1796,8 +1748,9 @@ tableAlias
; ;
tableBucketSample tableBucketSample
: KW_TABLESAMPLE LPAREN KW_BUCKET numerator=Number KW_OUT KW_OF denominator=Number : KW_TABLESAMPLE LPAREN KW_BUCKET numerator=Number KW_OUT KW_OF denominator=Number (
(KW_ON expr+=expression (COMMA expr+=expression)*)? RPAREN KW_ON expr+=expression (COMMA expr+=expression)*
)? RPAREN
; ;
splitSample splitSample
@ -1810,11 +1763,14 @@ tableSample
; ;
tableSource tableSource
: tabname=tableOrView props=tableProperties? ts=tableSample? asOf=asOfClause? (KW_AS? alias=id_)? : tabname=tableOrView props=tableProperties? ts=tableSample? asOf=asOfClause? (
KW_AS? alias=id_
)?
; ;
asOfClause asOfClause
: KW_FOR ( KW_SYSTEM_TIME KW_AS KW_OF asOfTime=expression : KW_FOR (
KW_SYSTEM_TIME KW_AS KW_OF asOfTime=expression
| KW_FOR KW_SYSTEM_VERSION KW_AS KW_OF asOfVersion=Number | KW_FOR KW_SYSTEM_VERSION KW_AS KW_OF asOfVersion=Number
) )
; ;
@ -1876,10 +1832,9 @@ partitionTableFunctionSource
; ;
partitionedTableFunction partitionedTableFunction
: n=id_ LPAREN KW_ON : n=id_ LPAREN KW_ON ptfsrc=partitionTableFunctionSource spec=partitioningSpec? (
ptfsrc=partitionTableFunctionSource spec=partitioningSpec? Identifier LPAREN expression RPAREN (COMMA Identifier LPAREN expression RPAREN)*
(Identifier LPAREN expression RPAREN (COMMA Identifier LPAREN expression RPAREN)*)? )? RPAREN alias=id_?
RPAREN alias=id_?
; ;
/** /**
@ -1954,11 +1909,9 @@ selectList
; ;
selectTrfmClause selectTrfmClause
: LPAREN selectExpressionList RPAREN : LPAREN selectExpressionList RPAREN rowFormat recordWriter KW_USING StringLiteral (
rowFormat recordWriter KW_AS (LPAREN (aliasList | columnNameTypeList) RPAREN | aliasList | columnNameTypeList)
KW_USING StringLiteral )? rowFormat recordReader
(KW_AS (LPAREN (aliasList | columnNameTypeList) RPAREN | aliasList | columnNameTypeList))?
rowFormat recordReader
; ;
selectItem selectItem
@ -1967,11 +1920,9 @@ selectItem
; ;
trfmClause trfmClause
: (KW_MAP | KW_REDUCE) selectExpressionList : (KW_MAP | KW_REDUCE) selectExpressionList rowFormat recordWriter KW_USING StringLiteral (
rowFormat recordWriter KW_AS (LPAREN (aliasList | columnNameTypeList) RPAREN | aliasList | columnNameTypeList)
KW_USING StringLiteral )? rowFormat recordReader
(KW_AS (LPAREN (aliasList | columnNameTypeList) RPAREN | aliasList | columnNameTypeList))?
rowFormat recordReader
; ;
selectExpression selectExpression
@ -2005,13 +1956,15 @@ window_frame
; ;
window_range_expression window_range_expression
: KW_ROWS ( window_frame_start_boundary : KW_ROWS (
window_frame_start_boundary
| KW_BETWEEN window_frame_boundary KW_AND window_frame_boundary | KW_BETWEEN window_frame_boundary KW_AND window_frame_boundary
) )
; ;
window_value_expression window_value_expression
: KW_RANGE ( window_frame_start_boundary : KW_RANGE (
window_frame_start_boundary
| KW_BETWEEN window_frame_boundary KW_AND window_frame_boundary | KW_BETWEEN window_frame_boundary KW_AND window_frame_boundary
) )
; ;
@ -2046,15 +1999,14 @@ groupByEmpty
// standard rollup syntax // standard rollup syntax
rollupStandard rollupStandard
: (rollup=KW_ROLLUP | cube=KW_CUBE) : (rollup=KW_ROLLUP | cube=KW_CUBE) LPAREN expression (COMMA expression)* RPAREN
LPAREN expression (COMMA expression)* RPAREN
; ;
// old hive rollup syntax // old hive rollup syntax
rollupOldSyntax rollupOldSyntax
: expr=expressionsNotInParenthesis : expr=expressionsNotInParenthesis (rollup=KW_WITH KW_ROLLUP | cube=KW_WITH KW_CUBE)? (
(rollup=KW_WITH KW_ROLLUP | cube=KW_WITH KW_CUBE)? sets=KW_GROUPING KW_SETS LPAREN groupingSetExpression (COMMA groupingSetExpression)* RPAREN
(sets=KW_GROUPING KW_SETS LPAREN groupingSetExpression (COMMA groupingSetExpression)* RPAREN)? )?
; ;
groupingSetExpression groupingSetExpression
@ -2150,17 +2102,16 @@ sortByClause
// TRIM([LEADING|TRAILING|BOTH] trim_characters FROM str) // TRIM([LEADING|TRAILING|BOTH] trim_characters FROM str)
trimFunction trimFunction
: KW_TRIM LPAREN (leading=KW_LEADING | trailing=KW_TRAILING | KW_BOTH)? : KW_TRIM LPAREN (leading=KW_LEADING | trailing=KW_TRAILING | KW_BOTH)? trim_characters=selectExpression? KW_FROM str=selectExpression RPAREN
trim_characters=selectExpression? KW_FROM str=selectExpression RPAREN
; ;
// fun(par1, par2, par3) // fun(par1, par2, par3)
function_ function_
: trimFunction : trimFunction
| functionNameForInvoke | functionNameForInvoke LPAREN (
LPAREN star=STAR
(star=STAR | dist=all_distinct? (selectExpression (COMMA selectExpression)*)?) | dist=all_distinct? (selectExpression (COMMA selectExpression)*)?
( ) (
// SELECT rank(3) WITHIN GROUP (<order by clause>) // SELECT rank(3) WITHIN GROUP (<order by clause>)
RPAREN within=KW_WITHIN KW_GROUP LPAREN ordBy=orderByClause RPAREN RPAREN within=KW_WITHIN KW_GROUP LPAREN ordBy=orderByClause RPAREN
// No null treatment: SELECT first_value(b) OVER (<window spec>) // No null treatment: SELECT first_value(b) OVER (<window spec>)
@ -2201,27 +2152,15 @@ internalFunctionName // Hive Internal Function
; ;
castExpression castExpression
: KW_CAST : KW_CAST LPAREN expression KW_AS toType=primitiveType (fmt=KW_FORMAT StringLiteral)? RPAREN
LPAREN
expression
KW_AS
toType=primitiveType
(fmt=KW_FORMAT StringLiteral)?
RPAREN
; ;
caseExpression caseExpression
: KW_CASE expression : KW_CASE expression (KW_WHEN expression KW_THEN expression)+ (KW_ELSE expression)? KW_END
(KW_WHEN expression KW_THEN expression)+
(KW_ELSE expression)?
KW_END
; ;
whenExpression whenExpression
: KW_CASE : KW_CASE (KW_WHEN expression KW_THEN expression)+ (KW_ELSE expression)? KW_END
(KW_WHEN expression KW_THEN expression)+
(KW_ELSE expression)?
KW_END
; ;
floorExpression floorExpression
@ -2363,7 +2302,9 @@ precedenceBitwiseXorOperator
; ;
precedenceBitwiseXorExpression precedenceBitwiseXorExpression
: precedenceUnaryPrefixExpression (precedenceBitwiseXorOperator precedenceUnaryPrefixExpression)* : precedenceUnaryPrefixExpression (
precedenceBitwiseXorOperator precedenceUnaryPrefixExpression
)*
; ;
precedenceStarOperator precedenceStarOperator
@ -2392,7 +2333,6 @@ precedenceConcatenateOperator
precedenceConcatenateExpression precedenceConcatenateExpression
: precedencePlusExpression (precedenceConcatenateOperator plus=precedencePlusExpression)* : precedencePlusExpression (precedenceConcatenateOperator plus=precedencePlusExpression)*
; ;
precedenceAmpersandOperator precedenceAmpersandOperator
@ -2483,8 +2423,8 @@ precedenceEqualOperator
; ;
precedenceEqualExpression precedenceEqualExpression
: precedenceSimilarExpression : precedenceSimilarExpression (
( equal+=precedenceEqualOperator p+=precedenceSimilarExpression equal+=precedenceEqualOperator p+=precedenceSimilarExpression
| dist+=precedenceDistinctOperator p+=precedenceSimilarExpression | dist+=precedenceDistinctOperator p+=precedenceSimilarExpression
)* )*
; ;
@ -2988,8 +2928,10 @@ rpUnassignList
; ;
createResourcePlanStatement createResourcePlanStatement
: KW_CREATE KW_RESOURCE KW_PLAN ifNotExists? : KW_CREATE KW_RESOURCE KW_PLAN ifNotExists? (
(name=id_ KW_LIKE likeName=id_ | name=id_ (KW_WITH rpAssignList)?) name=id_ KW_LIKE likeName=id_
| name=id_ (KW_WITH rpAssignList)?
)
; ;
withReplace withReplace
@ -3131,13 +3073,12 @@ triggerActionExpressionStandalone
; ;
createTriggerStatement createTriggerStatement
: KW_CREATE KW_TRIGGER rpName=id_ DOT triggerName=id_ : KW_CREATE KW_TRIGGER rpName=id_ DOT triggerName=id_ KW_WHEN triggerExpression KW_DO triggerActionExpression
KW_WHEN triggerExpression KW_DO triggerActionExpression
; ;
alterTriggerStatement alterTriggerStatement
: KW_ALTER KW_TRIGGER rpName=id_ DOT triggerName=id_ : KW_ALTER KW_TRIGGER rpName=id_ DOT triggerName=id_ (
( KW_WHEN triggerExpression KW_DO triggerActionExpression KW_WHEN triggerExpression KW_DO triggerActionExpression
| (KW_ADD KW_TO | KW_DROP KW_FROM) (KW_POOL poolName=poolPath | KW_UNMANAGED) | (KW_ADD KW_TO | KW_DROP KW_FROM) (KW_POOL poolName=poolPath | KW_UNMANAGED)
) )
; ;
@ -3147,7 +3088,8 @@ dropTriggerStatement
; ;
poolAssign poolAssign
: ( KW_ALLOC_FRACTION EQUAL allocFraction=Number : (
KW_ALLOC_FRACTION EQUAL allocFraction=Number
| KW_QUERY_PARALLELISM EQUAL parallelism=Number | KW_QUERY_PARALLELISM EQUAL parallelism=Number
| KW_SCHEDULING_POLICY EQUAL policy=StringLiteral | KW_SCHEDULING_POLICY EQUAL policy=StringLiteral
| KW_PATH EQUAL path=poolPath | KW_PATH EQUAL path=poolPath
@ -3159,13 +3101,12 @@ poolAssignList
; ;
createPoolStatement createPoolStatement
: KW_CREATE KW_POOL rpName=id_ DOT poolPath : KW_CREATE KW_POOL rpName=id_ DOT poolPath KW_WITH poolAssignList
KW_WITH poolAssignList
; ;
alterPoolStatement alterPoolStatement
: KW_ALTER KW_POOL rpName=id_ DOT poolPath : KW_ALTER KW_POOL rpName=id_ DOT poolPath (
( KW_SET poolAssignList KW_SET poolAssignList
| KW_UNSET KW_SCHEDULING_POLICY | KW_UNSET KW_SCHEDULING_POLICY
| (KW_ADD | KW_DROP) KW_TRIGGER triggerName=id_ | (KW_ADD | KW_DROP) KW_TRIGGER triggerName=id_
) )
@ -3176,20 +3117,19 @@ dropPoolStatement
; ;
createMappingStatement createMappingStatement
: KW_CREATE mappingType=(KW_USER | KW_GROUP | KW_APPLICATION) : KW_CREATE mappingType=(KW_USER | KW_GROUP | KW_APPLICATION) KW_MAPPING name=StringLiteral KW_IN rpName=id_ (
KW_MAPPING name=StringLiteral KW_TO path=poolPath
KW_IN rpName=id_ (KW_TO path=poolPath | unmanaged) | unmanaged
(KW_WITH KW_ORDER order=Number)? ) (KW_WITH KW_ORDER order=Number)?
; ;
alterMappingStatement alterMappingStatement
: KW_ALTER mappingType=(KW_USER | KW_GROUP | KW_APPLICATION) : KW_ALTER mappingType=(KW_USER | KW_GROUP | KW_APPLICATION) KW_MAPPING name=StringLiteral KW_IN rpName=id_ (
KW_MAPPING name=StringLiteral KW_TO path=poolPath
KW_IN rpName=id_ (KW_TO path=poolPath | unmanaged) | unmanaged
(KW_WITH KW_ORDER order=Number)? ) (KW_WITH KW_ORDER order=Number)?
; ;
dropMappingStatement dropMappingStatement
: KW_DROP mappingType=(KW_USER | KW_GROUP | KW_APPLICATION) KW_MAPPING : KW_DROP mappingType=(KW_USER | KW_GROUP | KW_APPLICATION) KW_MAPPING name=StringLiteral KW_IN rpName=id_
name=StringLiteral KW_IN rpName=id_
; ;

View File

@ -19,9 +19,16 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons none, alignColons trailing
// $antlr-format singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true
// $antlr-format spaceBeforeAssignmentOperators false, groupedAlignments true
lexer grammar ImpalaSqlLexer; lexer grammar ImpalaSqlLexer;
options { caseInsensitive = true; } options {
caseInsensitive=true;
}
KW_ADD : 'ADD'; KW_ADD : 'ADD';
KW_ALL : 'ALL'; KW_ALL : 'ALL';
@ -263,107 +270,66 @@ LT : '<';
LTE : '<='; LTE : '<=';
GT : '>'; GT : '>';
GTE : '>='; GTE : '>=';
PLUS: '+'; PLUS : '+';
MINUS: '-'; MINUS : '-';
ASTERISK: '*'; ASTERISK : '*';
SLASH: '/'; SLASH : '/';
PERCENT: '%'; PERCENT : '%';
CONCAT: '||'; CONCAT : '||';
DOT : '.'; DOT : '.';
SEMICOLON: ';'; SEMICOLON : ';';
COMMA: ','; COMMA : ',';
COLON : ':' ; COLON : ':';
LPAREN : '(' ; LPAREN : '(';
RPAREN : ')' ; RPAREN : ')';
LSQUARE : '[' ; LSQUARE : '[';
RSQUARE : ']' ; RSQUARE : ']';
LCURLY : '{'; LCURLY : '{';
RCURLY : '}'; RCURLY : '}';
BITWISEOR : '|'; BITWISEOR : '|';
QUESTION : '?'; QUESTION : '?';
RIGHT_ARROW : '->'; RIGHT_ARROW: '->';
STRING STRING: '\'' ( ~'\'' | '\'\'')* '\'' | '"' ( ~'"' | '""')* '"';
: '\'' ( ~'\'' | '\'\'' )* '\''
| '"' ( ~'"' | '""' )* '"'
;
UNICODE_STRING UNICODE_STRING: 'U&\'' ( ~'\'' | '\'\'')* '\'';
: 'U&\'' ( ~'\'' | '\'\'' )* '\''
;
// Note: we allow any character inside the binary literal and validate // Note: we allow any character inside the binary literal and validate
// its a correct literal when the AST is being constructed. This // its a correct literal when the AST is being constructed. This
// allows us to provide more meaningful error messages to the user // allows us to provide more meaningful error messages to the user
BINARY_LITERAL BINARY_LITERAL: 'X\'' (~'\'')* '\'';
: 'X\'' (~'\'')* '\''
;
INTEGER_VALUE INTEGER_VALUE: DIGIT+;
: DIGIT+
;
DECIMAL_VALUE DECIMAL_VALUE: DIGIT+ '.' DIGIT* | '.' DIGIT+;
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
DOUBLE_VALUE DOUBLE_VALUE: DIGIT+ ('.' DIGIT*)? EXPONENT | '.' DIGIT+ EXPONENT;
: DIGIT+ ('.' DIGIT*)? EXPONENT
| '.' DIGIT+ EXPONENT
;
IDENTIFIER IDENTIFIER: (LETTER | '_') (LETTER | DIGIT | '_' | '@' | ':')*;
: (LETTER | '_') (LETTER | DIGIT | '_' | '@' | ':')*
;
DIGIT_IDENTIFIER DIGIT_IDENTIFIER: DIGIT (LETTER | DIGIT | '_' | '@' | ':')+;
: DIGIT (LETTER | DIGIT | '_' | '@' | ':')+
;
QUOTED_IDENTIFIER QUOTED_IDENTIFIER: '"' ( ~'"' | '""')* '"';
: '"' ( ~'"' | '""' )* '"'
;
BACKQUOTED_IDENTIFIER BACKQUOTED_IDENTIFIER: '`' ( ~'`' | '``')* '`';
: '`' ( ~'`' | '``' )* '`'
;
TIME_WITH_TIME_ZONE TIME_WITH_TIME_ZONE: 'TIME' WS 'WITH' WS 'TIME' WS 'ZONE';
: 'TIME' WS 'WITH' WS 'TIME' WS 'ZONE'
;
TIMESTAMP_WITH_TIME_ZONE TIMESTAMP_WITH_TIME_ZONE: 'TIMESTAMP' WS 'WITH' WS 'TIME' WS 'ZONE';
: 'TIMESTAMP' WS 'WITH' WS 'TIME' WS 'ZONE'
;
DOUBLE_PRECISION DOUBLE_PRECISION: 'DOUBLE' WS 'PRECISION';
: 'DOUBLE' WS 'PRECISION'
;
fragment EXPONENT fragment EXPONENT: 'E' [+-]? DIGIT+;
: 'E' [+-]? DIGIT+
;
fragment DIGIT fragment DIGIT: [0-9];
: [0-9]
;
fragment LETTER fragment LETTER: [A-Z];
: [A-Z]
;
SIMPLE_COMMENT SIMPLE_COMMENT: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN);
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_COMMENT BRACKETED_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
: '/*' .*? '*/' -> channel(HIDDEN)
;
WS WS: [ \r\n\t]+ -> channel(HIDDEN);
: [ \r\n\t]+ -> channel(HIDDEN)
;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,11 @@
* Reference: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4 * Reference: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4
*/ */
// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons none, alignColons trailing
// $antlr-format singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true
// $antlr-format spaceBeforeAssignmentOperators false, groupedAlignments true
lexer grammar SparkSqlLexer; lexer grammar SparkSqlLexer;
@members { @members {
@ -39,12 +44,12 @@ lexer grammar SparkSqlLexer;
SEMICOLON: ';'; SEMICOLON: ';';
LEFT_PAREN: '('; LEFT_PAREN : '(';
RIGHT_PAREN: ')'; RIGHT_PAREN : ')';
COMMA: ','; COMMA : ',';
DOT: '.'; DOT : '.';
LEFT_BRACKET: '['; LEFT_BRACKET : '[';
RIGHT_BRACKET: ']'; RIGHT_BRACKET : ']';
// NOTE: If you add a new token in the list below, you should update the list of keywords // NOTE: If you add a new token in the list below, you should update the list of keywords
// and reserved tag in `docs/sql-ref-ansi-compliance.md#sql-keywords`, and // and reserved tag in `docs/sql-ref-ansi-compliance.md#sql-keywords`, and
@ -54,468 +59,420 @@ RIGHT_BRACKET: ']';
// Start of the keywords list // Start of the keywords list
//============================ //============================
//--SPARK-KEYWORD-LIST-START //--SPARK-KEYWORD-LIST-START
KW_ADD: 'ADD'; KW_ADD : 'ADD';
KW_AFTER: 'AFTER'; KW_AFTER : 'AFTER';
KW_ALL: 'ALL'; KW_ALL : 'ALL';
KW_ALTER: 'ALTER'; KW_ALTER : 'ALTER';
KW_ALWAYS: 'ALWAYS'; KW_ALWAYS : 'ALWAYS';
KW_ANALYZE: 'ANALYZE'; KW_ANALYZE : 'ANALYZE';
KW_AND: 'AND'; KW_AND : 'AND';
KW_ANTI: 'ANTI'; KW_ANTI : 'ANTI';
KW_ANY: 'ANY'; KW_ANY : 'ANY';
KW_ANY_VALUE: 'ANY_VALUE'; KW_ANY_VALUE : 'ANY_VALUE';
KW_ARCHIVE: 'ARCHIVE'; KW_ARCHIVE : 'ARCHIVE';
KW_ARRAY: 'ARRAY'; KW_ARRAY : 'ARRAY';
KW_AS: 'AS'; KW_AS : 'AS';
KW_ASC: 'ASC'; KW_ASC : 'ASC';
KW_AT: 'AT'; KW_AT : 'AT';
KW_AUTHORIZATION: 'AUTHORIZATION'; KW_AUTHORIZATION : 'AUTHORIZATION';
KW_BETWEEN: 'BETWEEN'; KW_BETWEEN : 'BETWEEN';
KW_BIGINT: 'BIGINT'; KW_BIGINT : 'BIGINT';
KW_BINARY: 'BINARY'; KW_BINARY : 'BINARY';
KW_BOOLEAN: 'BOOLEAN'; KW_BOOLEAN : 'BOOLEAN';
KW_BOTH: 'BOTH'; KW_BOTH : 'BOTH';
KW_BUCKET: 'BUCKET'; KW_BUCKET : 'BUCKET';
KW_BUCKETS: 'BUCKETS'; KW_BUCKETS : 'BUCKETS';
KW_BY: 'BY'; KW_BY : 'BY';
KW_BYTE: 'BYTE'; KW_BYTE : 'BYTE';
KW_CACHE: 'CACHE'; KW_CACHE : 'CACHE';
KW_CASCADE: 'CASCADE'; KW_CASCADE : 'CASCADE';
KW_CASE: 'CASE'; KW_CASE : 'CASE';
KW_CAST: 'CAST'; KW_CAST : 'CAST';
KW_CATALOG: 'CATALOG'; KW_CATALOG : 'CATALOG';
KW_CATALOGS: 'CATALOGS'; KW_CATALOGS : 'CATALOGS';
KW_CHANGE: 'CHANGE'; KW_CHANGE : 'CHANGE';
KW_CHAR: 'CHAR'; KW_CHAR : 'CHAR';
KW_CHARACTER: 'CHARACTER'; KW_CHARACTER : 'CHARACTER';
KW_CHECK: 'CHECK'; KW_CHECK : 'CHECK';
KW_CLEAR: 'CLEAR'; KW_CLEAR : 'CLEAR';
KW_CLUSTER: 'CLUSTER'; KW_CLUSTER : 'CLUSTER';
KW_CLUSTERED: 'CLUSTERED'; KW_CLUSTERED : 'CLUSTERED';
KW_CODEGEN: 'CODEGEN'; KW_CODEGEN : 'CODEGEN';
KW_COLLATE: 'COLLATE'; KW_COLLATE : 'COLLATE';
KW_COLLECTION: 'COLLECTION'; KW_COLLECTION : 'COLLECTION';
KW_COLUMN: 'COLUMN'; KW_COLUMN : 'COLUMN';
KW_COLUMNS: 'COLUMNS'; KW_COLUMNS : 'COLUMNS';
KW_COMMENT: 'COMMENT'; KW_COMMENT : 'COMMENT';
KW_COMMIT: 'COMMIT'; KW_COMMIT : 'COMMIT';
KW_COMPACT: 'COMPACT'; KW_COMPACT : 'COMPACT';
KW_COMPACTIONS: 'COMPACTIONS'; KW_COMPACTIONS : 'COMPACTIONS';
KW_COMPUTE: 'COMPUTE'; KW_COMPUTE : 'COMPUTE';
KW_CONCATENATE: 'CONCATENATE'; KW_CONCATENATE : 'CONCATENATE';
KW_CONSTRAINT: 'CONSTRAINT'; KW_CONSTRAINT : 'CONSTRAINT';
KW_COST: 'COST'; KW_COST : 'COST';
KW_CREATE: 'CREATE'; KW_CREATE : 'CREATE';
KW_CROSS: 'CROSS'; KW_CROSS : 'CROSS';
KW_CUBE: 'CUBE'; KW_CUBE : 'CUBE';
KW_CURRENT: 'CURRENT'; KW_CURRENT : 'CURRENT';
KW_CURRENT_DATE: 'CURRENT_DATE'; KW_CURRENT_DATE : 'CURRENT_DATE';
KW_CURRENT_TIME: 'CURRENT_TIME'; KW_CURRENT_TIME : 'CURRENT_TIME';
KW_CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP'; KW_CURRENT_TIMESTAMP : 'CURRENT_TIMESTAMP';
KW_CURRENT_USER: 'CURRENT_USER'; KW_CURRENT_USER : 'CURRENT_USER';
KW_DAY: 'DAY'; KW_DAY : 'DAY';
KW_DAYS: 'DAYS'; KW_DAYS : 'DAYS';
KW_DAYOFYEAR: 'DAYOFYEAR'; KW_DAYOFYEAR : 'DAYOFYEAR';
KW_DATA: 'DATA'; KW_DATA : 'DATA';
KW_DATE: 'DATE'; KW_DATE : 'DATE';
KW_DATABASE: 'DATABASE'; KW_DATABASE : 'DATABASE';
KW_DATABASES: 'DATABASES'; KW_DATABASES : 'DATABASES';
KW_DATEADD: 'DATEADD'; KW_DATEADD : 'DATEADD';
KW_DATE_ADD: 'DATE_ADD'; KW_DATE_ADD : 'DATE_ADD';
KW_DATEDIFF: 'DATEDIFF'; KW_DATEDIFF : 'DATEDIFF';
KW_DATE_DIFF: 'DATE_DIFF'; KW_DATE_DIFF : 'DATE_DIFF';
KW_DBPROPERTIES: 'DBPROPERTIES'; KW_DBPROPERTIES : 'DBPROPERTIES';
KW_DEC: 'DEC'; KW_DEC : 'DEC';
KW_DECIMAL: 'DECIMAL'; KW_DECIMAL : 'DECIMAL';
KW_DECLARE: 'DECLARE'; KW_DECLARE : 'DECLARE';
KW_DEFAULT: 'DEFAULT'; KW_DEFAULT : 'DEFAULT';
KW_DEFINED: 'DEFINED'; KW_DEFINED : 'DEFINED';
KW_DELETE: 'DELETE'; KW_DELETE : 'DELETE';
KW_DELIMITED: 'DELIMITED'; KW_DELIMITED : 'DELIMITED';
KW_DESC: 'DESC'; KW_DESC : 'DESC';
KW_DESCRIBE: 'DESCRIBE'; KW_DESCRIBE : 'DESCRIBE';
KW_DFS: 'DFS'; KW_DFS : 'DFS';
KW_DIRECTORIES: 'DIRECTORIES'; KW_DIRECTORIES : 'DIRECTORIES';
KW_DIRECTORY: 'DIRECTORY'; KW_DIRECTORY : 'DIRECTORY';
KW_DISTINCT: 'DISTINCT'; KW_DISTINCT : 'DISTINCT';
KW_DISTRIBUTE: 'DISTRIBUTE'; KW_DISTRIBUTE : 'DISTRIBUTE';
KW_DIV: 'DIV'; KW_DIV : 'DIV';
KW_DOUBLE: 'DOUBLE'; KW_DOUBLE : 'DOUBLE';
KW_DROP: 'DROP'; KW_DROP : 'DROP';
KW_ELSE: 'ELSE'; KW_ELSE : 'ELSE';
KW_END: 'END'; KW_END : 'END';
KW_ESCAPE: 'ESCAPE'; KW_ESCAPE : 'ESCAPE';
KW_ESCAPED: 'ESCAPED'; KW_ESCAPED : 'ESCAPED';
KW_EXCEPT: 'EXCEPT'; KW_EXCEPT : 'EXCEPT';
KW_EXCHANGE: 'EXCHANGE'; KW_EXCHANGE : 'EXCHANGE';
KW_EXCLUDE: 'EXCLUDE'; KW_EXCLUDE : 'EXCLUDE';
KW_EXISTS: 'EXISTS'; KW_EXISTS : 'EXISTS';
KW_EXPLAIN: 'EXPLAIN'; KW_EXPLAIN : 'EXPLAIN';
KW_EXPORT: 'EXPORT'; KW_EXPORT : 'EXPORT';
KW_EXTENDED: 'EXTENDED'; KW_EXTENDED : 'EXTENDED';
KW_EXTERNAL: 'EXTERNAL'; KW_EXTERNAL : 'EXTERNAL';
KW_EXTRACT: 'EXTRACT'; KW_EXTRACT : 'EXTRACT';
KW_FALSE: 'FALSE'; KW_FALSE : 'FALSE';
KW_FETCH: 'FETCH'; KW_FETCH : 'FETCH';
KW_FIELDS: 'FIELDS'; KW_FIELDS : 'FIELDS';
KW_FILTER: 'FILTER'; KW_FILTER : 'FILTER';
KW_FILEFORMAT: 'FILEFORMAT'; KW_FILEFORMAT : 'FILEFORMAT';
KW_FIRST: 'FIRST'; KW_FIRST : 'FIRST';
KW_FLOAT: 'FLOAT'; KW_FLOAT : 'FLOAT';
KW_FOLLOWING: 'FOLLOWING'; KW_FOLLOWING : 'FOLLOWING';
KW_FOR: 'FOR'; KW_FOR : 'FOR';
KW_FOREIGN: 'FOREIGN'; KW_FOREIGN : 'FOREIGN';
KW_FORMAT: 'FORMAT'; KW_FORMAT : 'FORMAT';
KW_FORMATTED: 'FORMATTED'; KW_FORMATTED : 'FORMATTED';
KW_FROM: 'FROM'; KW_FROM : 'FROM';
KW_FULL: 'FULL'; KW_FULL : 'FULL';
KW_FUNCTION: 'FUNCTION'; KW_FUNCTION : 'FUNCTION';
KW_FUNCTIONS: 'FUNCTIONS'; KW_FUNCTIONS : 'FUNCTIONS';
KW_GENERATED: 'GENERATED'; KW_GENERATED : 'GENERATED';
KW_GLOBAL: 'GLOBAL'; KW_GLOBAL : 'GLOBAL';
KW_GRANT: 'GRANT'; KW_GRANT : 'GRANT';
KW_GROUP: 'GROUP'; KW_GROUP : 'GROUP';
KW_GROUPING: 'GROUPING'; KW_GROUPING : 'GROUPING';
KW_HAVING: 'HAVING'; KW_HAVING : 'HAVING';
KW_BINARY_HEX: 'X'; KW_BINARY_HEX : 'X';
KW_HOUR: 'HOUR'; KW_HOUR : 'HOUR';
KW_HOURS: 'HOURS'; KW_HOURS : 'HOURS';
KW_IDENTIFIER: 'IDENTIFIER'; KW_IDENTIFIER : 'IDENTIFIER';
KW_IF: 'IF'; KW_IF : 'IF';
KW_IGNORE: 'IGNORE'; KW_IGNORE : 'IGNORE';
KW_IMPORT: 'IMPORT'; KW_IMPORT : 'IMPORT';
KW_IN: 'IN'; KW_IN : 'IN';
KW_INCLUDE: 'INCLUDE'; KW_INCLUDE : 'INCLUDE';
KW_INDEX: 'INDEX'; KW_INDEX : 'INDEX';
KW_INDEXES: 'INDEXES'; KW_INDEXES : 'INDEXES';
KW_INNER: 'INNER'; KW_INNER : 'INNER';
KW_INPATH: 'INPATH'; KW_INPATH : 'INPATH';
KW_INPUTFORMAT: 'INPUTFORMAT'; KW_INPUTFORMAT : 'INPUTFORMAT';
KW_INSERT: 'INSERT'; KW_INSERT : 'INSERT';
KW_INTERSECT: 'INTERSECT'; KW_INTERSECT : 'INTERSECT';
KW_INTERVAL: 'INTERVAL'; KW_INTERVAL : 'INTERVAL';
KW_INT: 'INT'; KW_INT : 'INT';
KW_INTEGER: 'INTEGER'; KW_INTEGER : 'INTEGER';
KW_INTO: 'INTO'; KW_INTO : 'INTO';
KW_IS: 'IS'; KW_IS : 'IS';
KW_ITEMS: 'ITEMS'; KW_ITEMS : 'ITEMS';
KW_JOIN: 'JOIN'; KW_JOIN : 'JOIN';
KW_KEYS: 'KEYS'; KW_KEYS : 'KEYS';
KW_LAST: 'LAST'; KW_LAST : 'LAST';
KW_LATERAL: 'LATERAL'; KW_LATERAL : 'LATERAL';
KW_LAZY: 'LAZY'; KW_LAZY : 'LAZY';
KW_LEADING: 'LEADING'; KW_LEADING : 'LEADING';
KW_LEFT: 'LEFT'; KW_LEFT : 'LEFT';
KW_LIKE: 'LIKE'; KW_LIKE : 'LIKE';
KW_ILIKE: 'ILIKE'; KW_ILIKE : 'ILIKE';
KW_LIMIT: 'LIMIT'; KW_LIMIT : 'LIMIT';
KW_LINES: 'LINES'; KW_LINES : 'LINES';
KW_LIST: 'LIST'; KW_LIST : 'LIST';
KW_LOAD: 'LOAD'; KW_LOAD : 'LOAD';
KW_LOCAL: 'LOCAL'; KW_LOCAL : 'LOCAL';
KW_LOCATION: 'LOCATION'; KW_LOCATION : 'LOCATION';
KW_LOCK: 'LOCK'; KW_LOCK : 'LOCK';
KW_LOCKS: 'LOCKS'; KW_LOCKS : 'LOCKS';
KW_LOGICAL: 'LOGICAL'; KW_LOGICAL : 'LOGICAL';
KW_LONG: 'LONG'; KW_LONG : 'LONG';
KW_MACRO: 'MACRO'; KW_MACRO : 'MACRO';
KW_MAP: 'MAP'; KW_MAP : 'MAP';
KW_MATCHED: 'MATCHED'; KW_MATCHED : 'MATCHED';
KW_MERGE: 'MERGE'; KW_MERGE : 'MERGE';
KW_MICROSECOND: 'MICROSECOND'; KW_MICROSECOND : 'MICROSECOND';
KW_MICROSECONDS: 'MICROSECONDS'; KW_MICROSECONDS : 'MICROSECONDS';
KW_MILLISECOND: 'MILLISECOND'; KW_MILLISECOND : 'MILLISECOND';
KW_MILLISECONDS: 'MILLISECONDS'; KW_MILLISECONDS : 'MILLISECONDS';
KW_MINUTE: 'MINUTE'; KW_MINUTE : 'MINUTE';
KW_MINUTES: 'MINUTES'; KW_MINUTES : 'MINUTES';
KW_MONTH: 'MONTH'; KW_MONTH : 'MONTH';
KW_MONTHS: 'MONTHS'; KW_MONTHS : 'MONTHS';
KW_MSCK: 'MSCK'; KW_MSCK : 'MSCK';
KW_NAME: 'NAME'; KW_NAME : 'NAME';
KW_NAMESPACE: 'NAMESPACE'; KW_NAMESPACE : 'NAMESPACE';
KW_NAMESPACES: 'NAMESPACES'; KW_NAMESPACES : 'NAMESPACES';
KW_NANOSECOND: 'NANOSECOND'; KW_NANOSECOND : 'NANOSECOND';
KW_NANOSECONDS: 'NANOSECONDS'; KW_NANOSECONDS : 'NANOSECONDS';
KW_NATURAL: 'NATURAL'; KW_NATURAL : 'NATURAL';
KW_NO: 'NO'; KW_NO : 'NO';
KW_NOSCAN: 'NOSCAN'; KW_NOSCAN : 'NOSCAN';
KW_NOT: 'NOT'; KW_NOT : 'NOT';
KW_NULL: 'NULL'; KW_NULL : 'NULL';
KW_NULLS: 'NULLS'; KW_NULLS : 'NULLS';
KW_NUMERIC: 'NUMERIC'; KW_NUMERIC : 'NUMERIC';
KW_OF: 'OF'; KW_OF : 'OF';
KW_OFFSET: 'OFFSET'; KW_OFFSET : 'OFFSET';
KW_ON: 'ON'; KW_ON : 'ON';
KW_ONLY: 'ONLY'; KW_ONLY : 'ONLY';
KW_OPTION: 'OPTION'; KW_OPTION : 'OPTION';
KW_OPTIONS: 'OPTIONS'; KW_OPTIONS : 'OPTIONS';
KW_OR: 'OR'; KW_OR : 'OR';
KW_ORDER: 'ORDER'; KW_ORDER : 'ORDER';
KW_OUT: 'OUT'; KW_OUT : 'OUT';
KW_OUTER: 'OUTER'; KW_OUTER : 'OUTER';
KW_OUTPUTFORMAT: 'OUTPUTFORMAT'; KW_OUTPUTFORMAT : 'OUTPUTFORMAT';
KW_OVER: 'OVER'; KW_OVER : 'OVER';
KW_OVERLAPS: 'OVERLAPS'; KW_OVERLAPS : 'OVERLAPS';
KW_OVERLAY: 'OVERLAY'; KW_OVERLAY : 'OVERLAY';
KW_OVERWRITE: 'OVERWRITE'; KW_OVERWRITE : 'OVERWRITE';
KW_PARTITION: 'PARTITION'; KW_PARTITION : 'PARTITION';
KW_PARTITIONED: 'PARTITIONED'; KW_PARTITIONED : 'PARTITIONED';
KW_PARTITIONS: 'PARTITIONS'; KW_PARTITIONS : 'PARTITIONS';
KW_PERCENTILE_CONT: 'PERCENTILE_CONT'; KW_PERCENTILE_CONT : 'PERCENTILE_CONT';
KW_PERCENTILE_DISC: 'PERCENTILE_DISC'; KW_PERCENTILE_DISC : 'PERCENTILE_DISC';
KW_PERCENTLIT: 'PERCENT'; KW_PERCENTLIT : 'PERCENT';
KW_PIVOT: 'PIVOT'; KW_PIVOT : 'PIVOT';
KW_PLACING: 'PLACING'; KW_PLACING : 'PLACING';
KW_POSITION: 'POSITION'; KW_POSITION : 'POSITION';
KW_PRECEDING: 'PRECEDING'; KW_PRECEDING : 'PRECEDING';
KW_PRIMARY: 'PRIMARY'; KW_PRIMARY : 'PRIMARY';
KW_PRINCIPALS: 'PRINCIPALS'; KW_PRINCIPALS : 'PRINCIPALS';
KW_PROPERTIES: 'PROPERTIES'; KW_PROPERTIES : 'PROPERTIES';
KW_PURGE: 'PURGE'; KW_PURGE : 'PURGE';
KW_QUARTER: 'QUARTER'; KW_QUARTER : 'QUARTER';
KW_QUERY: 'QUERY'; KW_QUERY : 'QUERY';
KW_RANGE: 'RANGE'; KW_RANGE : 'RANGE';
KW_REAL: 'REAL'; KW_REAL : 'REAL';
KW_RECORDREADER: 'RECORDREADER'; KW_RECORDREADER : 'RECORDREADER';
KW_RECORDWRITER: 'RECORDWRITER'; KW_RECORDWRITER : 'RECORDWRITER';
KW_RECOVER: 'RECOVER'; KW_RECOVER : 'RECOVER';
KW_REDUCE: 'REDUCE'; KW_REDUCE : 'REDUCE';
KW_REFERENCES: 'REFERENCES'; KW_REFERENCES : 'REFERENCES';
KW_REFRESH: 'REFRESH'; KW_REFRESH : 'REFRESH';
KW_RENAME: 'RENAME'; KW_RENAME : 'RENAME';
KW_REPAIR: 'REPAIR'; KW_REPAIR : 'REPAIR';
KW_REPEATABLE: 'REPEATABLE'; KW_REPEATABLE : 'REPEATABLE';
KW_REPLACE: 'REPLACE'; KW_REPLACE : 'REPLACE';
KW_RESET: 'RESET'; KW_RESET : 'RESET';
KW_RESPECT: 'RESPECT'; KW_RESPECT : 'RESPECT';
KW_RESTRICT: 'RESTRICT'; KW_RESTRICT : 'RESTRICT';
KW_REVOKE: 'REVOKE'; KW_REVOKE : 'REVOKE';
KW_RIGHT: 'RIGHT'; KW_RIGHT : 'RIGHT';
KW_RLIKE: 'RLIKE'; KW_RLIKE : 'RLIKE';
KW_REGEXP: 'REGEXP'; KW_REGEXP : 'REGEXP';
KW_ROLE: 'ROLE'; KW_ROLE : 'ROLE';
KW_ROLES: 'ROLES'; KW_ROLES : 'ROLES';
KW_ROLLBACK: 'ROLLBACK'; KW_ROLLBACK : 'ROLLBACK';
KW_ROLLUP: 'ROLLUP'; KW_ROLLUP : 'ROLLUP';
KW_ROW: 'ROW'; KW_ROW : 'ROW';
KW_ROWS: 'ROWS'; KW_ROWS : 'ROWS';
KW_SECOND: 'SECOND'; KW_SECOND : 'SECOND';
KW_SECONDS: 'SECONDS'; KW_SECONDS : 'SECONDS';
KW_SCHEMA: 'SCHEMA'; KW_SCHEMA : 'SCHEMA';
KW_SCHEMAS: 'SCHEMAS'; KW_SCHEMAS : 'SCHEMAS';
KW_SELECT: 'SELECT'; KW_SELECT : 'SELECT';
KW_SEMI: 'SEMI'; KW_SEMI : 'SEMI';
KW_SEPARATED: 'SEPARATED'; KW_SEPARATED : 'SEPARATED';
KW_SERDE: 'SERDE'; KW_SERDE : 'SERDE';
KW_SERDEPROPERTIES: 'SERDEPROPERTIES'; KW_SERDEPROPERTIES : 'SERDEPROPERTIES';
KW_SESSION_USER: 'SESSION_USER'; KW_SESSION_USER : 'SESSION_USER';
KW_SET: 'SET'; KW_SET : 'SET';
KW_MINUS: 'MINUS'; KW_MINUS : 'MINUS';
KW_SETS: 'SETS'; KW_SETS : 'SETS';
KW_SHORT: 'SHORT'; KW_SHORT : 'SHORT';
KW_SHOW: 'SHOW'; KW_SHOW : 'SHOW';
KW_SINGLE: 'SINGLE'; KW_SINGLE : 'SINGLE';
KW_SKEWED: 'SKEWED'; KW_SKEWED : 'SKEWED';
KW_SMALLINT: 'SMALLINT'; KW_SMALLINT : 'SMALLINT';
KW_SOME: 'SOME'; KW_SOME : 'SOME';
KW_SORT: 'SORT'; KW_SORT : 'SORT';
KW_SORTED: 'SORTED'; KW_SORTED : 'SORTED';
KW_SOURCE: 'SOURCE'; KW_SOURCE : 'SOURCE';
KW_START: 'START'; KW_START : 'START';
KW_STATISTICS: 'STATISTICS'; KW_STATISTICS : 'STATISTICS';
KW_STORED: 'STORED'; KW_STORED : 'STORED';
KW_STRATIFY: 'STRATIFY'; KW_STRATIFY : 'STRATIFY';
KW_STRING: 'STRING'; KW_STRING : 'STRING';
KW_STRUCT: 'STRUCT'; KW_STRUCT : 'STRUCT';
KW_SUBSTR: 'SUBSTR'; KW_SUBSTR : 'SUBSTR';
KW_SUBSTRING: 'SUBSTRING'; KW_SUBSTRING : 'SUBSTRING';
KW_SYNC: 'SYNC'; KW_SYNC : 'SYNC';
KW_SYSTEM: 'SYSTEM'; KW_SYSTEM : 'SYSTEM';
KW_SYSTEM_TIME: 'SYSTEM_TIME'; KW_SYSTEM_TIME : 'SYSTEM_TIME';
KW_SYSTEM_VERSION: 'SYSTEM_VERSION'; KW_SYSTEM_VERSION : 'SYSTEM_VERSION';
KW_TABLE: 'TABLE'; KW_TABLE : 'TABLE';
KW_TABLES: 'TABLES'; KW_TABLES : 'TABLES';
KW_TABLESAMPLE: 'TABLESAMPLE'; KW_TABLESAMPLE : 'TABLESAMPLE';
KW_TARGET: 'TARGET'; KW_TARGET : 'TARGET';
KW_TBLPROPERTIES: 'TBLPROPERTIES'; KW_TBLPROPERTIES : 'TBLPROPERTIES';
KW_TEMPORARY: 'TEMPORARY'; KW_TEMPORARY : 'TEMPORARY';
KW_TERMINATED: 'TERMINATED'; KW_TERMINATED : 'TERMINATED';
KW_THEN: 'THEN'; KW_THEN : 'THEN';
KW_TIME: 'TIME'; KW_TIME : 'TIME';
KW_TIMEDIFF: 'TIMEDIFF'; KW_TIMEDIFF : 'TIMEDIFF';
KW_TIMESTAMP: 'TIMESTAMP'; KW_TIMESTAMP : 'TIMESTAMP';
KW_TIMESTAMP_LTZ: 'TIMESTAMP_LTZ'; KW_TIMESTAMP_LTZ : 'TIMESTAMP_LTZ';
KW_TIMESTAMP_NTZ: 'TIMESTAMP_NTZ'; KW_TIMESTAMP_NTZ : 'TIMESTAMP_NTZ';
KW_TIMESTAMPADD: 'TIMESTAMPADD'; KW_TIMESTAMPADD : 'TIMESTAMPADD';
KW_TIMESTAMPDIFF: 'TIMESTAMPDIFF'; KW_TIMESTAMPDIFF : 'TIMESTAMPDIFF';
KW_TINYINT: 'TINYINT'; KW_TINYINT : 'TINYINT';
KW_TO: 'TO'; KW_TO : 'TO';
KW_TOUCH: 'TOUCH'; KW_TOUCH : 'TOUCH';
KW_TRAILING: 'TRAILING'; KW_TRAILING : 'TRAILING';
KW_TRANSACTION: 'TRANSACTION'; KW_TRANSACTION : 'TRANSACTION';
KW_TRANSACTIONS: 'TRANSACTIONS'; KW_TRANSACTIONS : 'TRANSACTIONS';
KW_TRANSFORM: 'TRANSFORM'; KW_TRANSFORM : 'TRANSFORM';
KW_TRIM: 'TRIM'; KW_TRIM : 'TRIM';
KW_TRUE: 'TRUE'; KW_TRUE : 'TRUE';
KW_TRUNCATE: 'TRUNCATE'; KW_TRUNCATE : 'TRUNCATE';
KW_TRY_CAST: 'TRY_CAST'; KW_TRY_CAST : 'TRY_CAST';
KW_TYPE: 'TYPE'; KW_TYPE : 'TYPE';
KW_UNARCHIVE: 'UNARCHIVE'; KW_UNARCHIVE : 'UNARCHIVE';
KW_UNBOUNDED: 'UNBOUNDED'; KW_UNBOUNDED : 'UNBOUNDED';
KW_UNCACHE: 'UNCACHE'; KW_UNCACHE : 'UNCACHE';
KW_UNION: 'UNION'; KW_UNION : 'UNION';
KW_UNIQUE: 'UNIQUE'; KW_UNIQUE : 'UNIQUE';
KW_UNKNOWN: 'UNKNOWN'; KW_UNKNOWN : 'UNKNOWN';
KW_UNLOCK: 'UNLOCK'; KW_UNLOCK : 'UNLOCK';
KW_UNPIVOT: 'UNPIVOT'; KW_UNPIVOT : 'UNPIVOT';
KW_UNSET: 'UNSET'; KW_UNSET : 'UNSET';
KW_UPDATE: 'UPDATE'; KW_UPDATE : 'UPDATE';
KW_USE: 'USE'; KW_USE : 'USE';
KW_USER: 'USER'; KW_USER : 'USER';
KW_USING: 'USING'; KW_USING : 'USING';
KW_VALUES: 'VALUES'; KW_VALUES : 'VALUES';
KW_VARCHAR: 'VARCHAR'; KW_VARCHAR : 'VARCHAR';
KW_VAR: 'VAR'; KW_VAR : 'VAR';
KW_VARIABLE: 'VARIABLE'; KW_VARIABLE : 'VARIABLE';
KW_VERSION: 'VERSION'; KW_VERSION : 'VERSION';
KW_VIEW: 'VIEW'; KW_VIEW : 'VIEW';
KW_VIEWS: 'VIEWS'; KW_VIEWS : 'VIEWS';
KW_VOID: 'VOID'; KW_VOID : 'VOID';
KW_WEEK: 'WEEK'; KW_WEEK : 'WEEK';
KW_WEEKS: 'WEEKS'; KW_WEEKS : 'WEEKS';
KW_WHEN: 'WHEN'; KW_WHEN : 'WHEN';
KW_WHERE: 'WHERE'; KW_WHERE : 'WHERE';
KW_WINDOW: 'WINDOW'; KW_WINDOW : 'WINDOW';
KW_WITH: 'WITH'; KW_WITH : 'WITH';
KW_WITHIN: 'WITHIN'; KW_WITHIN : 'WITHIN';
KW_YEAR: 'YEAR'; KW_YEAR : 'YEAR';
KW_YEARS: 'YEARS'; KW_YEARS : 'YEARS';
KW_ZONE: 'ZONE'; KW_ZONE : 'ZONE';
//--SPARK-KEYWORD-LIST-END //--SPARK-KEYWORD-LIST-END
//============================ //============================
// End of the keywords list // End of the keywords list
//============================ //============================
EQ : '=' | '=='; EQ : '=' | '==';
NSEQ: '<=>'; NSEQ : '<=>';
NEQ : '<>'; NEQ : '<>';
NEQJ: '!='; NEQJ : '!=';
LT : '<'; LT : '<';
LTE : '<=' | '!>'; LTE : '<=' | '!>';
GT : '>'; GT : '>';
GTE : '>=' | '!<'; GTE : '>=' | '!<';
NOT: '!'; NOT : '!';
PLUS: '+'; PLUS : '+';
MINUS: '-'; MINUS : '-';
ASTERISK: '*'; ASTERISK : '*';
SLASH: '/'; SLASH : '/';
PERCENT: '%'; PERCENT : '%';
TILDE: '~'; TILDE : '~';
AMPERSAND: '&'; AMPERSAND : '&';
PIPE: '|'; PIPE : '|';
CONCAT_PIPE: '||'; CONCAT_PIPE : '||';
HAT: '^'; HAT : '^';
COLON: ':'; COLON : ':';
ARROW: '->'; ARROW : '->';
FAT_ARROW : '=>'; FAT_ARROW : '=>';
HENT_START: '/*+'; HENT_START : '/*+';
HENT_END: '*/'; HENT_END : '*/';
QUESTION: '?'; QUESTION : '?';
STRING_LITERAL STRING_LITERAL: '\'' ( ~('\'' | '\\') | ('\\' .))* '\'' | 'R\'' (~'\'')* '\'' | 'R"' (~'"')* '"';
: '\'' ( ~('\''|'\\') | ('\\' .) )* '\''
| 'R\'' (~'\'')* '\''
| 'R"'(~'"')* '"'
;
DOUBLEQUOTED_STRING DOUBLEQUOTED_STRING: '"' ( ~('"' | '\\') | ('\\' .))* '"';
:'"' ( ~('"'|'\\') | ('\\' .) )* '"'
;
// NOTE: If you move a numeric literal, you should modify `ParserUtils.toExprAlias()` // NOTE: If you move a numeric literal, you should modify `ParserUtils.toExprAlias()`
// which assumes all numeric literals are between `BIGINT_LITERAL` and `BIGDECIMAL_LITERAL`. // which assumes all numeric literals are between `BIGINT_LITERAL` and `BIGDECIMAL_LITERAL`.
BIGINT_LITERAL BIGINT_LITERAL: DIGIT+ 'L';
: DIGIT+ 'L'
;
SMALLINT_LITERAL SMALLINT_LITERAL: DIGIT+ 'S';
: DIGIT+ 'S'
;
TINYINT_LITERAL TINYINT_LITERAL: DIGIT+ 'Y';
: DIGIT+ 'Y'
;
INTEGER_VALUE INTEGER_VALUE: DIGIT+;
: DIGIT+
;
EXPONENT_VALUE EXPONENT_VALUE: DIGIT+ EXPONENT | DECIMAL_DIGITS EXPONENT;
: DIGIT+ EXPONENT
| DECIMAL_DIGITS EXPONENT
;
DECIMAL_VALUE DECIMAL_VALUE: DECIMAL_DIGITS;
: DECIMAL_DIGITS
;
FLOAT_LITERAL FLOAT_LITERAL: DIGIT+ EXPONENT? 'F' | DECIMAL_DIGITS EXPONENT? 'F';
: DIGIT+ EXPONENT? 'F'
| DECIMAL_DIGITS EXPONENT? 'F'
;
DOUBLE_LITERAL DOUBLE_LITERAL: DIGIT+ EXPONENT? 'D' | DECIMAL_DIGITS EXPONENT? 'D';
: DIGIT+ EXPONENT? 'D'
| DECIMAL_DIGITS EXPONENT? 'D'
;
BIGDECIMAL_LITERAL BIGDECIMAL_LITERAL: DIGIT+ EXPONENT? 'BD' | DECIMAL_DIGITS EXPONENT? 'BD';
: DIGIT+ EXPONENT? 'BD'
| DECIMAL_DIGITS EXPONENT? 'BD'
;
IDENTIFIER IDENTIFIER: (LETTER | DIGIT | '_')+;
: (LETTER | DIGIT | '_')+
;
BACKQUOTED_IDENTIFIER BACKQUOTED_IDENTIFIER: '`' ( ~'`' | '``')* '`';
: '`' ( ~'`' | '``' )* '`'
;
fragment DECIMAL_DIGITS fragment DECIMAL_DIGITS: DIGIT+ '.' DIGIT* | '.' DIGIT+;
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
fragment EXPONENT fragment EXPONENT: 'E' [+-]? DIGIT+;
: 'E' [+-]? DIGIT+
;
fragment DIGIT fragment DIGIT: [0-9];
: [0-9]
;
fragment LETTER fragment LETTER: [A-Za-z];
: [A-Za-z]
;
SIMPLE_COMMENT SIMPLE_COMMENT: '--' ('\\\n' | ~[\r\n])* '\r'? '\n'? -> channel(HIDDEN);
: '--' ('\\\n' | ~[\r\n])* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_COMMENT BRACKETED_COMMENT:
: '/*' ( BRACKETED_COMMENT | . )*? ('*/' | {this.markUnclosedComment();} EOF) -> channel(HIDDEN) '/*' (BRACKETED_COMMENT | .)*? ('*/' | {this.markUnclosedComment();} EOF) -> channel(HIDDEN);
;
WS WS: [ \r\n\t]+ -> channel(HIDDEN);
: [ \r\n\t]+ -> channel(HIDDEN)
;
// Catch-all for anything we can't recognize. // Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text // We use this to be able to ignore and recover all the text
// when splitting statements with DelimiterLexer // when splitting statements with DelimiterLexer
UNRECOGNIZED UNRECOGNIZED: .;
: .
;

View File

@ -18,16 +18,22 @@
* Reference: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4 * Reference: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4
*/ */
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
// $antlr-format spaceBeforeAssignmentOperators false, keepEmptyLinesAtTheStartOfBlocks true
parser grammar SparkSqlParser; parser grammar SparkSqlParser;
options { tokenVocab = SparkSqlLexer; } options {
tokenVocab=SparkSqlLexer;
}
program program
: singleStatement* EOF : singleStatement* EOF
; ;
singleStatement singleStatement
: statement SEMICOLON ? : statement SEMICOLON?
; ;
statement statement
@ -36,150 +42,117 @@ statement
| KW_USE dbSchemaName | KW_USE dbSchemaName
| KW_USE dbSchema dbSchemaName | KW_USE dbSchema dbSchemaName
| KW_SET KW_CATALOG (identifier | stringLit) | KW_SET KW_CATALOG (identifier | stringLit)
| KW_CREATE dbSchema (ifNotExists)? dbSchemaNameCreate | KW_CREATE dbSchema (ifNotExists)? dbSchemaNameCreate (
(commentSpec | commentSpec
locationSpec | | locationSpec
(KW_WITH (KW_DBPROPERTIES | KW_PROPERTIES) propertyList))* | (KW_WITH (KW_DBPROPERTIES | KW_PROPERTIES) propertyList)
| KW_ALTER dbSchema dbSchemaName )*
KW_SET (KW_DBPROPERTIES | KW_PROPERTIES) propertyList | KW_ALTER dbSchema dbSchemaName KW_SET (KW_DBPROPERTIES | KW_PROPERTIES) propertyList
| KW_ALTER dbSchema dbSchemaName | KW_ALTER dbSchema dbSchemaName KW_SET locationSpec
KW_SET locationSpec | KW_DROP dbSchema (ifExists)? dbSchemaName (KW_RESTRICT | KW_CASCADE)?
| KW_DROP dbSchema (ifExists)? dbSchemaName | KW_SHOW dbSchemas ((KW_FROM | KW_IN) multipartIdentifier)? (KW_LIKE? pattern=stringLit)?
(KW_RESTRICT | KW_CASCADE)? | createTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider? createTableClauses (
| KW_SHOW dbSchemas ((KW_FROM | KW_IN) multipartIdentifier)? KW_AS? query
(KW_LIKE? pattern=stringLit)? )?
| createTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider? | KW_CREATE KW_TABLE (ifNotExists)? target=tableNameCreate KW_LIKE source=tableName (
createTableClauses tableProvider
(KW_AS? query)? | rowFormat
| KW_CREATE KW_TABLE (ifNotExists)? target=tableNameCreate | createFileFormat
KW_LIKE source=tableName | locationSpec
(tableProvider | | (KW_TBLPROPERTIES tableProps=propertyList)
rowFormat | )*
createFileFormat | | replaceTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider? createTableClauses (
locationSpec | KW_AS? query
(KW_TBLPROPERTIES tableProps=propertyList))* )?
| replaceTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider? | KW_ANALYZE KW_TABLE tableName partitionSpec? KW_COMPUTE KW_STATISTICS (
createTableClauses KW_NOSCAN
(KW_AS? query)? | KW_FOR KW_COLUMNS columnNameSeq
| KW_ANALYZE KW_TABLE tableName partitionSpec? KW_COMPUTE KW_STATISTICS | KW_FOR KW_ALL KW_COLUMNS
(KW_NOSCAN | KW_FOR KW_COLUMNS columnNameSeq | KW_FOR KW_ALL KW_COLUMNS)? )?
| KW_ANALYZE KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? KW_COMPUTE KW_STATISTICS | KW_ANALYZE KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? KW_COMPUTE KW_STATISTICS (KW_NOSCAN)?
(KW_NOSCAN)? | KW_ALTER KW_TABLE tableName KW_ADD KW_COLUMN qualifiedColTypeWithPositionForAdd
| KW_ALTER KW_TABLE tableName | KW_ALTER KW_TABLE tableName KW_ADD KW_COLUMNS LEFT_PAREN qualifiedColTypeWithPositionSeqForAdd RIGHT_PAREN
KW_ADD KW_COLUMN qualifiedColTypeWithPositionForAdd | KW_ALTER KW_TABLE table=tableName KW_RENAME KW_COLUMN columnName KW_TO columnNameCreate
| KW_ALTER KW_TABLE tableName | KW_ALTER KW_TABLE tableName KW_DROP KW_COLUMN (ifExists)? columnName
KW_ADD KW_COLUMNS LEFT_PAREN qualifiedColTypeWithPositionSeqForAdd RIGHT_PAREN | KW_ALTER KW_TABLE tableName KW_DROP KW_COLUMNS (ifExists)? LEFT_PAREN columnNameSeq RIGHT_PAREN
| KW_ALTER KW_TABLE table=tableName | KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) KW_RENAME KW_TO multipartIdentifier
KW_RENAME KW_COLUMN columnName KW_TO columnNameCreate | KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) KW_SET KW_TBLPROPERTIES propertyList
| KW_ALTER KW_TABLE tableName | KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) KW_UNSET KW_TBLPROPERTIES (ifExists)? propertyList
KW_DROP KW_COLUMN (ifExists)? columnName | KW_ALTER KW_TABLE table=tableName (KW_ALTER | KW_CHANGE) KW_COLUMN? column=columnName alterColumnAction?
| KW_ALTER KW_TABLE tableName | KW_ALTER KW_TABLE table=tableName partitionSpec? KW_CHANGE KW_COLUMN? colName=columnName colType colPosition?
KW_DROP KW_COLUMNS (ifExists)? LEFT_PAREN columnNameSeq RIGHT_PAREN | KW_ALTER KW_TABLE table=tableName partitionSpec? KW_REPLACE KW_COLUMNS LEFT_PAREN qualifiedColTypeWithPositionSeqForReplace RIGHT_PAREN
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) | KW_ALTER KW_TABLE tableName (partitionSpec)? KW_SET KW_SERDE stringLit (
KW_RENAME KW_TO multipartIdentifier KW_WITH KW_SERDEPROPERTIES propertyList
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) )?
KW_SET KW_TBLPROPERTIES propertyList | KW_ALTER KW_TABLE tableName (partitionSpec)? KW_SET KW_SERDEPROPERTIES propertyList
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) | KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) KW_ADD (ifNotExists)? partitionSpecLocation+
KW_UNSET KW_TBLPROPERTIES (ifExists)? propertyList | KW_ALTER KW_TABLE tableName partitionSpec KW_RENAME KW_TO partitionSpec
| KW_ALTER KW_TABLE table=tableName | KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) KW_DROP (ifExists)? partitionSpec (
(KW_ALTER | KW_CHANGE) KW_COLUMN? column=columnName COMMA partitionSpec
alterColumnAction? )* KW_PURGE?
| KW_ALTER KW_TABLE table=tableName partitionSpec? | KW_ALTER KW_TABLE tableName (partitionSpec)? KW_SET locationSpec
KW_CHANGE KW_COLUMN?
colName=columnName colType colPosition?
| KW_ALTER KW_TABLE table=tableName partitionSpec?
KW_REPLACE KW_COLUMNS
LEFT_PAREN qualifiedColTypeWithPositionSeqForReplace
RIGHT_PAREN
| KW_ALTER KW_TABLE tableName (partitionSpec)?
KW_SET KW_SERDE stringLit (KW_WITH KW_SERDEPROPERTIES propertyList)?
| KW_ALTER KW_TABLE tableName (partitionSpec)?
KW_SET KW_SERDEPROPERTIES propertyList
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName) KW_ADD (ifNotExists)?
partitionSpecLocation+
| KW_ALTER KW_TABLE tableName
partitionSpec KW_RENAME KW_TO partitionSpec
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
KW_DROP (ifExists)? partitionSpec (COMMA partitionSpec)* KW_PURGE?
| KW_ALTER KW_TABLE tableName
(partitionSpec)? KW_SET locationSpec
| KW_ALTER KW_TABLE tableName KW_RECOVER KW_PARTITIONS | KW_ALTER KW_TABLE tableName KW_RECOVER KW_PARTITIONS
| KW_DROP KW_TABLE (ifExists)? tableName KW_PURGE? | KW_DROP KW_TABLE (ifExists)? tableName KW_PURGE?
| KW_DROP KW_VIEW (ifExists)? viewName | KW_DROP KW_VIEW (ifExists)? viewName
| KW_CREATE (KW_OR KW_REPLACE)? (KW_GLOBAL? KW_TEMPORARY)? | KW_CREATE (KW_OR KW_REPLACE)? (KW_GLOBAL? KW_TEMPORARY)? KW_VIEW (ifNotExists)? viewNameCreate identifierCommentList? (
KW_VIEW (ifNotExists)? viewNameCreate commentSpec
identifierCommentList? | (KW_PARTITIONED KW_ON identifierList)
(commentSpec | | (KW_TBLPROPERTIES propertyList)
(KW_PARTITIONED KW_ON identifierList) | )* KW_AS query
(KW_TBLPROPERTIES propertyList))* | KW_CREATE (KW_OR KW_REPLACE)? KW_GLOBAL? KW_TEMPORARY KW_VIEW viewNameCreate (
KW_AS query LEFT_PAREN colTypeList RIGHT_PAREN
| KW_CREATE (KW_OR KW_REPLACE)? KW_GLOBAL? KW_TEMPORARY KW_VIEW )? tableProvider (KW_OPTIONS propertyList)?
viewNameCreate (LEFT_PAREN colTypeList RIGHT_PAREN)? tableProvider
(KW_OPTIONS propertyList)?
| KW_ALTER KW_VIEW viewName KW_AS? query | KW_ALTER KW_VIEW viewName KW_AS? query
| KW_CREATE (KW_OR KW_REPLACE)? KW_TEMPORARY? KW_FUNCTION (ifNotExists)? | KW_CREATE (KW_OR KW_REPLACE)? KW_TEMPORARY? KW_FUNCTION (ifNotExists)? functionNameCreate KW_AS className=stringLit (
functionNameCreate KW_AS className=stringLit KW_USING resource (COMMA resource)*
(KW_USING resource (COMMA resource)*)? )?
| KW_DROP KW_TEMPORARY? KW_FUNCTION (ifExists)? functionName | KW_DROP KW_TEMPORARY? KW_FUNCTION (ifExists)? functionName
| KW_DECLARE (KW_OR KW_REPLACE)? KW_VARIABLE? | KW_DECLARE (KW_OR KW_REPLACE)? KW_VARIABLE? functionName dataType? variableDefaultExpression?
functionName dataType? variableDefaultExpression?
| KW_DROP KW_TEMPORARY KW_VARIABLE (ifExists)? (tableName | viewName | functionName) | KW_DROP KW_TEMPORARY KW_VARIABLE (ifExists)? (tableName | viewName | functionName)
| KW_EXPLAIN (KW_LOGICAL | KW_FORMATTED | KW_EXTENDED | KW_CODEGEN | KW_COST)? | KW_EXPLAIN (KW_LOGICAL | KW_FORMATTED | KW_EXTENDED | KW_CODEGEN | KW_COST)? statement
statement | KW_SHOW KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? (KW_LIKE? pattern=stringLit)?
| KW_SHOW KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? | KW_SHOW KW_TABLE KW_EXTENDED ((KW_FROM | KW_IN) ns=dbSchemaName)? KW_LIKE pattern=stringLit partitionSpec?
(KW_LIKE? pattern=stringLit)? | KW_SHOW KW_TBLPROPERTIES table=tableName (LEFT_PAREN key=propertyKey RIGHT_PAREN)?
| KW_SHOW KW_TABLE KW_EXTENDED ((KW_FROM | KW_IN) ns=dbSchemaName)? | KW_SHOW KW_COLUMNS (KW_FROM | KW_IN) table=tableName ((KW_FROM | KW_IN) dbSchemaName)?
KW_LIKE pattern=stringLit partitionSpec? | KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) dbSchemaName)? (KW_LIKE? pattern=stringLit)?
| KW_SHOW KW_TBLPROPERTIES table=tableName
(LEFT_PAREN key=propertyKey RIGHT_PAREN)?
| KW_SHOW KW_COLUMNS (KW_FROM | KW_IN) table=tableName
((KW_FROM | KW_IN) dbSchemaName)?
| KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) dbSchemaName)?
(KW_LIKE? pattern=stringLit)?
| KW_SHOW KW_PARTITIONS tableName partitionSpec? | KW_SHOW KW_PARTITIONS tableName partitionSpec?
| KW_SHOW functionKind? KW_FUNCTIONS ((KW_FROM | KW_IN) ns=dbSchemaName)? | KW_SHOW functionKind? KW_FUNCTIONS ((KW_FROM | KW_IN) ns=dbSchemaName)? (
(KW_LIKE? (legacy=multipartIdentifier | pattern=stringLit))? KW_LIKE? (legacy=multipartIdentifier | pattern=stringLit)
)?
| KW_SHOW KW_CREATE KW_TABLE tableName (KW_AS KW_SERDE)? | KW_SHOW KW_CREATE KW_TABLE tableName (KW_AS KW_SERDE)?
| KW_SHOW KW_CURRENT dbSchema | KW_SHOW KW_CURRENT dbSchema
| KW_SHOW KW_CATALOGS (KW_LIKE? pattern=stringLit)? | KW_SHOW KW_CATALOGS (KW_LIKE? pattern=stringLit)?
| (KW_DESC | KW_DESCRIBE) KW_FUNCTION KW_EXTENDED? describeFuncName | (KW_DESC | KW_DESCRIBE) KW_FUNCTION KW_EXTENDED? describeFuncName
| (KW_DESC | KW_DESCRIBE) KW_DATABASE KW_EXTENDED? dbSchemaName | (KW_DESC | KW_DESCRIBE) KW_DATABASE KW_EXTENDED? dbSchemaName
| (KW_DESC | KW_DESCRIBE) KW_TABLE? option=(KW_EXTENDED | KW_FORMATTED)? | (KW_DESC | KW_DESCRIBE) KW_TABLE? option=(KW_EXTENDED | KW_FORMATTED)? tableName partitionSpec? describeColName?
tableName partitionSpec? describeColName?
| (KW_DESC | KW_DESCRIBE) KW_QUERY? query | (KW_DESC | KW_DESCRIBE) KW_QUERY? query
| KW_COMMENT KW_ON dbSchema dbSchemaName KW_IS | KW_COMMENT KW_ON dbSchema dbSchemaName KW_IS comment
comment
| KW_COMMENT KW_ON KW_TABLE tableName KW_IS comment | KW_COMMENT KW_ON KW_TABLE tableName KW_IS comment
| KW_REFRESH KW_TABLE tableName | KW_REFRESH KW_TABLE tableName
| KW_REFRESH KW_FUNCTION functionName | KW_REFRESH KW_FUNCTION functionName
| KW_REFRESH (stringLit | .*?) | KW_REFRESH (stringLit | .*?)
| KW_CACHE KW_LAZY? KW_TABLE tableName | KW_CACHE KW_LAZY? KW_TABLE tableName (KW_OPTIONS options=propertyList)? (KW_AS? query)?
(KW_OPTIONS options=propertyList)? (KW_AS? query)?
| KW_UNCACHE KW_TABLE (ifExists)? tableName | KW_UNCACHE KW_TABLE (ifExists)? tableName
| KW_CLEAR KW_CACHE | KW_CLEAR KW_CACHE
| KW_LOAD KW_DATA KW_LOCAL? KW_INPATH path=stringLit KW_OVERWRITE? KW_INTO KW_TABLE | KW_LOAD KW_DATA KW_LOCAL? KW_INPATH path=stringLit KW_OVERWRITE? KW_INTO KW_TABLE tableName partitionSpec?
tableName partitionSpec?
| KW_TRUNCATE KW_TABLE tableName partitionSpec? | KW_TRUNCATE KW_TABLE tableName partitionSpec?
| (KW_MSCK)? KW_REPAIR KW_TABLE tableName | (KW_MSCK)? KW_REPAIR KW_TABLE tableName (option=(KW_ADD | KW_DROP | KW_SYNC) KW_PARTITIONS)?
(option=(KW_ADD|KW_DROP|KW_SYNC) KW_PARTITIONS)?
| op=(KW_ADD | KW_LIST) identifier .*? | op=(KW_ADD | KW_LIST) identifier .*?
| KW_SET KW_ROLE .*? | KW_SET KW_ROLE .*?
| KW_SET KW_TIME KW_ZONE interval | KW_SET KW_TIME KW_ZONE interval
| KW_SET KW_TIME KW_ZONE timezone | KW_SET KW_TIME KW_ZONE timezone
| KW_SET KW_TIME KW_ZONE .*? | KW_SET KW_TIME KW_ZONE .*?
| KW_SET (KW_VARIABLE | KW_VAR) assignmentList | KW_SET (KW_VARIABLE | KW_VAR) assignmentList
| KW_SET (KW_VARIABLE | KW_VAR) LEFT_PAREN multipartIdentifierList RIGHT_PAREN EQ | KW_SET (KW_VARIABLE | KW_VAR) LEFT_PAREN multipartIdentifierList RIGHT_PAREN EQ LEFT_PAREN query RIGHT_PAREN
LEFT_PAREN query RIGHT_PAREN
| KW_SET configKey EQ configValue | KW_SET configKey EQ configValue
| KW_SET configKey (EQ .*?)? | KW_SET configKey (EQ .*?)?
| KW_SET .*? EQ configValue | KW_SET .*? EQ configValue
| KW_SET .*? | KW_SET .*?
| KW_RESET configKey | KW_RESET configKey
| KW_RESET .*? | KW_RESET .*?
| KW_CREATE KW_INDEX (ifNotExists)? identifier KW_ON KW_TABLE? | KW_CREATE KW_INDEX (ifNotExists)? identifier KW_ON KW_TABLE? tableName (
tableName (KW_USING indexType=identifier)? KW_USING indexType=identifier
LEFT_PAREN multipartIdentifierPropertyList RIGHT_PAREN )? LEFT_PAREN multipartIdentifierPropertyList RIGHT_PAREN (KW_OPTIONS options=propertyList)?
(KW_OPTIONS options=propertyList)?
| KW_DROP KW_INDEX (ifExists)? identifier KW_ON KW_TABLE? tableName | KW_DROP KW_INDEX (ifExists)? identifier KW_ON KW_TABLE? tableName
| unsupportedHiveNativeCommands .*? | unsupportedHiveNativeCommands .*?
; ;
@ -253,15 +226,13 @@ replaceTableHeader
; ;
bucketSpec bucketSpec
: KW_CLUSTERED KW_BY identifierList : KW_CLUSTERED KW_BY identifierList (KW_SORTED KW_BY orderedIdentifierList)? KW_INTO INTEGER_VALUE KW_BUCKETS
(KW_SORTED KW_BY orderedIdentifierList)?
KW_INTO INTEGER_VALUE KW_BUCKETS
; ;
skewSpec skewSpec
: KW_SKEWED KW_BY identifierList : KW_SKEWED KW_BY identifierList KW_ON (constantList | nestedConstantList) (
KW_ON (constantList | nestedConstantList) KW_STORED KW_AS KW_DIRECTORIES
(KW_STORED KW_AS KW_DIRECTORIES)? )?
; ;
locationSpec locationSpec
@ -277,11 +248,19 @@ query
; ;
insertInto insertInto
: KW_INSERT KW_OVERWRITE KW_TABLE? tableName (partitionSpec (ifNotExists)?)? ((KW_BY KW_NAME) | (LEFT_PAREN columnNameSeq RIGHT_PAREN ))? : KW_INSERT KW_OVERWRITE KW_TABLE? tableName (partitionSpec (ifNotExists)?)? (
| KW_INSERT KW_INTO KW_TABLE? tableName partitionSpec? (ifNotExists)? ((KW_BY KW_NAME) | (LEFT_PAREN columnNameSeq RIGHT_PAREN ))? (KW_BY KW_NAME)
| (LEFT_PAREN columnNameSeq RIGHT_PAREN)
)?
| KW_INSERT KW_INTO KW_TABLE? tableName partitionSpec? (ifNotExists)? (
(KW_BY KW_NAME)
| (LEFT_PAREN columnNameSeq RIGHT_PAREN)
)?
| KW_INSERT KW_INTO KW_TABLE? tableName KW_REPLACE whereClause | KW_INSERT KW_INTO KW_TABLE? tableName KW_REPLACE whereClause
| KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY path=stringLit rowFormat? createFileFormat? | KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY path=stringLit rowFormat? createFileFormat?
| KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY (path=stringLit)? tableProvider (KW_OPTIONS options=propertyList)? | KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY (path=stringLit)? tableProvider (
KW_OPTIONS options=propertyList
)?
; ;
partitionSpecLocation partitionSpecLocation
@ -334,15 +313,17 @@ tableProvider
; ;
createTableClauses createTableClauses
:((KW_OPTIONS options=expressionPropertyList) | : (
(KW_PARTITIONED KW_BY partitioning=partitionFieldList) | (KW_OPTIONS options=expressionPropertyList)
skewSpec | | (KW_PARTITIONED KW_BY partitioning=partitionFieldList)
bucketSpec | | skewSpec
rowFormat | | bucketSpec
createFileFormat | | rowFormat
locationSpec | | createFileFormat
commentSpec | | locationSpec
(KW_TBLPROPERTIES tableProps=propertyList))* | commentSpec
| (KW_TBLPROPERTIES tableProps=propertyList)
)*
; ;
propertyList propertyList
@ -404,32 +385,47 @@ dmlStatementNoWith
| fromClause multiInsertQueryBody+ | fromClause multiInsertQueryBody+
| KW_DELETE KW_FROM tableName tableAlias whereClause? | KW_DELETE KW_FROM tableName tableAlias whereClause?
| KW_UPDATE tableName tableAlias setClause whereClause? | KW_UPDATE tableName tableAlias setClause whereClause?
| KW_MERGE KW_INTO target=tableName targetAlias=tableAlias | KW_MERGE KW_INTO target=tableName targetAlias=tableAlias KW_USING (
KW_USING (source=identifierReference | source=identifierReference
LEFT_PAREN sourceQuery=query RIGHT_PAREN) sourceAlias=tableAlias | LEFT_PAREN sourceQuery=query RIGHT_PAREN
KW_ON mergeCondition=booleanExpression ) sourceAlias=tableAlias KW_ON mergeCondition=booleanExpression matchedClause* notMatchedClause* notMatchedBySourceClause*
matchedClause*
notMatchedClause*
notMatchedBySourceClause*
; ;
dbSchemaName: identifierReference; dbSchemaName
: identifierReference
;
dbSchemaNameCreate: identifierReference; dbSchemaNameCreate
: identifierReference
;
tableNameCreate: tableIdentifier; tableNameCreate
: tableIdentifier
;
tableName: tableIdentifier; tableName
: tableIdentifier
;
viewNameCreate: viewIdentifier; viewNameCreate
: viewIdentifier
;
viewName: viewIdentifier; viewName
: viewIdentifier
;
columnName: multipartIdentifier; columnName
: multipartIdentifier
;
columnNameSeq: columnName (COMMA columnName)* ; columnNameSeq
: columnName (COMMA columnName)*
;
columnNameCreate: errorCapturingIdentifier; columnNameCreate
: errorCapturingIdentifier
;
identifierReference identifierReference
: KW_IDENTIFIER LEFT_PAREN expression RIGHT_PAREN : KW_IDENTIFIER LEFT_PAREN expression RIGHT_PAREN
@ -437,13 +433,11 @@ identifierReference
; ;
queryOrganization queryOrganization
: (KW_ORDER KW_BY order+=sortItem (COMMA order+=sortItem)*)? : (KW_ORDER KW_BY order+=sortItem (COMMA order+=sortItem)*)? (
(KW_CLUSTER KW_BY clusterBy+=expression (COMMA clusterBy+=expression)*)? KW_CLUSTER KW_BY clusterBy+=expression (COMMA clusterBy+=expression)*
(KW_DISTRIBUTE KW_BY distributeBy+=expression (COMMA distributeBy+=expression)*)? )? (KW_DISTRIBUTE KW_BY distributeBy+=expression (COMMA distributeBy+=expression)*)? (
(KW_SORT KW_BY sort+=sortItem (COMMA sort+=sortItem)*)? KW_SORT KW_BY sort+=sortItem (COMMA sort+=sortItem)*
windowClause? )? windowClause? (KW_LIMIT (KW_ALL | limit=expression))? (KW_OFFSET offset=expression)?
(KW_LIMIT (KW_ALL | limit=expression))?
(KW_OFFSET offset=expression)?
; ;
multiInsertQueryBody multiInsertQueryBody
@ -452,12 +446,9 @@ multiInsertQueryBody
queryTerm queryTerm
: queryPrimary : queryPrimary
| left=queryTerm | left=queryTerm operator=(KW_INTERSECT | KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
operator=(KW_INTERSECT | KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm | left=queryTerm operator=KW_INTERSECT setQuantifier? right=queryTerm
| left=queryTerm | left=queryTerm operator=(KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
operator=KW_INTERSECT setQuantifier? right=queryTerm
| left=queryTerm
operator=(KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
; ;
queryPrimary queryPrimary
@ -469,7 +460,9 @@ queryPrimary
; ;
sortItem sortItem
: (columnName | expression) ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrder=(KW_LAST | KW_FIRST))? : (columnName | expression) ordering=(KW_ASC | KW_DESC)? (
KW_NULLS nullOrder=(KW_LAST | KW_FIRST)
)?
; ;
fromStatement fromStatement
@ -477,45 +470,27 @@ fromStatement
; ;
fromStatementBody fromStatementBody
: transformClause : transformClause whereClause? queryOrganization
whereClause? | selectClause lateralView* whereClause? aggregationClause? havingClause? windowClause? queryOrganization
queryOrganization
| selectClause
lateralView*
whereClause?
aggregationClause?
havingClause?
windowClause?
queryOrganization
; ;
querySpecification querySpecification
: transformClause : transformClause fromClause? lateralView* whereClause? aggregationClause? havingClause? windowClause?
fromClause? | selectClause fromClause? lateralView* whereClause? aggregationClause? havingClause? windowClause?
lateralView*
whereClause?
aggregationClause?
havingClause?
windowClause?
| selectClause
fromClause?
lateralView*
whereClause?
aggregationClause?
havingClause?
windowClause?
; ;
transformClause transformClause
: (KW_SELECT kind=KW_TRANSFORM LEFT_PAREN setQuantifier? expressionSeq RIGHT_PAREN : (
KW_SELECT kind=KW_TRANSFORM LEFT_PAREN setQuantifier? expressionSeq RIGHT_PAREN
| kind=KW_MAP setQuantifier? expressionSeq | kind=KW_MAP setQuantifier? expressionSeq
| kind=KW_REDUCE setQuantifier? expressionSeq) | kind=KW_REDUCE setQuantifier? expressionSeq
inRowFormat=rowFormat? ) inRowFormat=rowFormat? (KW_RECORDWRITER recordWriter=stringLit)? KW_USING script=stringLit (
(KW_RECORDWRITER recordWriter=stringLit)? KW_AS (
KW_USING script=stringLit identifierSeq
(KW_AS (identifierSeq | colTypeList | (LEFT_PAREN (identifierSeq | colTypeList) RIGHT_PAREN)))? | colTypeList
outRowFormat=rowFormat? | (LEFT_PAREN (identifierSeq | colTypeList) RIGHT_PAREN)
(KW_RECORDREADER recordReader=stringLit)? )
)? outRowFormat=rowFormat? (KW_RECORDREADER recordReader=stringLit)?
; ;
selectClause selectClause
@ -529,6 +504,7 @@ setClause
matchedClause matchedClause
: KW_WHEN KW_MATCHED (KW_AND matchedCond=booleanExpression)? KW_THEN matchedAction : KW_WHEN KW_MATCHED (KW_AND matchedCond=booleanExpression)? KW_THEN matchedAction
; ;
notMatchedClause notMatchedClause
: KW_WHEN KW_NOT KW_MATCHED (KW_BY KW_TARGET)? (KW_AND notMatchedCond=booleanExpression)? KW_THEN notMatchedAction : KW_WHEN KW_NOT KW_MATCHED (KW_BY KW_TARGET)? (KW_AND notMatchedCond=booleanExpression)? KW_THEN notMatchedAction
; ;
@ -545,8 +521,9 @@ matchedAction
notMatchedAction notMatchedAction
: KW_INSERT ASTERISK : KW_INSERT ASTERISK
| KW_INSERT LEFT_PAREN multipartIdentifierList RIGHT_PAREN | KW_INSERT LEFT_PAREN multipartIdentifierList RIGHT_PAREN KW_VALUES LEFT_PAREN expression (
KW_VALUES LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN COMMA expression
)* RIGHT_PAREN
; ;
notMatchedBySourceAction notMatchedBySourceAction
@ -576,7 +553,9 @@ hint
hintStatement hintStatement
: hintName=identifier : hintName=identifier
| hintName=identifier LEFT_PAREN parameters+=primaryExpression (COMMA parameters+=primaryExpression)* RIGHT_PAREN | hintName=identifier LEFT_PAREN parameters+=primaryExpression (
COMMA parameters+=primaryExpression
)* RIGHT_PAREN
; ;
fromClause fromClause
@ -584,7 +563,9 @@ fromClause
; ;
functionKind functionKind
: KW_USER | KW_SYSTEM | KW_ALL : KW_USER
| KW_SYSTEM
| KW_ALL
; ;
temporalClause temporalClause
@ -593,12 +574,14 @@ temporalClause
; ;
aggregationClause aggregationClause
: KW_GROUP KW_BY groupingExpressionsWithGroupingAnalytics+=groupByClause : KW_GROUP KW_BY groupingExpressionsWithGroupingAnalytics+=groupByClause (
(COMMA groupingExpressionsWithGroupingAnalytics+=groupByClause)* COMMA groupingExpressionsWithGroupingAnalytics+=groupByClause
)*
| KW_GROUP KW_BY groupingExpressions+=expression (COMMA groupingExpressions+=expression)* ( | KW_GROUP KW_BY groupingExpressions+=expression (COMMA groupingExpressions+=expression)* (
KW_WITH kind=KW_ROLLUP KW_WITH kind=KW_ROLLUP
| KW_WITH kind=KW_CUBE | KW_WITH kind=KW_CUBE
| kind=KW_GROUPING KW_SETS LEFT_PAREN groupingSet (COMMA groupingSet)* RIGHT_PAREN)? | kind=KW_GROUPING KW_SETS LEFT_PAREN groupingSet (COMMA groupingSet)* RIGHT_PAREN
)?
; ;
groupByClause groupByClause
@ -624,7 +607,9 @@ groupingSet
; ;
pivotClause pivotClause
: KW_PIVOT LEFT_PAREN aggregates=namedExpressionSeq KW_FOR pivotColumn KW_IN LEFT_PAREN pivotValues+=pivotValue (COMMA pivotValues+=pivotValue)* RIGHT_PAREN RIGHT_PAREN : KW_PIVOT LEFT_PAREN aggregates=namedExpressionSeq KW_FOR pivotColumn KW_IN LEFT_PAREN pivotValues+=pivotValue (
COMMA pivotValues+=pivotValue
)* RIGHT_PAREN RIGHT_PAREN
; ;
pivotColumn pivotColumn
@ -637,9 +622,9 @@ pivotValue
; ;
unpivotClause unpivotClause
: KW_UNPIVOT nullOperator=unpivotNullClause? LEFT_PAREN : KW_UNPIVOT nullOperator=unpivotNullClause? LEFT_PAREN operator=unpivotOperator RIGHT_PAREN (
operator=unpivotOperator KW_AS? identifier
RIGHT_PAREN (KW_AS? identifier)? )?
; ;
unpivotNullClause unpivotNullClause
@ -651,13 +636,17 @@ unpivotOperator
; ;
unpivotSingleValueColumnClause unpivotSingleValueColumnClause
: unpivotValueColumn KW_FOR unpivotNameColumn KW_IN LEFT_PAREN unpivotColumns+=unpivotColumnAndAlias (COMMA unpivotColumns+=unpivotColumnAndAlias)* RIGHT_PAREN : unpivotValueColumn KW_FOR unpivotNameColumn KW_IN LEFT_PAREN unpivotColumns+=unpivotColumnAndAlias (
COMMA unpivotColumns+=unpivotColumnAndAlias
)* RIGHT_PAREN
; ;
unpivotMultiValueColumnClause unpivotMultiValueColumnClause
: LEFT_PAREN unpivotValueColumns+=unpivotValueColumn (COMMA unpivotValueColumns+=unpivotValueColumn)* RIGHT_PAREN : LEFT_PAREN unpivotValueColumns+=unpivotValueColumn (
KW_FOR unpivotNameColumn COMMA unpivotValueColumns+=unpivotValueColumn
KW_IN LEFT_PAREN unpivotColumnSets+=unpivotColumnSet (COMMA unpivotColumnSets+=unpivotColumnSet)* RIGHT_PAREN )* RIGHT_PAREN KW_FOR unpivotNameColumn KW_IN LEFT_PAREN unpivotColumnSets+=unpivotColumnSet (
COMMA unpivotColumnSets+=unpivotColumnSet
)* RIGHT_PAREN
; ;
unpivotColumnSet unpivotColumnSet
@ -685,13 +674,17 @@ unpivotAlias
; ;
ifNotExists ifNotExists
: KW_IF KW_NOT KW_EXISTS; : KW_IF KW_NOT KW_EXISTS
;
ifExists ifExists
: KW_IF KW_EXISTS; : KW_IF KW_EXISTS
;
lateralView lateralView
: KW_LATERAL KW_VIEW (KW_OUTER)? viewName LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN tableAlias (KW_AS? colName+=identifier (COMMA colName+=identifier)*)? : KW_LATERAL KW_VIEW (KW_OUTER)? viewName LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN tableAlias (
KW_AS? colName+=identifier (COMMA colName+=identifier)*
)?
; ;
setQuantifier setQuantifier
@ -731,14 +724,17 @@ joinCriteria
; ;
sample sample
: KW_TABLESAMPLE LEFT_PAREN sampleMethod? RIGHT_PAREN (KW_REPEATABLE LEFT_PAREN seed=INTEGER_VALUE RIGHT_PAREN)? : KW_TABLESAMPLE LEFT_PAREN sampleMethod? RIGHT_PAREN (
KW_REPEATABLE LEFT_PAREN seed=INTEGER_VALUE RIGHT_PAREN
)?
; ;
sampleMethod sampleMethod
: negativeSign=MINUS? percentage=(INTEGER_VALUE | DECIMAL_VALUE) KW_PERCENTLIT : negativeSign=MINUS? percentage=(INTEGER_VALUE | DECIMAL_VALUE) KW_PERCENTLIT
| expression KW_ROWS | expression KW_ROWS
| sampleType=KW_BUCKET numerator=INTEGER_VALUE KW_OUT KW_OF denominator=INTEGER_VALUE | sampleType=KW_BUCKET numerator=INTEGER_VALUE KW_OUT KW_OF denominator=INTEGER_VALUE (
(KW_ON (identifier | qualifiedName LEFT_PAREN RIGHT_PAREN))? KW_ON (identifier | qualifiedName LEFT_PAREN RIGHT_PAREN)
)?
| bytes=expression | bytes=expression
; ;
@ -767,8 +763,7 @@ identifierComment
; ;
relationPrimary relationPrimary
: identifierReference temporalClause? : identifierReference temporalClause? sample? tableAlias
sample? tableAlias
| LEFT_PAREN query RIGHT_PAREN sample? tableAlias | LEFT_PAREN query RIGHT_PAREN sample? tableAlias
| LEFT_PAREN relation RIGHT_PAREN sample? tableAlias | LEFT_PAREN relation RIGHT_PAREN sample? tableAlias
| inlineTable | inlineTable
@ -786,13 +781,19 @@ functionTableSubqueryArgument
; ;
tableArgumentPartitioning tableArgumentPartitioning
: ((KW_WITH KW_SINGLE KW_PARTITION) : (
| ((KW_PARTITION | KW_DISTRIBUTE) KW_BY (KW_WITH KW_SINGLE KW_PARTITION)
(((LEFT_PAREN partition+=expression (COMMA partition+=expression)* RIGHT_PAREN)) | (
| partition+=expression))) (KW_PARTITION | KW_DISTRIBUTE) KW_BY (
((KW_ORDER | KW_SORT) KW_BY ((LEFT_PAREN partition+=expression (COMMA partition+=expression)* RIGHT_PAREN))
(((LEFT_PAREN sortItem (COMMA sortItem)* RIGHT_PAREN) | partition+=expression
| sortItem)))? )
)
) (
(KW_ORDER | KW_SORT) KW_BY (
((LEFT_PAREN sortItem (COMMA sortItem)* RIGHT_PAREN) | sortItem)
)
)?
; ;
functionTableNamedArgumentExpression functionTableNamedArgumentExpression
@ -810,9 +811,7 @@ functionTableArgument
; ;
functionTable functionTable
: functionName LEFT_PAREN : functionName LEFT_PAREN (functionTableArgument (COMMA functionTableArgument)*)? RIGHT_PAREN tableAlias
(functionTableArgument (COMMA functionTableArgument)*)?
RIGHT_PAREN tableAlias
; ;
tableAlias tableAlias
@ -821,12 +820,15 @@ tableAlias
rowFormat rowFormat
: KW_ROW KW_FORMAT KW_SERDE name=stringLit (KW_WITH KW_SERDEPROPERTIES props=propertyList)? : KW_ROW KW_FORMAT KW_SERDE name=stringLit (KW_WITH KW_SERDEPROPERTIES props=propertyList)?
| KW_ROW KW_FORMAT KW_DELIMITED | KW_ROW KW_FORMAT KW_DELIMITED (
(KW_FIELDS KW_TERMINATED KW_BY fieldsTerminatedBy=stringLit (KW_ESCAPED KW_BY escapedBy=stringLit)?)? KW_FIELDS KW_TERMINATED KW_BY fieldsTerminatedBy=stringLit (
(KW_COLLECTION KW_ITEMS KW_TERMINATED KW_BY collectionItemsTerminatedBy=stringLit)? KW_ESCAPED KW_BY escapedBy=stringLit
(KW_MAP KW_KEYS KW_TERMINATED KW_BY keysTerminatedBy=stringLit)? )?
(KW_LINES KW_TERMINATED KW_BY linesSeparatedBy=stringLit)? )? (KW_COLLECTION KW_ITEMS KW_TERMINATED KW_BY collectionItemsTerminatedBy=stringLit)? (
(KW_NULL KW_DEFINED KW_AS nullDefinedAs=stringLit)? KW_MAP KW_KEYS KW_TERMINATED KW_BY keysTerminatedBy=stringLit
)? (KW_LINES KW_TERMINATED KW_BY linesSeparatedBy=stringLit)? (
KW_NULL KW_DEFINED KW_AS nullDefinedAs=stringLit
)?
; ;
multipartIdentifierList multipartIdentifierList
@ -872,8 +874,7 @@ partitionField
transform transform
: qualifiedName : qualifiedName
| transformName=identifier | transformName=identifier LEFT_PAREN transformArgument (COMMA transformArgument)* RIGHT_PAREN
LEFT_PAREN transformArgument (COMMA transformArgument)* RIGHT_PAREN
; ;
transformArgument transformArgument
@ -911,7 +912,10 @@ predicate
| KW_NOT? kind=KW_IN LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN | KW_NOT? kind=KW_IN LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN
| KW_NOT? kind=KW_IN LEFT_PAREN query RIGHT_PAREN | KW_NOT? kind=KW_IN LEFT_PAREN query RIGHT_PAREN
| KW_NOT? kind=(KW_RLIKE | KW_REGEXP) pattern=valueExpression | KW_NOT? kind=(KW_RLIKE | KW_REGEXP) pattern=valueExpression
| KW_NOT? kind=(KW_LIKE | KW_ILIKE) quantifier=(KW_ANY | KW_SOME | KW_ALL) (LEFT_PAREN RIGHT_PAREN | LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN) | KW_NOT? kind=(KW_LIKE | KW_ILIKE) quantifier=(KW_ANY | KW_SOME | KW_ALL) (
LEFT_PAREN RIGHT_PAREN
| LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN
)
| KW_NOT? kind=(KW_LIKE | KW_ILIKE) pattern=valueExpression (KW_ESCAPE escapeChar=stringLit)? | KW_NOT? kind=(KW_LIKE | KW_ILIKE) pattern=valueExpression (KW_ESCAPE escapeChar=stringLit)?
| KW_IS KW_NOT? kind=KW_NULL | KW_IS KW_NOT? kind=KW_NULL
| KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE | KW_UNKNOWN) | KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE | KW_UNKNOWN)
@ -930,15 +934,29 @@ valueExpression
; ;
datetimeUnit datetimeUnit
: KW_YEAR | KW_QUARTER | KW_MONTH : KW_YEAR
| KW_WEEK | KW_DAY | KW_DAYOFYEAR | KW_QUARTER
| KW_HOUR | KW_MINUTE | KW_SECOND | KW_MILLISECOND | KW_MICROSECOND | KW_MONTH
| KW_WEEK
| KW_DAY
| KW_DAYOFYEAR
| KW_HOUR
| KW_MINUTE
| KW_SECOND
| KW_MILLISECOND
| KW_MICROSECOND
; ;
primaryExpression primaryExpression
: name=(KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP | KW_CURRENT_USER | KW_USER | KW_SESSION_USER) : name=(KW_CURRENT_DATE | KW_CURRENT_TIMESTAMP | KW_CURRENT_USER | KW_USER | KW_SESSION_USER)
| name=(KW_TIMESTAMPADD | KW_DATEADD | KW_DATE_ADD) LEFT_PAREN (unit=datetimeUnit | invalidUnit=stringLit) COMMA unitsAmount=valueExpression COMMA timestamp=valueExpression RIGHT_PAREN | name=(KW_TIMESTAMPADD | KW_DATEADD | KW_DATE_ADD) LEFT_PAREN (
| name=(KW_TIMESTAMPDIFF | KW_DATEDIFF | KW_DATE_DIFF | KW_TIMEDIFF) LEFT_PAREN (unit=datetimeUnit | invalidUnit=stringLit) COMMA startTimestamp=valueExpression COMMA endTimestamp=valueExpression RIGHT_PAREN unit=datetimeUnit
| invalidUnit=stringLit
) COMMA unitsAmount=valueExpression COMMA timestamp=valueExpression RIGHT_PAREN
| name=(KW_TIMESTAMPDIFF | KW_DATEDIFF | KW_DATE_DIFF | KW_TIMEDIFF) LEFT_PAREN (
unit=datetimeUnit
| invalidUnit=stringLit
) COMMA startTimestamp=valueExpression COMMA endTimestamp=valueExpression RIGHT_PAREN
| KW_CASE whenClause+ (KW_ELSE elseExpression=expression)? KW_END | KW_CASE whenClause+ (KW_ELSE elseExpression=expression)? KW_END
| KW_CASE expression whenClause+ (KW_ELSE elseExpression=expression)? KW_END | KW_CASE expression whenClause+ (KW_ELSE elseExpression=expression)? KW_END
| name=(KW_CAST | KW_TRY_CAST) LEFT_PAREN expression KW_AS dataType RIGHT_PAREN | name=(KW_CAST | KW_TRY_CAST) LEFT_PAREN expression KW_AS dataType RIGHT_PAREN
@ -953,10 +971,9 @@ primaryExpression
| LEFT_PAREN namedExpression (COMMA namedExpression)+ RIGHT_PAREN | LEFT_PAREN namedExpression (COMMA namedExpression)+ RIGHT_PAREN
| LEFT_PAREN query RIGHT_PAREN | LEFT_PAREN query RIGHT_PAREN
| KW_IDENTIFIER LEFT_PAREN expression RIGHT_PAREN | KW_IDENTIFIER LEFT_PAREN expression RIGHT_PAREN
| functionName LEFT_PAREN (setQuantifier? functionArgument | functionName LEFT_PAREN (setQuantifier? functionArgument (COMMA functionArgument)*)? RIGHT_PAREN (
(COMMA functionArgument)*)? RIGHT_PAREN KW_FILTER LEFT_PAREN KW_WHERE where=booleanExpression RIGHT_PAREN
(KW_FILTER LEFT_PAREN KW_WHERE where=booleanExpression RIGHT_PAREN)? )? (nullsOption=(KW_IGNORE | KW_RESPECT) KW_NULLS)? (KW_OVER windowSpec)?
(nullsOption=(KW_IGNORE | KW_RESPECT) KW_NULLS)? ( KW_OVER windowSpec)?
| identifier ARROW expression | identifier ARROW expression
| LEFT_PAREN identifier (COMMA identifier)+ RIGHT_PAREN ARROW expression | LEFT_PAREN identifier (COMMA identifier)+ RIGHT_PAREN ARROW expression
| value=primaryExpression LEFT_BRACKET index=valueExpression RIGHT_BRACKET | value=primaryExpression LEFT_BRACKET index=valueExpression RIGHT_BRACKET
@ -964,20 +981,26 @@ primaryExpression
| base=primaryExpression DOT fieldName=identifier | base=primaryExpression DOT fieldName=identifier
| LEFT_PAREN expression RIGHT_PAREN | LEFT_PAREN expression RIGHT_PAREN
| KW_EXTRACT LEFT_PAREN field=identifier KW_FROM source=valueExpression RIGHT_PAREN | KW_EXTRACT LEFT_PAREN field=identifier KW_FROM source=valueExpression RIGHT_PAREN
| (KW_SUBSTR | KW_SUBSTRING) LEFT_PAREN str=valueExpression (KW_FROM | COMMA) pos=valueExpression | (KW_SUBSTR | KW_SUBSTRING) LEFT_PAREN str=valueExpression (KW_FROM | COMMA) pos=valueExpression (
((KW_FOR | COMMA) len=valueExpression)? RIGHT_PAREN (KW_FOR | COMMA) len=valueExpression
| KW_TRIM LEFT_PAREN trimOption=(KW_BOTH | KW_LEADING | KW_TRAILING)? (trimStr=valueExpression)? )? RIGHT_PAREN
KW_FROM srcStr=valueExpression RIGHT_PAREN | KW_TRIM LEFT_PAREN trimOption=(KW_BOTH | KW_LEADING | KW_TRAILING)? (
| KW_OVERLAY LEFT_PAREN input=valueExpression KW_PLACING replace=valueExpression trimStr=valueExpression
KW_FROM position=valueExpression (KW_FOR length=valueExpression)? RIGHT_PAREN )? KW_FROM srcStr=valueExpression RIGHT_PAREN
| name=(KW_PERCENTILE_CONT | KW_PERCENTILE_DISC) LEFT_PAREN percentage=valueExpression RIGHT_PAREN | KW_OVERLAY LEFT_PAREN input=valueExpression KW_PLACING replace=valueExpression KW_FROM position=valueExpression (
KW_WITHIN KW_GROUP LEFT_PAREN KW_ORDER KW_BY sortItem RIGHT_PAREN KW_FOR length=valueExpression
(KW_FILTER LEFT_PAREN KW_WHERE where=booleanExpression RIGHT_PAREN)? ( KW_OVER windowSpec)? )? RIGHT_PAREN
| name=(KW_PERCENTILE_CONT | KW_PERCENTILE_DISC) LEFT_PAREN percentage=valueExpression RIGHT_PAREN KW_WITHIN KW_GROUP LEFT_PAREN KW_ORDER KW_BY
sortItem RIGHT_PAREN (KW_FILTER LEFT_PAREN KW_WHERE where=booleanExpression RIGHT_PAREN)? (
KW_OVER windowSpec
)?
; ;
literalType literalType
: KW_DATE : KW_DATE
| KW_TIMESTAMP | KW_TIMESTAMP_LTZ | KW_TIMESTAMP_NTZ | KW_TIMESTAMP
| KW_TIMESTAMP_LTZ
| KW_TIMESTAMP_NTZ
| KW_INTERVAL | KW_INTERVAL
| KW_BINARY_HEX | KW_BINARY_HEX
| unsupportedType=identifier | unsupportedType=identifier
@ -995,19 +1018,40 @@ constant
; ;
comparisonOperator comparisonOperator
: EQ | NEQ | NEQJ | LT | LTE | GT | GTE | NSEQ : EQ
| NEQ
| NEQJ
| LT
| LTE
| GT
| GTE
| NSEQ
; ;
arithmeticOperator arithmeticOperator
: PLUS | MINUS | ASTERISK | SLASH | PERCENT | KW_DIV | TILDE | AMPERSAND | PIPE | CONCAT_PIPE | HAT : PLUS
| MINUS
| ASTERISK
| SLASH
| PERCENT
| KW_DIV
| TILDE
| AMPERSAND
| PIPE
| CONCAT_PIPE
| HAT
; ;
predicateOperator predicateOperator
: KW_OR | KW_AND | KW_IN | KW_NOT : KW_OR
| KW_AND
| KW_IN
| KW_NOT
; ;
booleanValue booleanValue
: KW_TRUE | KW_FALSE : KW_TRUE
| KW_FALSE
; ;
interval interval
@ -1031,42 +1075,76 @@ unitToUnitInterval
; ;
intervalValue intervalValue
: (PLUS | MINUS)? : (PLUS | MINUS)? (INTEGER_VALUE | DECIMAL_VALUE | stringLit)
(INTEGER_VALUE | DECIMAL_VALUE | stringLit)
; ;
unitInMultiUnits unitInMultiUnits
: KW_NANOSECOND | KW_NANOSECONDS | KW_MICROSECOND | KW_MICROSECONDS | KW_MILLISECOND | KW_MILLISECONDS : KW_NANOSECOND
| KW_SECOND | KW_SECONDS | KW_MINUTE | KW_MINUTES | KW_HOUR | KW_HOURS | KW_DAY | KW_DAYS | KW_WEEK | KW_WEEKS | KW_NANOSECONDS
| KW_MONTH | KW_MONTHS | KW_YEAR | KW_YEARS | KW_MICROSECOND
| KW_MICROSECONDS
| KW_MILLISECOND
| KW_MILLISECONDS
| KW_SECOND
| KW_SECONDS
| KW_MINUTE
| KW_MINUTES
| KW_HOUR
| KW_HOURS
| KW_DAY
| KW_DAYS
| KW_WEEK
| KW_WEEKS
| KW_MONTH
| KW_MONTHS
| KW_YEAR
| KW_YEARS
; ;
unitInUnitToUnit unitInUnitToUnit
: KW_SECOND | KW_MINUTE | KW_HOUR | KW_DAY | KW_MONTH | KW_YEAR : KW_SECOND
| KW_MINUTE
| KW_HOUR
| KW_DAY
| KW_MONTH
| KW_YEAR
; ;
colPosition colPosition
: position=KW_FIRST | position=KW_AFTER afterCol=errorCapturingIdentifier : position=KW_FIRST
| position=KW_AFTER afterCol=errorCapturingIdentifier
; ;
type type
: KW_BOOLEAN : KW_BOOLEAN
| KW_TINYINT | KW_BYTE | KW_TINYINT
| KW_SMALLINT | KW_SHORT | KW_BYTE
| KW_INT | KW_INTEGER | KW_SMALLINT
| KW_BIGINT | KW_LONG | KW_SHORT
| KW_FLOAT | KW_REAL | KW_INT
| KW_INTEGER
| KW_BIGINT
| KW_LONG
| KW_FLOAT
| KW_REAL
| KW_DOUBLE | KW_DOUBLE
| KW_DATE | KW_DATE
| KW_TIMESTAMP | KW_TIMESTAMP_NTZ | KW_TIMESTAMP_LTZ | KW_TIMESTAMP
| KW_TIMESTAMP_NTZ
| KW_TIMESTAMP_LTZ
| KW_STRING | KW_STRING
| KW_CHARACTER | KW_CHAR | KW_CHARACTER
| KW_CHAR
| KW_VARCHAR | KW_VARCHAR
| KW_BINARY | KW_BINARY
| KW_DECIMAL | KW_DEC | KW_NUMERIC | KW_DECIMAL
| KW_DEC
| KW_NUMERIC
| KW_VOID | KW_VOID
| KW_INTERVAL | KW_INTERVAL
| KW_ARRAY | KW_STRUCT | KW_MAP | KW_ARRAY
| KW_STRUCT
| KW_MAP
| unsupportedType=identifier | unsupportedType=identifier
; ;
@ -1075,10 +1153,10 @@ dataType
| complex=KW_MAP LT dataType COMMA dataType GT | complex=KW_MAP LT dataType COMMA dataType GT
| complex=KW_STRUCT (LT complexColTypeList? GT | NEQ) | complex=KW_STRUCT (LT complexColTypeList? GT | NEQ)
| KW_INTERVAL (KW_YEAR | KW_MONTH) (KW_TO KW_MONTH)? | KW_INTERVAL (KW_YEAR | KW_MONTH) (KW_TO KW_MONTH)?
| KW_INTERVAL (KW_DAY | KW_HOUR | KW_MINUTE | KW_SECOND) | KW_INTERVAL (KW_DAY | KW_HOUR | KW_MINUTE | KW_SECOND) (
(KW_TO (KW_HOUR | KW_MINUTE | KW_SECOND))? KW_TO (KW_HOUR | KW_MINUTE | KW_SECOND)
| type (LEFT_PAREN INTEGER_VALUE )?
(COMMA INTEGER_VALUE)* RIGHT_PAREN)? | type (LEFT_PAREN INTEGER_VALUE (COMMA INTEGER_VALUE)* RIGHT_PAREN)?
; ;
qualifiedColTypeWithPositionSeqForAdd qualifiedColTypeWithPositionSeqForAdd
@ -1097,7 +1175,6 @@ qualifiedColTypeWithPositionForReplace
: name=columnName dataType colDefinitionDescriptorWithPosition* : name=columnName dataType colDefinitionDescriptorWithPosition*
; ;
colDefinitionDescriptorWithPosition colDefinitionDescriptorWithPosition
: KW_NOT KW_NULL : KW_NOT KW_NULL
| defaultExpression | defaultExpression
@ -1163,12 +1240,14 @@ namedWindow
windowSpec windowSpec
: name=errorCapturingIdentifier : name=errorCapturingIdentifier
| LEFT_PAREN name=errorCapturingIdentifier RIGHT_PAREN | LEFT_PAREN name=errorCapturingIdentifier RIGHT_PAREN
| LEFT_PAREN | LEFT_PAREN (
( KW_CLUSTER KW_BY partition+=expression (COMMA partition+=expression)* KW_CLUSTER KW_BY partition+=expression (COMMA partition+=expression)*
| ((KW_PARTITION | KW_DISTRIBUTE) KW_BY partition+=expression (COMMA partition+=expression)*)? | (
((KW_ORDER | KW_SORT) KW_BY sortItem (COMMA sortItem)*)?) (KW_PARTITION | KW_DISTRIBUTE) KW_BY partition+=expression (
windowFrame? COMMA partition+=expression
RIGHT_PAREN )*
)? ((KW_ORDER | KW_SORT) KW_BY sortItem (COMMA sortItem)*)?
) windowFrame? RIGHT_PAREN
; ;
/** /**
@ -1290,7 +1369,7 @@ version
// You can find the full keywords list by searching "Start of the keywords list" in this file. // You can find the full keywords list by searching "Start of the keywords list" in this file.
// The non-reserved keywords are listed below. Keywords not in this list are reserved keywords. // The non-reserved keywords are listed below. Keywords not in this list are reserved keywords.
ansiNonReserved ansiNonReserved
//--ANSI-NON-RESERVED-START //--ANSI-NON-RESERVED-START
: KW_ADD : KW_ADD
| KW_AFTER | KW_AFTER
| KW_ALTER | KW_ALTER
@ -1553,7 +1632,7 @@ ansiNonReserved
| KW_YEAR | KW_YEAR
| KW_YEARS | KW_YEARS
| KW_ZONE | KW_ZONE
//--ANSI-NON-RESERVED-END //--ANSI-NON-RESERVED-END
; ;
// When `SQL_standard_keyword_behavior=false`, there are 2 kinds of keywords in Spark SQL. // When `SQL_standard_keyword_behavior=false`, there are 2 kinds of keywords in Spark SQL.
@ -1585,7 +1664,7 @@ strictNonReserved
; ;
nonReserved nonReserved
//--DEFAULT-NON-RESERVED-START //--DEFAULT-NON-RESERVED-START
: KW_ADD : KW_ADD
| KW_AFTER | KW_AFTER
| KW_ALL | KW_ALL
@ -1907,5 +1986,5 @@ nonReserved
| KW_YEAR | KW_YEAR
| KW_YEARS | KW_YEARS
| KW_ZONE | KW_ZONE
//--DEFAULT-NON-RESERVED-END //--DEFAULT-NON-RESERVED-END
; ;

File diff suppressed because it is too large Load Diff

270
yarn.lock
View File

@ -17,6 +17,14 @@
dependencies: dependencies:
"@babel/highlight" "^7.18.6" "@babel/highlight" "^7.18.6"
"@babel/code-frame@^7.16.0":
version "7.23.5"
resolved "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244"
integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==
dependencies:
"@babel/highlight" "^7.23.4"
chalk "^2.4.2"
"@babel/compat-data@^7.22.0": "@babel/compat-data@^7.22.0":
version "7.22.3" version "7.22.3"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.3.tgz#cd502a6a0b6e37d7ad72ce7e71a7160a3ae36f7e" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.3.tgz#cd502a6a0b6e37d7ad72ce7e71a7160a3ae36f7e"
@ -134,6 +142,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
"@babel/helper-validator-identifier@^7.22.20":
version "7.22.20"
resolved "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0"
integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==
"@babel/helper-validator-option@^7.21.0": "@babel/helper-validator-option@^7.21.0":
version "7.21.0" version "7.21.0"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180"
@ -157,6 +170,15 @@
chalk "^2.0.0" chalk "^2.0.0"
js-tokens "^4.0.0" js-tokens "^4.0.0"
"@babel/highlight@^7.23.4":
version "7.23.4"
resolved "https://registry.npmmirror.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b"
integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==
dependencies:
"@babel/helper-validator-identifier" "^7.22.20"
chalk "^2.4.2"
js-tokens "^4.0.0"
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.21.9", "@babel/parser@^7.22.0", "@babel/parser@^7.22.4": "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.21.9", "@babel/parser@^7.22.0", "@babel/parser@^7.22.4":
version "7.22.4" version "7.22.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.4.tgz#a770e98fd785c231af9d93f6459d36770993fb32" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.4.tgz#a770e98fd785c231af9d93f6459d36770993fb32"
@ -260,6 +282,13 @@
dependencies: dependencies:
"@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-plugin-utils" "^7.20.2"
"@babel/runtime@^7.21.0":
version "7.23.6"
resolved "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.23.6.tgz#c05e610dc228855dc92ef1b53d07389ed8ab521d"
integrity sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==
dependencies:
regenerator-runtime "^0.14.0"
"@babel/template@^7.20.7", "@babel/template@^7.21.9", "@babel/template@^7.3.3": "@babel/template@^7.20.7", "@babel/template@^7.21.9", "@babel/template@^7.3.3":
version "7.21.9" version "7.21.9"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb"
@ -479,11 +508,28 @@
dependencies: dependencies:
"@jridgewell/trace-mapping" "0.3.9" "@jridgewell/trace-mapping" "0.3.9"
"@humanwhocodes/momoa@^2.0.3":
version "2.0.4"
resolved "https://registry.npmmirror.com/@humanwhocodes/momoa/-/momoa-2.0.4.tgz#8b9e7a629651d15009c3587d07a222deeb829385"
integrity sha512-RE815I4arJFtt+FVeU1Tgp9/Xvecacji8w/V6XtXsWWH/wz/eNkNbhb+ny/+PlVZjV0rxQpRSQKNKE3lcktHEA==
"@hutson/parse-repository-url@^3.0.0": "@hutson/parse-repository-url@^3.0.0":
version "3.0.2" version "3.0.2"
resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340"
integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==
"@isaacs/cliui@^8.0.2":
version "8.0.2"
resolved "https://registry.npmmirror.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550"
integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==
dependencies:
string-width "^5.1.2"
string-width-cjs "npm:string-width@^4.2.0"
strip-ansi "^7.0.1"
strip-ansi-cjs "npm:strip-ansi@^6.0.1"
wrap-ansi "^8.1.0"
wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
"@istanbuljs/load-nyc-config@^1.0.0": "@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
@ -760,6 +806,24 @@
"@jridgewell/resolve-uri" "3.1.0" "@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14" "@jridgewell/sourcemap-codec" "1.4.14"
"@pkgjs/parseargs@^0.11.0":
version "0.11.0"
resolved "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
"@readme/better-ajv-errors@1.6.0":
version "1.6.0"
resolved "https://registry.npmmirror.com/@readme/better-ajv-errors/-/better-ajv-errors-1.6.0.tgz#cf96740bd71d256ed628f3a7466ecae0846edd62"
integrity sha512-9gO9rld84Jgu13kcbKRU+WHseNhaVt76wYMeRDGsUGYxwJtI3RmEJ9LY9dZCYQGI8eUZLuxb5qDja0nqklpFjQ==
dependencies:
"@babel/code-frame" "^7.16.0"
"@babel/runtime" "^7.21.0"
"@humanwhocodes/momoa" "^2.0.3"
chalk "^4.1.2"
json-to-ast "^2.0.3"
jsonpointer "^5.0.0"
leven "^3.1.0"
"@sinclair/typebox@^0.25.16": "@sinclair/typebox@^0.25.16":
version "0.25.24" version "0.25.24"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718"
@ -940,6 +1004,11 @@
expect "^29.0.0" expect "^29.0.0"
pretty-format "^29.0.0" pretty-format "^29.0.0"
"@types/json-schema@^7.0.12":
version "7.0.15"
resolved "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
"@types/minimist@^1.2.0": "@types/minimist@^1.2.0":
version "1.2.2" version "1.2.2"
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"
@ -1025,7 +1094,7 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0" clean-stack "^2.0.0"
indent-string "^4.0.0" indent-string "^4.0.0"
ajv@^8.11.0: ajv@8.12.0, ajv@^8.11.0:
version "8.12.0" version "8.12.0"
resolved "https://registry.npmmirror.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" resolved "https://registry.npmmirror.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1"
integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==
@ -1071,11 +1140,23 @@ ansi-styles@^5.0.0:
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b"
integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==
ansi-styles@^6.0.0: ansi-styles@^6.0.0, ansi-styles@^6.1.0:
version "6.2.1" version "6.2.1"
resolved "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" resolved "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5"
integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==
antlr-format-cli@^1.2.1:
version "1.2.1"
resolved "https://registry.npmmirror.com/antlr-format-cli/-/antlr-format-cli-1.2.1.tgz#285ad653551ad8821e7685f2b44199f838113bbb"
integrity sha512-vqpoL9x3bXiNnC/vzZG3XOyk2vUAHPmBbI/ufyAqbxQHD27OPuUM4n/6m6NBEZZ7V4U2aEiefnZg2SCaSU89oA==
dependencies:
"@readme/better-ajv-errors" "1.6.0"
ajv "8.12.0"
antlr4ng "2.0.2"
commander "11.1.0"
glob "10.3.10"
ts-json-schema-generator "1.4.0"
antlr4-c3@3.1.1: antlr4-c3@3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.npmmirror.com/antlr4-c3/-/antlr4-c3-3.1.1.tgz#f3d579e17c925d9e3cc984ed0ecb5095fce1611f" resolved "https://registry.npmmirror.com/antlr4-c3/-/antlr4-c3-3.1.1.tgz#f3d579e17c925d9e3cc984ed0ecb5095fce1611f"
@ -1083,6 +1164,11 @@ antlr4-c3@3.1.1:
dependencies: dependencies:
antlr4ts "0.5.0-alpha.4" antlr4ts "0.5.0-alpha.4"
antlr4ng@2.0.2:
version "2.0.2"
resolved "https://registry.npmmirror.com/antlr4ng/-/antlr4ng-2.0.2.tgz#31d224cc45e578b78ef77fccf9316d133d7cc81c"
integrity sha512-Fhs3AvhoGigRt3RpHw0wGA7n03j9BpskH9yCUViNB7NtKuCA+imy2orEZ8qcgPG98f7IryEPYlG9sx99f3ZOyw==
antlr4ts-cli@^0.5.0-alpha.4: antlr4ts-cli@^0.5.0-alpha.4:
version "0.5.0-alpha.4" version "0.5.0-alpha.4"
resolved "https://registry.yarnpkg.com/antlr4ts-cli/-/antlr4ts-cli-0.5.0-alpha.4.tgz#f3bfc37f10131e78d7b981c397a2aaa0450b67f6" resolved "https://registry.yarnpkg.com/antlr4ts-cli/-/antlr4ts-cli-0.5.0-alpha.4.tgz#f3bfc37f10131e78d7b981c397a2aaa0450b67f6"
@ -1225,6 +1311,13 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0" balanced-match "^1.0.0"
concat-map "0.0.1" concat-map "0.0.1"
brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
dependencies:
balanced-match "^1.0.0"
braces@^3.0.2: braces@^3.0.2:
version "3.0.2" version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
@ -1296,7 +1389,7 @@ caniuse-lite@^1.0.30001489:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001491.tgz#eab0e0f392de6f7411751d148de9b5bd6b203e46" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001491.tgz#eab0e0f392de6f7411751d148de9b5bd6b203e46"
integrity sha512-17EYIi4TLnPiTzVKMveIxU5ETlxbSO3B6iPvMbprqnKh4qJsQGk5Nh1Lp4jIMAE0XfrujsJuWZAM3oJdMHaKBA== integrity sha512-17EYIi4TLnPiTzVKMveIxU5ETlxbSO3B6iPvMbprqnKh4qJsQGk5Nh1Lp4jIMAE0XfrujsJuWZAM3oJdMHaKBA==
chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2:
version "4.1.2" version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
@ -1399,6 +1492,11 @@ co@^4.6.0:
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==
code-error-fragment@0.0.230:
version "0.0.230"
resolved "https://registry.npmmirror.com/code-error-fragment/-/code-error-fragment-0.0.230.tgz#d736d75c832445342eca1d1fedbf17d9618b14d7"
integrity sha512-cadkfKp6932H8UkhzE/gcUqhRMNf8jHzkAN7+5Myabswaghu4xABTgPHDCjW+dBAJxj/SpkTYokpzDqY4pCzQw==
collect-v8-coverage@^1.0.0: collect-v8-coverage@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59"
@ -1433,6 +1531,11 @@ colorette@^2.0.16:
resolved "https://registry.npmmirror.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" resolved "https://registry.npmmirror.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a"
integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==
commander@11.1.0, commander@^11.0.0:
version "11.1.0"
resolved "https://registry.npmmirror.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906"
integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==
commander@^9.3.0: commander@^9.3.0:
version "9.5.0" version "9.5.0"
resolved "https://registry.npmmirror.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" resolved "https://registry.npmmirror.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30"
@ -1708,7 +1811,7 @@ create-require@^1.1.0:
resolved "https://registry.npmmirror.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" resolved "https://registry.npmmirror.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
cross-spawn@^7.0.3: cross-spawn@^7.0.0, cross-spawn@^7.0.3:
version "7.0.3" version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@ -2001,6 +2104,14 @@ findup-sync@^4.0.0:
micromatch "^4.0.2" micromatch "^4.0.2"
resolve-dir "^1.0.1" resolve-dir "^1.0.1"
foreground-child@^3.1.0:
version "3.1.1"
resolved "https://registry.npmmirror.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d"
integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==
dependencies:
cross-spawn "^7.0.0"
signal-exit "^4.0.1"
fs-extra@9.1.0: fs-extra@9.1.0:
version "9.1.0" version "9.1.0"
resolved "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" resolved "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
@ -2099,6 +2210,17 @@ gitconfiglocal@^1.0.0:
dependencies: dependencies:
ini "^1.3.2" ini "^1.3.2"
glob@10.3.10, glob@^10.3.10:
version "10.3.10"
resolved "https://registry.npmmirror.com/glob/-/glob-10.3.10.tgz#0351ebb809fd187fe421ab96af83d3a70715df4b"
integrity sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==
dependencies:
foreground-child "^3.1.0"
jackspeak "^2.3.5"
minimatch "^9.0.1"
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
path-scurry "^1.10.1"
glob@7.2.3, glob@^7.1.3, glob@^7.1.4: glob@7.2.3, glob@^7.1.3, glob@^7.1.4:
version "7.2.3" version "7.2.3"
resolved "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" resolved "https://registry.npmmirror.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
@ -2111,6 +2233,17 @@ glob@7.2.3, glob@^7.1.3, glob@^7.1.4:
once "^1.3.0" once "^1.3.0"
path-is-absolute "^1.0.0" path-is-absolute "^1.0.0"
glob@^8.0.3:
version "8.1.0"
resolved "https://registry.npmmirror.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^5.0.1"
once "^1.3.0"
global-dirs@^0.1.1: global-dirs@^0.1.1:
version "0.1.1" version "0.1.1"
resolved "https://registry.npmmirror.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" resolved "https://registry.npmmirror.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445"
@ -2148,6 +2281,11 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.9:
resolved "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" resolved "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
grapheme-splitter@^1.0.4:
version "1.0.4"
resolved "https://registry.npmmirror.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e"
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==
handlebars@^4.7.7: handlebars@^4.7.7:
version "4.7.7" version "4.7.7"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1"
@ -2452,6 +2590,15 @@ istanbul-reports@^3.1.3:
html-escaper "^2.0.0" html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0" istanbul-lib-report "^3.0.0"
jackspeak@^2.3.5:
version "2.3.6"
resolved "https://registry.npmmirror.com/jackspeak/-/jackspeak-2.3.6.tgz#647ecc472238aee4b06ac0e461acc21a8c505ca8"
integrity sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==
dependencies:
"@isaacs/cliui" "^8.0.2"
optionalDependencies:
"@pkgjs/parseargs" "^0.11.0"
jest-changed-files@^29.5.0: jest-changed-files@^29.5.0:
version "29.5.0" version "29.5.0"
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.5.0.tgz#e88786dca8bf2aa899ec4af7644e16d9dcf9b23e" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.5.0.tgz#e88786dca8bf2aa899ec4af7644e16d9dcf9b23e"
@ -2858,9 +3005,17 @@ json-stringify-safe@^5.0.1:
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
json5@^2.2.2: json-to-ast@^2.0.3:
version "2.1.0"
resolved "https://registry.npmmirror.com/json-to-ast/-/json-to-ast-2.1.0.tgz#041a9fcd03c0845036acb670d29f425cea4faaf9"
integrity sha512-W9Lq347r8tA1DfMvAGn9QNcgYm4Wm7Yc+k8e6vezpMnRT+NHbtlxgNBXRVjXe9YM6eTn6+p/MKOlV/aABJcSnQ==
dependencies:
code-error-fragment "0.0.230"
grapheme-splitter "^1.0.4"
json5@^2.2.2, json5@^2.2.3:
version "2.2.3" version "2.2.3"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" resolved "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
jsonc-parser@^3.2.0: jsonc-parser@^3.2.0:
@ -2882,6 +3037,11 @@ jsonparse@^1.2.0:
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==
jsonpointer@^5.0.0:
version "5.0.1"
resolved "https://registry.npmmirror.com/jsonpointer/-/jsonpointer-5.0.1.tgz#2110e0af0900fd37467b5907ecd13a7884a1b559"
integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==
kind-of@^6.0.3: kind-of@^6.0.3:
version "6.0.3" version "6.0.3"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
@ -3083,6 +3243,11 @@ lru-cache@^6.0.0:
dependencies: dependencies:
yallist "^4.0.0" yallist "^4.0.0"
"lru-cache@^9.1.1 || ^10.0.0":
version "10.1.0"
resolved "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484"
integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==
make-dir@^3.0.0: make-dir@^3.0.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
@ -3164,6 +3329,20 @@ minimatch@^3.0.4, minimatch@^3.1.1:
dependencies: dependencies:
brace-expansion "^1.1.7" brace-expansion "^1.1.7"
minimatch@^5.0.1:
version "5.1.6"
resolved "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
dependencies:
brace-expansion "^2.0.1"
minimatch@^9.0.1:
version "9.0.3"
resolved "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
dependencies:
brace-expansion "^2.0.1"
minimist-options@4.1.0: minimist-options@4.1.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619"
@ -3183,6 +3362,11 @@ minimist@^1.2.5, minimist@^1.2.6:
resolved "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" resolved "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
"minipass@^5.0.0 || ^6.0.2 || ^7.0.0":
version "7.0.4"
resolved "https://registry.npmmirror.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c"
integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==
modify-values@^1.0.0: modify-values@^1.0.0:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
@ -3410,6 +3594,14 @@ path-parse@^1.0.7:
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
path-scurry@^1.10.1:
version "1.10.1"
resolved "https://registry.npmmirror.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698"
integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==
dependencies:
lru-cache "^9.1.1 || ^10.0.0"
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
path-type@^3.0.0: path-type@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
@ -3577,6 +3769,11 @@ redent@^3.0.0:
indent-string "^4.0.0" indent-string "^4.0.0"
strip-indent "^3.0.0" strip-indent "^3.0.0"
regenerator-runtime@^0.14.0:
version "0.14.0"
resolved "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==
require-directory@^2.1.1: require-directory@^2.1.1:
version "2.1.1" version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
@ -3668,6 +3865,11 @@ safe-buffer@~5.2.0:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
safe-stable-stringify@^2.4.3:
version "2.4.3"
resolved "https://registry.npmmirror.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886"
integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==
"safer-buffer@>= 2.1.2 < 3": "safer-buffer@>= 2.1.2 < 3":
version "2.1.2" version "2.1.2"
resolved "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
@ -3714,6 +3916,11 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
signal-exit@^4.0.1:
version "4.1.0"
resolved "https://registry.npmmirror.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
sisteransi@^1.0.5: sisteransi@^1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
@ -3848,6 +4055,15 @@ string-length@^4.0.1:
char-regex "^1.0.2" char-regex "^1.0.2"
strip-ansi "^6.0.0" strip-ansi "^6.0.0"
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3" version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
@ -3857,7 +4073,7 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
is-fullwidth-code-point "^3.0.0" is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1" strip-ansi "^6.0.1"
string-width@^5.0.0: string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2:
version "5.1.2" version "5.1.2"
resolved "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" resolved "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
@ -3885,6 +4101,13 @@ stringify-package@^1.0.1:
resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85"
integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg==
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"
strip-ansi@^6.0.0, strip-ansi@^6.0.1: strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1" version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
@ -4020,6 +4243,19 @@ trim-newlines@^3.0.0:
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==
ts-json-schema-generator@1.4.0:
version "1.4.0"
resolved "https://registry.npmmirror.com/ts-json-schema-generator/-/ts-json-schema-generator-1.4.0.tgz#f341b36792c372d3d09245414a4f3a6efa2697f8"
integrity sha512-wm8vyihmGgYpxrqRshmYkWGNwEk+sf3xV2rUgxv8Ryeh7bSpMO7pZQOht+2rS002eDkFTxR7EwRPXVzrS0WJTg==
dependencies:
"@types/json-schema" "^7.0.12"
commander "^11.0.0"
glob "^8.0.3"
json5 "^2.2.3"
normalize-path "^3.0.0"
safe-stable-stringify "^2.4.3"
typescript "~5.2.2"
ts-node@^10.8.1: ts-node@^10.8.1:
version "10.9.1" version "10.9.1"
resolved "https://registry.npmmirror.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" resolved "https://registry.npmmirror.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
@ -4074,7 +4310,7 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
"typescript@^4.6.4 || ^5.0.0": "typescript@^4.6.4 || ^5.0.0", typescript@~5.2.2:
version "5.2.2" version "5.2.2"
resolved "https://registry.npmmirror.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" resolved "https://registry.npmmirror.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
@ -4174,6 +4410,15 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: wrap-ansi@^6.0.1, wrap-ansi@^6.2.0:
version "6.2.0" version "6.2.0"
resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
@ -4192,6 +4437,15 @@ wrap-ansi@^7.0.0:
string-width "^4.1.0" string-width "^4.1.0"
strip-ansi "^6.0.0" strip-ansi "^6.0.0"
wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==
dependencies:
ansi-styles "^6.1.0"
string-width "^5.0.1"
strip-ansi "^7.0.1"
wrappy@1: wrappy@1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"