aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseshotake2022-10-30 16:54:37 +0000
committerGitHub2022-10-30 16:54:37 +0000
commitf6710879d1a1e587d17800682ba0e1045f35e7a9 (patch)
tree0e10853b350b9246716f99ff38147beed364a04b
parent908529ccac153c12fd3b8e051a8f8ef68120d94d (diff)
Update SQL grammar (#4529)
-rw-r--r--languages.toml2
-rw-r--r--runtime/queries/sql/highlights.scm52
2 files changed, 46 insertions, 8 deletions
diff --git a/languages.toml b/languages.toml
index 73915fc2..9c0293f0 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1371,7 +1371,7 @@ injection-regex = "sql"
[[grammar]]
name = "sql"
-source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "0caa7fa2ee00e0b770493a79d4efacc1fc376cc5" }
+source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "2743c7b5e710e6854d4e8c14c302548b436e2a1f" }
[[language]]
name = "gdscript"
diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm
index 5025352e..ece8be33 100644
--- a/runtime/queries/sql/highlights.scm
+++ b/runtime/queries/sql/highlights.scm
@@ -1,3 +1,34 @@
+(keyword_gist) @function.builtin
+(keyword_btree) @function.builtin
+(keyword_btree) @function.builtin
+(keyword_hash) @function.builtin
+(keyword_spgist) @function.builtin
+(keyword_gin) @function.builtin
+(keyword_brin) @function.builtin
+(keyword_float) @function.builtin
+
+(invocation
+ name: (identifier) @function.builtin
+ parameter: [(field)]? @variable.other.member)
+
+(count
+ name: (identifier) @function.builtin
+ parameter: [(field)]? @variable.other.member)
+
+(table_reference
+ name: (identifier) @namespace)
+
+(relation
+ table_alias: (identifier) @variable.parameter)
+
+(field
+ name: (identifier) @variable.other.member)
+
+(field
+ table_alias: (identifier) @variable.parameter
+ name: (identifier) @variable.other.member)
+
+
(comment) @comment
[
@@ -6,6 +37,12 @@
] @punctuation.bracket
[
+ ";"
+ ","
+ "."
+] @punctuation.delimiter
+
+[
"*"
"+"
"-"
@@ -29,11 +66,8 @@
(literal) @string
-(set_schema schema: (identifier) @namespace)
-(table_reference schema: (identifier) @namespace)
-(table_expression schema: (identifier) @namespace)
-(all_fields schema: (identifier) @namespace)
-(field schema: (identifier) @namespace)
+((literal) @constant.numeric
+ (#match? @constant.numeric "^(-?\d*\.?\d*)$"))
[
(keyword_select)
@@ -54,8 +88,10 @@
(keyword_lateral)
(keyword_on)
(keyword_not)
- (keyword_order_by)
- (keyword_group_by)
+ (keyword_order)
+ (keyword_group)
+ (keyword_partition)
+ (keyword_by)
(keyword_having)
(keyword_desc)
(keyword_asc)
@@ -89,6 +125,8 @@
(keyword_auto_increment)
(keyword_default)
(keyword_cascade)
+ (keyword_between)
+ (keyword_window)
(keyword_with)
(keyword_no)
(keyword_data)