From 14f40d50a58ac0fb4f0f771504957e5c7594ea59 Mon Sep 17 00:00:00 2001 From: terrymanu Date: Fri, 29 Mar 2019 23:12:00 +0800 Subject: [PATCH] for #2084, identifier => identifier_ --- .../src/main/antlr4/imports/mysql/BaseRule.g4 | 26 +++++++++---------- .../main/antlr4/imports/mysql/MySQLBase.g4 | 20 ++++++-------- .../antlr4/imports/mysql/MySQLDCLStatement.g4 | 2 +- .../main/antlr4/imports/oracle/BaseRule.g4 | 2 +- .../antlr4/imports/postgresql/BaseRule.g4 | 2 +- .../main/antlr4/imports/sqlserver/BaseRule.g4 | 2 +- 6 files changed, 25 insertions(+), 29 deletions(-) diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/BaseRule.g4 b/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/BaseRule.g4 index 679b5207dacfc..a75d1da60ac13 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/BaseRule.g4 +++ b/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/BaseRule.g4 @@ -19,7 +19,7 @@ grammar BaseRule; import Keyword, Symbol, Literals; -identifier +identifier_ : IDENTIFIER_ | reservedWord_ ; @@ -45,27 +45,27 @@ reservedWord_ ; schemaName - : identifier + : identifier_ ; tableName - : (schemaName DOT_)? identifier + : (schemaName DOT_)? identifier_ | identifier_ DOT_ASTERISK_ | ASTERISK_ ; ownerName - : identifier + : identifier_ ; columnName - : (ownerName DOT_)? identifier + : (ownerName DOT_)? identifier_ ; indexName - : (schemaName DOT_)? identifier + : (schemaName DOT_)? identifier_ ; alias - : identifier | STRING_ + : identifier_ | STRING_ ; dataTypeLength @@ -166,7 +166,7 @@ simpleExpr | ROW exprList | subquery | EXISTS subquery - // | (identifier expr) + // | (identifier_ expr) //| match_expr | caseExpress | intervalExpr @@ -203,12 +203,12 @@ literal | TRUE | FALSE | NULL - | LBE_ identifier STRING_ RBE_ + | LBE_ identifier_ STRING_ RBE_ | HEX_DIGIT_ | string - | identifier STRING_ collateClause? + | identifier_ STRING_ collateClause? | (DATE | TIME | TIMESTAMP) STRING_ - | identifier? BIT_NUM_ collateClause? + | identifier_? BIT_NUM_ collateClause? ; question @@ -244,11 +244,11 @@ unqualifiedShorthand ; qualifiedShorthand - : identifier DOT_ASTERISK_ + : identifier_ DOT_ASTERISK_ ; ignoredIdentifier_ - : identifier (DOT_ identifier)? + : identifier_ (DOT_ identifier_)? ; ignoredIdentifiers_ diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLBase.g4 b/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLBase.g4 index 2c8b07887fb1d..4b3ebca5f5483 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLBase.g4 +++ b/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLBase.g4 @@ -20,11 +20,7 @@ grammar MySQLBase; import Symbol, MySQLKeyword, Keyword, Literals, BaseRule; alias - : identifier | STRING_ - ; - -tableName - : (schemaName DOT_)? identifier | identifier DOT_ASTERISK_ | ASTERISK_ + : identifier_ | STRING_ ; assignmentValueList @@ -48,7 +44,7 @@ specialFunction ; functionName - : identifier | IF | CURRENT_TIMESTAMP | LOCALTIME | LOCALTIMESTAMP | NOW | REPLACE | CAST | CONVERT | POSITION | CHARSET | CHAR | TRIM | WEIGHT_STRING + : identifier_ | IF | CURRENT_TIMESTAMP | LOCALTIME | LOCALTIMESTAMP | NOW | REPLACE | CAST | CONVERT | POSITION | CHARSET | CHAR | TRIM | WEIGHT_STRING ; groupConcat @@ -73,7 +69,7 @@ substringFunction ; extractFunction - : EXTRACT LP_ identifier FROM expr RP_ + : EXTRACT LP_ identifier_ FROM expr RP_ ; charFunction @@ -101,15 +97,15 @@ levelInWeightListElement ; windowFunction - : identifier exprList overClause + : identifier_ exprList overClause ; overClause - : OVER LP_ windowSpec RP_ | OVER identifier + : OVER LP_ windowSpec RP_ | OVER identifier_ ; windowSpec - : identifier? windowPartitionClause? orderByClause? frameClause? + : identifier_? windowPartitionClause? orderByClause? frameClause? ; windowPartitionClause @@ -145,7 +141,7 @@ frameEnd ; variable - : (AT_ AT_)? (GLOBAL | PERSIST | PERSIST_ONLY | SESSION)? DOT_? identifier + : (AT_ AT_)? (GLOBAL | PERSIST | PERSIST_ONLY | SESSION)? DOT_? identifier_ ; assignmentList @@ -165,7 +161,7 @@ dataType ; dataTypeName_ - : identifier identifier? + : identifier_ identifier_? ; characterSet_ diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLDCLStatement.g4 b/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLDCLStatement.g4 index 3d25336ba1a5c..3483eace5937a 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLDCLStatement.g4 +++ b/sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLDCLStatement.g4 @@ -86,7 +86,7 @@ objectType_ ; privilegeLevel_ - : ASTERISK_ | ASTERISK_ DOT_ASTERISK_ | identifier DOT_ASTERISK_ | tableName + : ASTERISK_ | ASTERISK_ DOT_ASTERISK_ | identifier_ DOT_ASTERISK_ | tableName ; createUser diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-oracle/src/main/antlr4/imports/oracle/BaseRule.g4 b/sharding-core/sharding-core-parse/sharding-core-parse-oracle/src/main/antlr4/imports/oracle/BaseRule.g4 index cbbcec760a95b..fcd6de27feeec 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-oracle/src/main/antlr4/imports/oracle/BaseRule.g4 +++ b/sharding-core/sharding-core-parse/sharding-core-parse-oracle/src/main/antlr4/imports/oracle/BaseRule.g4 @@ -141,7 +141,7 @@ simpleExpr | ROW exprList | subquery | EXISTS subquery - // | (identifier expr) + // | (identifier_ expr) //| match_expr | caseExpress | intervalExpr diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 b/sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 index cbbcec760a95b..fcd6de27feeec 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 +++ b/sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 @@ -141,7 +141,7 @@ simpleExpr | ROW exprList | subquery | EXISTS subquery - // | (identifier expr) + // | (identifier_ expr) //| match_expr | caseExpress | intervalExpr diff --git a/sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 b/sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 index cbbcec760a95b..fcd6de27feeec 100644 --- a/sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 +++ b/sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 @@ -141,7 +141,7 @@ simpleExpr | ROW exprList | subquery | EXISTS subquery - // | (identifier expr) + // | (identifier_ expr) //| match_expr | caseExpress | intervalExpr