Initial SQL support

This commit is contained in:
derekstride 2021-03-14 22:38:54 -02:30 committed by Stephan Seitz
parent 6eb35103d0
commit 8927588e47
5 changed files with 116 additions and 0 deletions

View file

@ -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)

View file

@ -296,6 +296,9 @@
"sparql": {
"revision": "05f949d3c1c15e3261473a244d3ce87777374dec"
},
"sql": {
"revision": "7b19968fc06f793b806508c0026d615bb3aa6d86"
},
"supercollider": {
"revision": "90c6d9f777d2b8c4ce497c48b5f270a44bcf3ea0"
},

View file

@ -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",

101
queries/sql/highlights.scm Normal file
View file

@ -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

View file

@ -0,0 +1,3 @@
(comment) @comment
(marginalia) @comment