summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/sql/highlights.scm101
-rw-r--r--queries/sql/injections.scm3
5 files changed, 116 insertions, 0 deletions
diff --git a/README.md b/README.md
index ce19a00f..c8659fa9 100644
--- a/README.md
+++ b/README.md
@@ -255,6 +255,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [slint](https://github.com/jrmoulton/tree-sitter-slint) (experimental, maintained by @jrmoulton)
- [x] [solidity](https://github.com/YongJieYongJie/tree-sitter-solidity) (maintained by @YongJieYongJie)
- [x] [sparql](https://github.com/BonaBeavis/tree-sitter-sparql) (maintained by @bonabeavis)
+- [x] [sql](https://github.com/derekstride/tree-sitter-sql) (maintained by @derekstride)
- [x] [supercollider](https://github.com/madskjeldgaard/tree-sitter-supercollider) (maintained by @madskjeldgaard)
- [x] [surface](https://github.com/connorlay/tree-sitter-surface) (maintained by @connorlay)
- [x] [svelte](https://github.com/Himujjal/tree-sitter-svelte) (maintained by @elianiva)
diff --git a/lockfile.json b/lockfile.json
index c6bddc8d..9601145d 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -296,6 +296,9 @@
"sparql": {
"revision": "05f949d3c1c15e3261473a244d3ce87777374dec"
},
+ "sql": {
+ "revision": "7b19968fc06f793b806508c0026d615bb3aa6d86"
+ },
"supercollider": {
"revision": "90c6d9f777d2b8c4ce497c48b5f270a44bcf3ea0"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 1e3fc88d..dd830938 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -770,6 +770,14 @@ list.sparql = {
maintainers = { "@bonabeavis" },
}
+list.sql = {
+ install_info = {
+ url = "https://github.com/derekstride/tree-sitter-sql",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@derekstride" },
+}
+
list.gdscript = {
install_info = {
url = "https://github.com/PrestonKnopp/tree-sitter-gdscript",
diff --git a/queries/sql/highlights.scm b/queries/sql/highlights.scm
new file mode 100644
index 00000000..f80eeb13
--- /dev/null
+++ b/queries/sql/highlights.scm
@@ -0,0 +1,101 @@
+(function_call
+ name: (identifier) @function)
+
+(table_expression
+ name: (identifier) @type)
+
+(table_expression
+ name: (identifier) @type
+ table_alias: (identifier) @variable)
+
+(field
+ table_alias: (identifier) @variable
+ name: (identifier) @field)
+
+((literal) @number
+ (lua-match? @number "^%d+$"))
+
+((literal) @string
+ (lua-match? @string "^\"|'"))
+
+[
+ (keyword_select)
+ (keyword_from)
+ (keyword_where)
+ (keyword_use)
+ (keyword_index)
+ (keyword_join)
+ (keyword_on)
+ (keyword_primary)
+ (keyword_select)
+ (keyword_delete)
+ (keyword_create)
+ (keyword_insert)
+ (keyword_distinct)
+ (keyword_replace)
+ (keyword_update)
+ (keyword_into)
+ (keyword_values)
+ (keyword_set)
+ (keyword_from)
+ (keyword_left)
+ (keyword_right)
+ (keyword_outer)
+ (keyword_inner)
+ (keyword_join)
+ (keyword_on)
+ (keyword_where)
+ (keyword_order_by)
+ (keyword_group_by)
+ (keyword_having)
+ (keyword_desc)
+ (keyword_asc)
+ (keyword_as)
+ (keyword_limit)
+ (keyword_offset)
+ (keyword_primary)
+ (keyword_table)
+ (keyword_key)
+ (keyword_constraint)
+ (keyword_force)
+ (keyword_use)
+ (keyword_index)
+ (keyword_for)
+ (keyword_if)
+ (keyword_exists)
+ (keyword_auto_increment)
+ (keyword_default)
+] @keyword
+
+[
+ (keyword_in)
+ (keyword_and)
+ (keyword_or)
+ (keyword_not)
+] @keyword.operator
+
+[
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "^"
+ "="
+ "<"
+ "<="
+ "!="
+ ">="
+ ">"
+] @operator
+
+[
+ "("
+ ")"
+] @punctuation.bracket
+
+[
+ ";"
+ ","
+ "."
+] @punctuation.delimiter
diff --git a/queries/sql/injections.scm b/queries/sql/injections.scm
new file mode 100644
index 00000000..2157ceb1
--- /dev/null
+++ b/queries/sql/injections.scm
@@ -0,0 +1,3 @@
+(comment) @comment
+(marginalia) @comment
+