Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mysql auto complete #219

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/grammar/mysql/MySqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1016,16 +1016,6 @@ BIT_STRING: BIT_STRING_L;
STRING_CHARSET_NAME: '_' CHARSET_NAME;




// Hack for dotID
// Prevent recognize string: .123somelatin AS ((.123), FLOAT_LITERAL), ((somelatin), ID)
// it must recoginze: .123somelatin AS ((.), DOT), (123somelatin, ID)

DOT_ID: '.' ID_LITERAL;



// Identifiers

ID: ID_LITERAL;
Expand Down
15 changes: 8 additions & 7 deletions src/grammar/mysql/MySqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ THE SOFTWARE.
*/

// https://github.com/antlr/grammars-v4/blob/master/sql/mysql/Positive-Technologies/MySqlParser.g4
// SQL Statements: https://dev.mysql.com/doc/refman/8.0/en/sql-statements.html
// SQL Statements v8.0: https://dev.mysql.com/doc/refman/8.0/en/sql-statements.html
// SQL Statements v5.7: https://dev.mysql.com/doc/refman/5.7/en/sql-statements.html


parser grammar MySqlParser;
Expand Down Expand Up @@ -1136,10 +1137,10 @@ selectElements
;

selectElement
: select_element=fullId '.' '*' #selectStarElement
| columnName (KW_AS? alias=uid)? #selectColumnElement
| functionCall (KW_AS? alias=uid)? #selectFunctionElement
| (LOCAL_ID VAR_ASSIGN)? expression (KW_AS? alias=uid)? #selectExpressionElement
: select_element=fullId '.' '*' #selectStarElement
| columnName (KW_AS? alias=uid)? #selectColumnElement
| functionCall (KW_AS? alias=uid)? #selectFunctionElement
| (LOCAL_ID VAR_ASSIGN)? expression (KW_AS? alias=uid)? #selectExpressionElement
;

intoClause
Expand Down Expand Up @@ -2335,7 +2336,7 @@ simpleId
;

dottedId
: DOT_ID
: DOT ID
| '.' uid
;

Expand Down Expand Up @@ -2530,7 +2531,7 @@ functionCall
| aggregateWindowedFunction #aggregateFunctionCall
| nonAggregateWindowedFunction #nonAggregateFunctionCall
| scalarFunctionName '(' functionArgs? ')' #scalarFunctionCall
| fullId '(' functionArgs? ')' #udfFunctionCall
| functionName '(' functionArgs? ')' #udfFunctionCall
| passwordFunctionClause #passwordFunctionCall
;

Expand Down
5 changes: 1 addition & 4 deletions src/lib/mysql/MySqlLexer.interp

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions src/lib/mysql/MySqlLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -886,14 +886,13 @@ REAL_LITERAL=885
NULL_SPEC_LITERAL=886
BIT_STRING=887
STRING_CHARSET_NAME=888
DOT_ID=889
ID=890
REVERSE_QUOTE_ID=891
HOST_IP_ADDRESS=892
LOCAL_ID=893
GLOBAL_ID=894
PERSIST_ID=895
ERROR_RECONGNIGION=896
ID=889
REVERSE_QUOTE_ID=890
HOST_IP_ADDRESS=891
LOCAL_ID=892
GLOBAL_ID=893
PERSIST_ID=894
ERROR_RECONGNIGION=895
'ACTIVE'=5
'ADD'=6
'ALL'=7
Expand Down
9,455 changes: 4,725 additions & 4,730 deletions src/lib/mysql/MySqlLexer.ts

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/lib/mysql/MySqlParser.interp

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions src/lib/mysql/MySqlParser.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -886,14 +886,13 @@ REAL_LITERAL=885
NULL_SPEC_LITERAL=886
BIT_STRING=887
STRING_CHARSET_NAME=888
DOT_ID=889
ID=890
REVERSE_QUOTE_ID=891
HOST_IP_ADDRESS=892
LOCAL_ID=893
GLOBAL_ID=894
PERSIST_ID=895
ERROR_RECONGNIGION=896
ID=889
REVERSE_QUOTE_ID=890
HOST_IP_ADDRESS=891
LOCAL_ID=892
GLOBAL_ID=893
PERSIST_ID=894
ERROR_RECONGNIGION=895
'ACTIVE'=5
'ADD'=6
'ALL'=7
Expand Down
Loading
Loading