aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeoniePhiline2023-02-23 00:04:33 +0000
committerGitHub2023-02-23 00:04:33 +0000
commit6494fc1daf2bb379e6a1f4ec94f3dafd99b3fb34 (patch)
tree17f2147123ad5eded7ad732508a7aa46dcd902be
parent8043959265366ed0c945b7f868337a3f9823a747 (diff)
feat(sql): MariaDB/MySQL syntax, Apache Hive syntax, unified builtin functions, floats, negative integers (#6041)
* feat(sql): MariaDB/MySQL table options `COLLATE`, `CHARACTER SET`, `ENGINE` Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/286e10c5bc5d1703ee8f9afb351165a9a6182be1...30e15d45dceb24ea51acf81ee7d75d81567b6e02 * feat(sql): Optional `COLUMN` in `ALTER TABLE` Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/30e15d45dceb24ea51acf81ee7d75d81567b6e02...c508e6044adf4298d7b321f966c90cbe32d75d23 * feat(sql): Add `UNSIGNED` support, refactor numeric types Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/c508e6044adf4298d7b321f966c90cbe32d75d23...2d1d5b68a1e11796dd0f4f068fc3e9d7e59fe9f7 * feat(sql): Add support for Apache Spark create Hive table Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/2d1d5b68a1e11796dd0f4f068fc3e9d7e59fe9f7...7be06f4d5eabace883dd45959c13dc740f1f1b98 * feat(sql): Add support for signed and unsigned floating point literals Upstream changes: https://github.com/DerekStride/tree-sitter-sql/pull/92/files * feat(sql): Add interval data type Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/13d375dea377bae5f235176fae97a50ba584db54...7b4bcd0394d759a660f470a4f07aa08b7b130d8c * feat(sql): Add support for DROP INDEX Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/7b4bcd0394d759a660f470a4f07aa08b7b130d8c...173d6feb5064defb7d0ef742a4fc7c6d763a2df0 * feat(sql): Add MariaDB/MySQL `ALTER TABLE ... CHANGE|MODIFY ... [FIRST|AFTER]` syntax Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/173d6feb5064defb7d0ef742a4fc7c6d763a2df0...0d7a121b2a08fb37109f7be1cc6654443cad661f * feat(sql): Extract fields from Apache Hive storage location and row format Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/0d7a121b2a08fb37109f7be1cc6654443cad661f...d2f0f6695fffa4ec1c81fc2060eddf83161f9ee3 * feat(sql): Fix unified built-in functions Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/d2f0f6695fffa4ec1c81fc2060eddf83161f9ee3...e4e43ba742a2ee88cbb24dbf305a7daadd583873 * feat(sql): Support negative integers Upstream changes: https://github.com/DerekStride/tree-sitter-sql/compare/e4e43ba742a2ee88cbb24dbf305a7daadd583873...3a3f92b29c880488a08bc2baaf1aca6432ec3380 * rework(sql): Improve `@constant.numeric` regex
-rw-r--r--languages.toml2
-rw-r--r--runtime/queries/sql/highlights.scm75
2 files changed, 58 insertions, 19 deletions
diff --git a/languages.toml b/languages.toml
index 1caef6b2..d8888c21 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1434,7 +1434,7 @@ injection-regex = "sql"
[[grammar]]
name = "sql"
-source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "286e10c5bc5d1703ee8f9afb351165a9a6182be1" }
+source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "3a3f92b29c880488a08bc2baaf1aca6432ec3380" }
[[language]]
name = "gdscript"
diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm
index a2d2f7fe..f15a92e7 100644
--- a/runtime/queries/sql/highlights.scm
+++ b/runtime/queries/sql/highlights.scm
@@ -1,20 +1,17 @@
-(keyword_btree) @function.builtin
-(keyword_hash) @function.builtin
-(keyword_gist) @function.builtin
-(keyword_spgist) @function.builtin
-(keyword_gin) @function.builtin
-(keyword_brin) @function.builtin
-
-(cast
- name: (identifier) @function.builtin)
-
-(count
- name: (identifier) @function.builtin)
-(keyword_group_concat) @function.builtin
+[
+ (keyword_btree)
+ (keyword_hash)
+ (keyword_gist)
+ (keyword_spgist)
+ (keyword_gin)
+ (keyword_brin)
-(invocation
- name: (identifier) @function.builtin)
+ (cast)
+ (count)
+ (group_concat)
+ (invocation)
+] @function.builtin
(table_reference
name: (identifier) @namespace)
@@ -57,7 +54,7 @@
] @constant.builtin
((literal) @constant.numeric
- (#match? @constant.numeric "^(-?\d*\.?\d*)$"))
+ (#match? @constant.numeric "^-?\\d*\\.?\\d*$"))
(literal) @string
@@ -92,6 +89,8 @@
(keyword_primary)
(keyword_create)
(keyword_alter)
+ (keyword_change)
+ (keyword_modify)
(keyword_drop)
(keyword_add)
(keyword_table)
@@ -119,8 +118,12 @@
(keyword_if)
(keyword_exists)
(keyword_auto_increment)
+ (keyword_collate)
+ (keyword_character)
+ (keyword_engine)
(keyword_default)
(keyword_cascade)
+ (keyword_restrict)
(keyword_with)
(keyword_no)
(keyword_data)
@@ -144,6 +147,7 @@
(keyword_over)
(keyword_nulls)
(keyword_first)
+ (keyword_after)
(keyword_last)
(keyword_window)
(keyword_range)
@@ -170,6 +174,37 @@
(keyword_like)
(keyword_similar)
(keyword_preserve)
+ (keyword_unsigned)
+ (keyword_zerofill)
+
+ (keyword_external)
+ (keyword_stored)
+ (keyword_cached)
+ (keyword_uncached)
+ (keyword_replication)
+ (keyword_tblproperties)
+ (keyword_compute)
+ (keyword_stats)
+ (keyword_location)
+ (keyword_partitioned)
+ (keyword_comment)
+ (keyword_sort)
+ (keyword_format)
+ (keyword_delimited)
+ (keyword_fields)
+ (keyword_terminated)
+ (keyword_escaped)
+ (keyword_lines)
+
+ (keyword_parquet)
+ (keyword_rcfile)
+ (keyword_csv)
+ (keyword_textfile)
+ (keyword_avro)
+ (keyword_sequencefile)
+ (keyword_orc)
+ (keyword_avro)
+ (keyword_jsonfile)
] @keyword
[
@@ -193,9 +228,11 @@
(keyword_smallserial)
(keyword_serial)
(keyword_bigserial)
- (keyword_smallint)
- (keyword_int)
+ (tinyint)
+ (smallint)
+ (mediumint)
+ (int)
(bigint)
(decimal)
(numeric)
@@ -222,6 +259,8 @@
(keyword_timestamp)
(keyword_timestamptz)
+ (keyword_interval)
+
(keyword_geometry)
(keyword_geography)
(keyword_box2d)