@@ -36,6 +36,11 @@ parser grammar MySqlParser;
36
36
options {
37
37
tokenVocab= MySqlLexer;
38
38
caseInsensitive= true ;
39
+ superClass=SQLParserBase;
40
+ }
41
+
42
+ @header {
43
+ import SQLParserBase from ' ../SQLParserBase' ;
39
44
}
40
45
41
46
// Top Level Description
@@ -212,8 +217,8 @@ administrationStatement
212
217
;
213
218
214
219
utilityStatement
215
- : simpleDescribeStatement
216
- | fullDescribeStatement
220
+ : fullDescribeStatement
221
+ | simpleDescribeStatement
217
222
| analyzeDescribeStatement
218
223
| helpStatement
219
224
| useStatement
@@ -2396,6 +2401,7 @@ columnNames
2396
2401
columnName
2397
2402
: uid (dottedId dottedId?)?
2398
2403
| .? dottedId dottedId?
2404
+ | {this.shouldMatchEmpty()} ?
2399
2405
;
2400
2406
2401
2407
tablespaceNameCreate
@@ -2751,12 +2757,12 @@ orReplace
2751
2757
// Functions
2752
2758
2753
2759
functionCall
2754
- : specificFunction # specificFunctionCall
2755
- | aggregateWindowedFunction # aggregateFunctionCall
2756
- | nonAggregateWindowedFunction # nonAggregateFunctionCall
2757
- | scalarFunctionName ' (' functionArgs? ' )' # scalarFunctionCall
2758
- | functionName ' (' functionArgs? ' )' # udfFunctionCall
2759
- | passwordFunctionClause # passwordFunctionCall
2760
+ : specificFunction # specificFunctionCall
2761
+ | aggregateWindowedFunction # aggregateFunctionCall
2762
+ | nonAggregateWindowedFunction # nonAggregateFunctionCall
2763
+ | scalarFunctionName ( ' (' ' ) ' | ' ( ' functionArgs ' )' ) # scalarFunctionCall
2764
+ | functionName ( ' (' ' ) ' | ' ( ' functionArgs ' )' ) # udfFunctionCall
2765
+ | passwordFunctionClause # passwordFunctionCall
2760
2766
;
2761
2767
2762
2768
specificFunction
@@ -2925,7 +2931,6 @@ functionArgs
2925
2931
2926
2932
functionArg
2927
2933
: constant
2928
- | columnName
2929
2934
| functionCall
2930
2935
| expression
2931
2936
;
@@ -2941,22 +2946,23 @@ expression
2941
2946
;
2942
2947
2943
2948
predicate
2944
- : predicate KW_NOT ? KW_IN ' (' (selectStatement | expressions) ' )' # inPredicate
2945
- | predicate KW_IS nullNotnull # isNullPredicate
2946
- | left=predicate comparisonOperator right=predicate # binaryComparisonPredicate
2947
- | predicate comparisonOperator quantifier=(KW_ALL | KW_ANY | KW_SOME ) ' (' selectStatement ' )' # subqueryComparisonPredicate
2948
- | predicate KW_NOT ? KW_BETWEEN predicate KW_AND predicate # betweenPredicate
2949
- | predicate KW_SOUNDS KW_LIKE predicate # soundsLikePredicate
2950
- | predicate KW_NOT ? KW_LIKE predicate (KW_ESCAPE STRING_LITERAL )? # likePredicate
2951
- | predicate KW_NOT ? regex=(KW_REGEXP | KW_RLIKE ) predicate # regexpPredicate
2952
- | predicate KW_MEMBER KW_OF ' (' predicate ' )' # jsonMemberOfPredicate
2953
- | expressionAtom # expressionAtomPredicate
2949
+ : predicate KW_NOT ? KW_IN ' (' (selectStatement | expressions) ' )' # inPredicate
2950
+ | predicate KW_IS nullNotnull # isNullPredicate
2951
+ | predicate comparisonOperator (
2952
+ quantifier=(KW_ALL | KW_ANY | KW_SOME ) ' (' subQuery=selectStatement ' )'
2953
+ | right=predicate
2954
+ ) # binaryComparisonPredicate
2955
+ | predicate KW_NOT ? KW_BETWEEN predicate KW_AND predicate # betweenPredicate
2956
+ | predicate KW_SOUNDS KW_LIKE predicate # soundsLikePredicate
2957
+ | predicate KW_NOT ? KW_LIKE predicate (KW_ESCAPE STRING_LITERAL )? # likePredicate
2958
+ | predicate KW_NOT ? regex=(KW_REGEXP | KW_RLIKE ) predicate # regexpPredicate
2959
+ | predicate KW_MEMBER KW_OF ' (' predicate ' )' # jsonMemberOfPredicate
2960
+ | expressionAtom # expressionAtomPredicate
2954
2961
;
2955
2962
2956
2963
// Add in ASTVisitor nullNotnull in constant
2957
2964
expressionAtom
2958
2965
: constant # constantExpressionAtom
2959
- | columnName # columnNameExpressionAtom
2960
2966
| functionCall # functionCallExpressionAtom
2961
2967
| expressionAtom KW_COLLATE collationName # collateExpressionAtom
2962
2968
| mysqlVariable # mysqlVariableExpressionAtom
@@ -2968,9 +2974,10 @@ expressionAtom
2968
2974
| KW_EXISTS ' (' selectStatement ' )' # existsExpressionAtom
2969
2975
| ' (' selectStatement ' )' # subqueryExpressionAtom
2970
2976
| KW_INTERVAL expression intervalType # intervalExpressionAtom
2977
+ | left=expressionAtom jsonOperator right=expressionAtom # jsonExpressionAtom
2971
2978
| left=expressionAtom bitOperator right=expressionAtom # bitExpressionAtom
2972
2979
| left=expressionAtom mathOperator right=expressionAtom # mathExpressionAtom
2973
- | left=expressionAtom jsonOperator right=expressionAtom # jsonExpressionAtom
2980
+ | columnName # columnNameExpressionAtom
2974
2981
;
2975
2982
2976
2983
unaryOperator
@@ -2982,18 +2989,18 @@ unaryOperator
2982
2989
;
2983
2990
2984
2991
comparisonOperator
2985
- : comparisonBase
2986
- | ' <' ' >'
2992
+ : ' <' ' >'
2987
2993
| ' !' ' ='
2988
2994
| ' <' ' =' ' >'
2995
+ | comparisonBase
2989
2996
;
2990
2997
2991
2998
comparisonBase
2992
- : ' ='
2999
+ : ' <' ' ='
3000
+ | ' >' ' ='
3001
+ | ' ='
2993
3002
| ' >'
2994
3003
| ' <'
2995
- | ' <' ' ='
2996
- | ' >' ' ='
2997
3004
;
2998
3005
2999
3006
logicalOperator
0 commit comments