Skip to content

Commit

Permalink
for #2084, DataType.g4 => Literals.g4
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Mar 29, 2019
1 parent 40857a8 commit 21aba26
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,28 @@ grammar BaseRule;

import Keyword, Symbol, Literals;

ID
: (BQ_?[a-zA-Z_$][a-zA-Z0-9_$]* BQ_? DOT_)? (BQ_?[a-zA-Z_$][a-zA-Z0-9_$]* BQ_?)
;

schemaName
: ID
: IDENTIFIER_
;

tableName
: ID
: IDENTIFIER_
;

columnName
: ID
: IDENTIFIER_
;

collationName
: STRING_ | ID
: STRING_ | IDENTIFIER_
;

indexName
: ID
: IDENTIFIER_
;

alias
: ID
: IDENTIFIER_
;

dataTypeLength
Expand Down Expand Up @@ -153,7 +149,7 @@ simpleExpr
;

functionCall
: ID LP_ distinct? (exprs | ASTERISK_)? RP_
: IDENTIFIER_ LP_ distinct? (exprs | ASTERISK_)? RP_
;

distinct
Expand Down Expand Up @@ -182,12 +178,12 @@ literal
| TRUE
| FALSE
| NULL
| LBE_ ID STRING_ RBE_
| LBE_ IDENTIFIER_ STRING_ RBE_
| HEX_DIGIT_
| string
| ID STRING_ collateClause?
| IDENTIFIER_ STRING_ collateClause?
| (DATE | TIME | TIMESTAMP) STRING_
| ID? BIT_NUM_ collateClause?
| IDENTIFIER_? BIT_NUM_ collateClause?
;

question
Expand Down Expand Up @@ -223,7 +219,7 @@ asterisk
;

ignoredIdentifier_
: ID
: IDENTIFIER_
;

ignoredIdentifiers_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ lexer grammar Literals;

import Alphabet, Symbol;

IDENTIFIER_
: (BQ_?[a-zA-Z_$][a-zA-Z0-9_$#]* BQ_? DOT_)? (BQ_?[a-zA-Z_$][a-zA-Z0-9_$#]* BQ_?) | [a-zA-Z_$#0-9]+ DOT_ASTERISK_
;

STRING_
: ('"' ( '\\'. | '""' | ~('"'| '\\') )* '"')
| ('\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\'')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ grammar OracleBase;

import Symbol, OracleKeyword, Keyword, Literals, BaseRule;

ID
: (BQ_?[a-zA-Z_$][a-zA-Z0-9_$#]* BQ_? DOT_)? (BQ_?[a-zA-Z_$][a-zA-Z0-9_$#]* BQ_?) | [a-zA-Z_$#0-9]+ DOT_ASTERISK_
;

oracleId
: ID | (STRING_ DOT_)* STRING_
: IDENTIFIER_ | (STRING_ DOT_)* STRING_
;

tableName
Expand All @@ -44,7 +40,7 @@ attributeName
;

indexTypeName
: ID
: IDENTIFIER_
;

simpleExprsWithParen
Expand Down Expand Up @@ -72,11 +68,11 @@ dataType
;

specialDatatype
: dataTypeName_ (LP_ NUMBER_ ID RP_) | NATIONAL dataTypeName_ VARYING? LP_ NUMBER_ RP_ | dataTypeName_ LP_? columnName RP_?
: dataTypeName_ (LP_ NUMBER_ IDENTIFIER_ RP_) | NATIONAL dataTypeName_ VARYING? LP_ NUMBER_ RP_ | dataTypeName_ LP_? columnName RP_?
;

dataTypeName_
: ID ID | ID
: IDENTIFIER_ IDENTIFIER_ | IDENTIFIER_
;

datetimeTypeSuffix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ onObjectClause_
;

otherPrivileges_
: STRING_+ | ID+
: STRING_+ | IDENTIFIER_+
;

createUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public final class OracleParser extends OracleStatementParser implements SQLPars

public OracleParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
_errHandler = new AdvancedErrorStrategy(ID);
advancedMatchHandler = new AdvancedMatchHandler(this, ID);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, IDENTIFIER_);
_errHandler = new AdvancedErrorStrategy(IDENTIFIER_);
advancedMatchHandler = new AdvancedMatchHandler(this, IDENTIFIER_);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,28 @@ grammar BaseRule;

import Keyword, Symbol, Literals;

ID
: (BQ_?[a-zA-Z_$][a-zA-Z0-9_$]* BQ_? DOT_)? (BQ_?[a-zA-Z_$][a-zA-Z0-9_$]* BQ_?)
;

schemaName
: ID
: IDENTIFIER_
;

tableName
: ID
: IDENTIFIER_
;

columnName
: ID
: IDENTIFIER_
;

collationName
: STRING_ | ID
: STRING_ | IDENTIFIER_
;

indexName
: ID
: IDENTIFIER_
;

alias
: ID
: IDENTIFIER_
;

dataTypeLength
Expand Down Expand Up @@ -153,7 +149,7 @@ simpleExpr
;

functionCall
: ID LP_ distinct? (exprs | ASTERISK_)? RP_
: IDENTIFIER_ LP_ distinct? (exprs | ASTERISK_)? RP_
;

distinct
Expand Down Expand Up @@ -182,12 +178,12 @@ literal
| TRUE
| FALSE
| NULL
| LBE_ ID STRING_ RBE_
| LBE_ IDENTIFIER_ STRING_ RBE_
| HEX_DIGIT_
| string
| ID STRING_ collateClause?
| IDENTIFIER_ STRING_ collateClause?
| (DATE | TIME | TIMESTAMP) STRING_
| ID? BIT_NUM_ collateClause?
| IDENTIFIER_? BIT_NUM_ collateClause?
;

question
Expand Down Expand Up @@ -223,7 +219,7 @@ asterisk
;

ignoredIdentifier_
: ID
: IDENTIFIER_
;

ignoredIdentifiers_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ lexer grammar Literals;

import Alphabet, Symbol;

IDENTIFIER_
: (BQ_?[a-zA-Z_$][a-zA-Z0-9_$]* BQ_? DOT_)? (BQ_?[a-zA-Z_$][a-zA-Z0-9_$]* BQ_?)
;

STRING_
: ('"' ( '\\'. | '""' | ~('"'| '\\') )* '"')
| ('\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\'')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ constraintOptionalParam
;

dataType
: dataTypeName_ intervalFields? dataTypeLength? (WITHOUT TIME ZONE | WITH TIME ZONE)? (LBT_ RBT_)* | ID
: dataTypeName_ intervalFields? dataTypeLength? (WITHOUT TIME ZONE | WITH TIME ZONE)? (LBT_ RBT_)* | IDENTIFIER_
;

dataTypeName_
: ID ID | ID
: IDENTIFIER_ IDENTIFIER_ | IDENTIFIER_
;

intervalFields
Expand Down Expand Up @@ -123,7 +123,7 @@ pgExpr
;

aggregateExpression
: ID (LP_ (ALL | DISTINCT)? exprs orderByClause? RP_) asteriskWithParen (LP_ exprs RP_ WITHIN GROUP LP_ orderByClause RP_) filterClause?
: IDENTIFIER_ (LP_ (ALL | DISTINCT)? exprs orderByClause? RP_) asteriskWithParen (LP_ exprs RP_ WITHIN GROUP LP_ orderByClause RP_) filterClause?
;

filterClause
Expand All @@ -135,15 +135,15 @@ asteriskWithParen
;

windowFunction
: ID (exprList | asteriskWithParen) filterClause? windowFunctionWithClause
: IDENTIFIER_ (exprList | asteriskWithParen) filterClause? windowFunctionWithClause
;

windowFunctionWithClause
: OVER (ID | LP_ windowDefinition RP_)
: OVER (IDENTIFIER_ | LP_ windowDefinition RP_)
;

windowDefinition
: ID? (PARTITION BY exprs)? (orderByClause (COMMA_ orderByClause)*)? frameClause?
: IDENTIFIER_? (PARTITION BY exprs)? (orderByClause (COMMA_ orderByClause)*)? frameClause?
;

orderByClause
Expand Down Expand Up @@ -200,5 +200,5 @@ arrayConstructor
;

extractFromFunction
: EXTRACT LP_ ID FROM ID RP_
: EXTRACT LP_ IDENTIFIER_ FROM IDENTIFIER_ RP_
;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ grammar PostgreSQLDALStatement;
import Symbol, PostgreSQLKeyword, Keyword, Literals, BaseRule;

show
: SHOW (ALL | ID | TRANSACTION ISOLATION LEVEL)
: SHOW (ALL | IDENTIFIER_ | TRANSACTION ISOLATION LEVEL)
;

setParam
Expand All @@ -32,13 +32,13 @@ scope
;

setClause
: TIME ZONE timeZoneType | ID (TO | EQ_) (STRING_ | DEFAULT)
: TIME ZONE timeZoneType | IDENTIFIER_ (TO | EQ_) (STRING_ | DEFAULT)
;

timeZoneType
: NUMBER_ | LOCAL | DEFAULT
;

resetParam
: RESET (ALL | ID)
: RESET (ALL | IDENTIFIER_)
;
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ attributeOptions
;

attributeOption
: ID EQ_ simpleExpr
: IDENTIFIER_ EQ_ simpleExpr
;

addConstraintSpecification
Expand All @@ -186,7 +186,7 @@ storageParameterWithValue
;

storageParameter
: ID
: IDENTIFIER_
;

alterTableNameExists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public final class PostgreSQLParser extends PostgreSQLStatementParser implements

public PostgreSQLParser(final TokenStream input) {
super(input);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, ID);
_errHandler = new AdvancedErrorStrategy(ID);
advancedMatchHandler = new AdvancedMatchHandler(this, ID);
_interp = new AdvancedParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache, IDENTIFIER_);
_errHandler = new AdvancedErrorStrategy(IDENTIFIER_);
advancedMatchHandler = new AdvancedMatchHandler(this, IDENTIFIER_);
}

@Override
Expand Down
Loading

0 comments on commit 21aba26

Please sign in to comment.