Skip to content

Commit afca143

Browse files
Merge pull request taozhi8833998#2593 from YaroCabbage/add-vector-type
Update package to support additional types (like VECTOR)
2 parents 03b144d + 8bf4d44 commit afca143

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pegjs/mysql.pegjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@
265265
'VARCHARACTER': true,
266266
'VARYING': true,
267267
'VIRTUAL': true,
268+
'VECTOR': true,
268269

269270
'WHEN': true,
270271
'WHERE': true,
@@ -4215,6 +4216,7 @@ KW_TIMESTAMP = "TIMESTAMP"i !ident_start { return 'TIMESTAMP'; }
42154216
KW_YEAR = "YEAR"i !ident_start { return 'YEAR'; }
42164217
KW_TRUNCATE = "TRUNCATE"i !ident_start { return 'TRUNCATE'; }
42174218
KW_USER = "USER"i !ident_start { return 'USER'; }
4219+
KW_VECTOR = "VECTOR"i !ident_start { return 'VECTOR'; }
42184220

42194221
KW_CURRENT_DATE = "CURRENT_DATE"i !ident_start { return 'CURRENT_DATE'; }
42204222
KW_ADD_DATE = "ADDDATE"i !ident_start { return 'ADDDATE'; }
@@ -4561,6 +4563,7 @@ data_type
45614563
/ binary_type
45624564
/ blob_type
45634565
/ geometry_type
4566+
/ vector_type
45644567

45654568
data_type_size
45664569
= LPAREN __ l:[0-9]+ __ RPAREN __ s:numeric_type_suffix? {
@@ -4635,3 +4638,15 @@ text_type
46354638

46364639
geometry_type
46374640
= t:(KW_GEOMETRY / KW_POINT / KW_LINESTRING / KW_POLYGON / KW_MULTIPOINT / KW_MULTILINESTRING / KW_MULTIPOLYGON / KW_GEOMETRYCOLLECTION ) { return { dataType: t }}
4641+
4642+
vector_type
4643+
= t:KW_VECTOR __ LPAREN __ d:[0-9]+ __ RPAREN {
4644+
return {
4645+
dataType: t,
4646+
length: parseInt(d.join(''), 10),
4647+
parentheses: true
4648+
};
4649+
}
4650+
/ t:KW_VECTOR {
4651+
return { dataType: t };
4652+
}

0 commit comments

Comments
 (0)