From 1bbf9341385f603a1a4618cea661d3f809d74b52 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:04:04 +0200 Subject: [PATCH 1/6] bump tree-sitter-sql --- languages.toml | 2 +- runtime/queries/sql/highlights.scm | 512 ++++++++++++++++------------- 2 files changed, 281 insertions(+), 233 deletions(-) diff --git a/languages.toml b/languages.toml index 8fafd5d4375e..85a9e48aabf5 100644 --- a/languages.toml +++ b/languages.toml @@ -1767,7 +1767,7 @@ injection-regex = "sql" [[grammar]] name = "sql" -source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "7cbac0472e5b8f8486ce64ffbcf1982d5cd5fc8d" } +source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "eeab7240a11098724e6f95bc57cc3ceaf5487d5f" } [[language]] name = "gdscript" diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 2faa67ed3711..54a65f43bb4b 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -1,134 +1,168 @@ +(invocation + (object_reference + name: (identifier) @function.call)) [ + (keyword_gist) (keyword_btree) (keyword_hash) - (keyword_gist) (keyword_spgist) (keyword_gin) (keyword_brin) + (keyword_array) +] @function.call - (cast) - (group_concat) - (invocation) -] @function.builtin - -(table_reference - name: (identifier) @namespace) +(object_reference + name: (identifier) @type) (relation - table_alias: (identifier) @variable.parameter) - -(field - name: (identifier) @variable.other.member) - + alias: (identifier) @variable) + (field - table_alias: (identifier) @variable.parameter - name: (identifier) @variable.other.member) + name: (identifier) @field) -(comment) @comment +(term + alias: (identifier) @variable) -[ - "(" - ")" -] @punctuation.bracket +((term + value: (cast + name: (keyword_cast) @function.call + parameter: [(literal)]?))) -[ - ";" - "," - "." -] @punctuation.delimiter +(literal) @string +(comment) @comment @spell +(marginalia) @comment -(binary_expression - operator: _ @operator) +((literal) @number + (#lua-match? @number "^%d+$")) -(unary_expression - operator: _ @operator) +((literal) @float +(#lua-match? @float "^[-]?%d*\.%d*$")) -(all_fields) @special +(parameter) @parameter [ - (keyword_null) - (keyword_true) - (keyword_false) -] @constant.builtin + (keyword_true) + (keyword_false) +] @boolean -((literal) @constant.numeric - (#match? @constant.numeric "^-?\\d*\\.?\\d*$")) +[ + (keyword_asc) + (keyword_desc) + (keyword_terminated) + (keyword_escaped) + (keyword_unsigned) + (keyword_nulls) + (keyword_last) + (keyword_delimited) + (keyword_replication) + (keyword_auto_increment) + (keyword_default) + (keyword_collate) + (keyword_concurrently) + (keyword_engine) + (keyword_always) + (keyword_generated) + (keyword_preceding) + (keyword_following) + (keyword_first) + (keyword_current_timestamp) + (keyword_immutable) + (keyword_atomic) + (keyword_parallel) + (keyword_leakproof) + (keyword_safe) + (keyword_cost) + (keyword_strict) +] @attribute -(literal) @string +[ + (keyword_materialized) + (keyword_recursive) + (keyword_temp) + (keyword_temporary) + (keyword_unlogged) + (keyword_external) + (keyword_parquet) + (keyword_csv) + (keyword_rcfile) + (keyword_textfile) + (keyword_orc) + (keyword_avro) + (keyword_jsonfile) + (keyword_sequencefile) + (keyword_volatile) +] @storageclass + +[ + (keyword_case) + (keyword_when) + (keyword_then) + (keyword_else) +] @conditional [ (keyword_select) + (keyword_from) + (keyword_where) + (keyword_index) + (keyword_join) + (keyword_primary) (keyword_delete) + (keyword_create) (keyword_insert) + (keyword_merge) + (keyword_distinct) (keyword_replace) (keyword_update) (keyword_into) (keyword_overwrite) + (keyword_matched) (keyword_values) + (keyword_value) + (keyword_attribute) (keyword_set) - (keyword_from) (keyword_left) (keyword_right) + (keyword_outer) (keyword_inner) (keyword_full) - (keyword_outer) - (keyword_cross) - (keyword_join) - (keyword_lateral) - (keyword_on) - (keyword_not) (keyword_order) - (keyword_group) (keyword_partition) - (keyword_by) + (keyword_group) + (keyword_with) + (keyword_as) (keyword_having) - (keyword_desc) - (keyword_asc) (keyword_limit) (keyword_offset) - (keyword_primary) - (keyword_create) - (keyword_alter) - (keyword_change) - (keyword_analyze) - (keyword_modify) - (keyword_drop) - (keyword_add) (keyword_table) (keyword_tables) - (keyword_view) - (keyword_materialized) - (keyword_column) (keyword_key) - (keyword_as) - (keyword_distinct) + (keyword_references) + (keyword_foreign) (keyword_constraint) - ; (keyword_cast) - ; (keyword_group_concat) - (keyword_separator) - (keyword_max) - (keyword_min) - (keyword_avg) - (keyword_end) (keyword_force) - (keyword_ignore) - (keyword_using) (keyword_use) - (keyword_index) (keyword_for) (keyword_if) (keyword_exists) - (keyword_auto_increment) - (keyword_generated) - (keyword_always) - (keyword_collate) - (keyword_character) - (keyword_engine) - (keyword_default) - (keyword_cascade) - (keyword_restrict) - (keyword_with) + (keyword_max) + (keyword_min) + (keyword_avg) + (keyword_column) + (keyword_columns) + (keyword_cross) + (keyword_lateral) + (keyword_natural) + (keyword_alter) + (keyword_drop) + (keyword_add) + (keyword_view) + (keyword_end) + (keyword_is) + (keyword_using) + (keyword_between) + (keyword_window) (keyword_no) (keyword_data) (keyword_type) @@ -136,208 +170,222 @@ (keyword_to) (keyword_schema) (keyword_owner) - (keyword_temp) - (keyword_temporary) - (keyword_unlogged) - (keyword_union) + (keyword_authorization) (keyword_all) (keyword_any) (keyword_some) - (keyword_except) - (keyword_intersect) (keyword_returning) (keyword_begin) (keyword_commit) (keyword_rollback) (keyword_transaction) + (keyword_only) + (keyword_like) + (keyword_similar) (keyword_over) - (keyword_nulls) - (keyword_first) + (keyword_change) + (keyword_modify) (keyword_after) - (keyword_last) - (keyword_window) + (keyword_before) (keyword_range) (keyword_rows) (keyword_groups) - (keyword_between) - (keyword_unbounded) - (keyword_preceding) - (keyword_following) (keyword_exclude) (keyword_current) - (keyword_row) (keyword_ties) (keyword_others) - (keyword_only) - (keyword_unique) - (keyword_foreign) - (keyword_references) - (keyword_concurrently) - ; (keyword_btree) - ; (keyword_hash) - ; (keyword_gist) - ; (keyword_spgist) - ; (keyword_gin) - ; (keyword_brin) - (keyword_like) - (keyword_similar) (keyword_preserve) - (keyword_unsigned) (keyword_zerofill) - (keyword_conflict) - (keyword_do) - (keyword_nothing) - (keyword_high_priority) - (keyword_low_priority) - (keyword_delayed) - (keyword_recursive) - (keyword_cascaded) - (keyword_local) - (keyword_current_timestamp) - (keyword_check) - (keyword_option) + (keyword_format) + (keyword_fields) + (keyword_row) + (keyword_sort) + (keyword_compute) + (keyword_comment) + (keyword_location) + (keyword_cached) + (keyword_uncached) + (keyword_lines) + (keyword_stored) + (keyword_virtual) + (keyword_partitioned) + (keyword_analyze) + (keyword_explain) + (keyword_verbose) + (keyword_truncate) + (keyword_rewrite) + (keyword_optimize) (keyword_vacuum) - (keyword_wait) - (keyword_nowait) - - (keyword_trigger) - (keyword_function) - (keyword_returns) - (keyword_return) - (keyword_setof) - (keyword_atomic) - (keyword_declare) - ; (keyword_language) + (keyword_cache) + (keyword_language) (keyword_sql) + (keyword_called) + (keyword_conflict) + (keyword_declare) + (keyword_filter) + (keyword_function) + (keyword_input) + (keyword_name) + (keyword_oid) + (keyword_options) (keyword_plpgsql) - (keyword_immutable) - (keyword_stable) - (keyword_volatile) - (keyword_leakproof) - (keyword_parallel) - (keyword_safe) - (keyword_unsafe) + (keyword_precision) + (keyword_regclass) + (keyword_regnamespace) + (keyword_regproc) + (keyword_regtype) (keyword_restricted) - (keyword_called) + (keyword_return) (keyword_returns) - (keyword_input) - (keyword_strict) - (keyword_cost) - (keyword_rows) + (keyword_separator) + (keyword_setof) + (keyword_stable) (keyword_support) - - (keyword_external) - (keyword_stored) - (keyword_cached) - (keyword_uncached) - (keyword_replication) (keyword_tblproperties) - (keyword_options) - (keyword_compute) - (keyword_stats) - (keyword_statistics) - (keyword_optimize) - (keyword_rewrite) - (keyword_bin_pack) - (keyword_incremental) - (keyword_location) - (keyword_partitioned) - (keyword_comment) - (keyword_sort) - (keyword_format) - (keyword_delimited) - (keyword_fields) - (keyword_terminated) - (keyword_escaped) - (keyword_lines) - (keyword_cache) - (keyword_metadata) - (keyword_noscan) - - (keyword_parquet) - (keyword_rcfile) - (keyword_csv) - (keyword_textfile) - (keyword_avro) - (keyword_sequencefile) - (keyword_orc) - (keyword_avro) - (keyword_jsonfile) - - (keyword_precision) - (keyword_inet) + (keyword_trigger) + (keyword_unsafe) + (keyword_admin) + (keyword_connection) + (keyword_cycle) + (keyword_database) + (keyword_encrypted) + (keyword_increment) + (keyword_logged) + (keyword_none) + (keyword_owned) + (keyword_password) + (keyword_reset) + (keyword_role) + (keyword_sequence) + (keyword_start) + (keyword_restart) + (keyword_tablespace) + (keyword_until) + (keyword_user) + (keyword_valid) + (keyword_action) ] @keyword [ - (keyword_case) - (keyword_when) - (keyword_then) - (keyword_else) - (keyword_where) -] @keyword.control.conditional - -[ - (keyword_in) - (keyword_and) - (keyword_or) - (keyword_is) -] @keyword.operator + (keyword_restrict) + (keyword_unbounded) + (keyword_unique) + (keyword_cascade) + (keyword_delayed) + (keyword_high_priority) + (keyword_low_priority) + (keyword_ignore) + (keyword_nothing) + (keyword_check) + (keyword_option) + (keyword_local) + (keyword_cascaded) + (keyword_wait) + (keyword_nowait) + (keyword_metadata) + (keyword_incremental) + (keyword_bin_pack) + (keyword_noscan) + (keyword_stats) + (keyword_statistics) + (keyword_maxvalue) + (keyword_minvalue) +] @type.qualifier [ + (keyword_int) + (keyword_null) (keyword_boolean) - (bit) (keyword_binary) - + (keyword_varbinary) + (keyword_image) + (keyword_bit) + (keyword_inet) + (keyword_character) (keyword_smallserial) (keyword_serial) (keyword_bigserial) - - (tinyint) - (smallint) - (mediumint) - (int) - (bigint) - (decimal) - (numeric) + (keyword_smallint) + (keyword_mediumint) + (keyword_bigint) + (keyword_tinyint) + (keyword_decimal) + (keyword_float) + (keyword_double) + (keyword_numeric) (keyword_real) (double) - (float) - (keyword_money) - - (char) - (varchar) - (numeric) - (keyword_string) + (keyword_smallmoney) + (keyword_char) + (keyword_nchar) + (keyword_varchar) + (keyword_nvarchar) + (keyword_varying) (keyword_text) - + (keyword_string) (keyword_uuid) - (keyword_json) (keyword_jsonb) (keyword_xml) - (keyword_bytea) - (keyword_inet) - - (enum) - + (keyword_enum) (keyword_date) (keyword_datetime) + (keyword_time) + (keyword_datetime2) + (keyword_datetimeoffset) + (keyword_smalldatetime) (keyword_timestamp) (keyword_timestamptz) - - (keyword_interval) - (keyword_geometry) (keyword_geography) (keyword_box2d) (keyword_box3d) - - (keyword_oid) - (keyword_name) - (keyword_regclass) - (keyword_regnamespace) - (keyword_regproc) - (keyword_regtype) + (keyword_interval) ] @type.builtin + +[ + (keyword_in) + (keyword_and) + (keyword_or) + (keyword_not) + (keyword_by) + (keyword_on) + (keyword_do) + (keyword_union) + (keyword_except) + (keyword_intersect) +] @keyword.operator + +[ + "+" + "-" + "*" + "/" + "%" + "^" + ":=" + "=" + "<" + "<=" + "!=" + ">=" + ">" + "<>" + "->" + "->>" + "#>" + "#>>" +] @operator + +[ + "(" + ")" +] @punctuation.bracket + +[ + ";" + "," + "." +] @punctuation.delimiter From 29486a59eda3d08c5d3dd89227d8d7aeee2e3a47 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Fri, 6 Oct 2023 14:44:05 +0200 Subject: [PATCH 2/6] update highlights classes to helix flavour --- runtime/queries/sql/highlights.scm | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 54a65f43bb4b..50e6a89851f9 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -1,6 +1,6 @@ (invocation (object_reference - name: (identifier) @function.call)) + name: (identifier) @function.method)) [ (keyword_gist) @@ -10,41 +10,41 @@ (keyword_gin) (keyword_brin) (keyword_array) -] @function.call +] @function.builtin (object_reference - name: (identifier) @type) + name: (identifier) @variable.other.member) (relation - alias: (identifier) @variable) + alias: (identifier) @variable.parameter) (field - name: (identifier) @field) + name: (identifier) @variable.other.member) (term - alias: (identifier) @variable) + alias: (identifier) @variable.parameter) -((term +(term value: (cast - name: (keyword_cast) @function.call - parameter: [(literal)]?))) + name: (keyword_cast) @function.builtin + parameter: [(literal)]?)) (literal) @string -(comment) @comment @spell -(marginalia) @comment +(comment) @comment.line +(marginalia) @comment.block -((literal) @number - (#lua-match? @number "^%d+$")) +((literal) @constant.numeric.integer + (#lua-match? @constant.numeric.integer "^%d+$")) -((literal) @float -(#lua-match? @float "^[-]?%d*\.%d*$")) +((literal) @constant.numeric.float +(#lua-match? @constant.numeric.float "^[-]?%d*\.%d*$")) -(parameter) @parameter +(parameter) @variable.parameter [ (keyword_true) (keyword_false) -] @boolean +] @constant.builtin.boolean [ (keyword_asc) @@ -92,14 +92,14 @@ (keyword_jsonfile) (keyword_sequencefile) (keyword_volatile) -] @storageclass +] @keyword.storage.type [ (keyword_case) (keyword_when) (keyword_then) (keyword_else) -] @conditional +] @keyword.control.conditional [ (keyword_select) @@ -290,7 +290,7 @@ (keyword_statistics) (keyword_maxvalue) (keyword_minvalue) -] @type.qualifier +] @keyword [ (keyword_int) From 365e15ae494ff6c4dd3a5b55530f71ac37ad826c Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:15:48 +0200 Subject: [PATCH 3/6] replace lua-match with match --- runtime/queries/sql/highlights.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 50e6a89851f9..1041cc2fc15f 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -34,10 +34,10 @@ (marginalia) @comment.block ((literal) @constant.numeric.integer - (#lua-match? @constant.numeric.integer "^%d+$")) + (#match? @constant.numeric.integer "^-?\\d+$")) ((literal) @constant.numeric.float -(#lua-match? @constant.numeric.float "^[-]?%d*\.%d*$")) + (#match? @constant.numeric.float "^-?\\d*\\.\\d*$")) (parameter) @variable.parameter From aaab686b49ee0448e1c0ae7d214f9e5dfd7bef19 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:32:31 +0100 Subject: [PATCH 4/6] fix highlights syntax class --- runtime/queries/sql/highlights.scm | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 3424d0f2bc3a..46b4c716a136 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -1,6 +1,6 @@ (invocation (object_reference - name: (identifier) @function.call)) + name: (identifier) @function.method)) [ (keyword_gist) @@ -10,41 +10,41 @@ (keyword_gin) (keyword_brin) (keyword_array) -] @function.call +] @function.builtin (object_reference - name: (identifier) @type) + name: (identifier) @variable.other.member) (relation - alias: (identifier) @variable) + alias: (identifier) @variable.parameter) (field - name: (identifier) @field) + name: (identifier) @variable.other.member) (term - alias: (identifier) @variable) + alias: (identifier) @variable.parameter) ((term value: (cast - name: (keyword_cast) @function.call + name: (keyword_cast) @function.builtin parameter: [(literal)]?))) (literal) @string -(comment) @comment @spell -(marginalia) @comment +(comment) @comment.line +(marginalia) @comment.block -((literal) @number - (#match? @number "^%d+$")) +((literal) @constant.numeric.integer + (#match? @constant.numeric.integer "^%d+$")) -((literal) @float - (#match? @float "^[-|+]?%d*\.%d*$")) +((literal) @constant.numeric.float + (#match? @constant.numeric.float "^[-|+]?%d*\.%d*$")) -(parameter) @parameter +(parameter) @variable.parameter [ (keyword_true) (keyword_false) -] @boolean +] @constant.builtin.boolean [ (keyword_asc) @@ -92,14 +92,14 @@ (keyword_jsonfile) (keyword_sequencefile) (keyword_volatile) -] @storageclass +] @keyword.storage.type [ (keyword_case) (keyword_when) (keyword_then) (keyword_else) -] @conditional +] @keyword.control.conditional [ (keyword_select) @@ -330,7 +330,7 @@ (keyword_statistics) (keyword_maxvalue) (keyword_minvalue) -] @type.qualifier +] @keyword [ (keyword_int) From 04dc0b794d69ab42de157894a3119c7988b87775 Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Thu, 15 Feb 2024 14:16:01 +0100 Subject: [PATCH 5/6] fix numeric regexes --- languages.toml | 2 +- runtime/queries/sql/highlights.scm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/languages.toml b/languages.toml index bad2082e61df..744fa8e6ec6b 100644 --- a/languages.toml +++ b/languages.toml @@ -1813,7 +1813,7 @@ injection-regex = "sql" [[grammar]] name = "sql" -source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "dfa2535666a5288f00265c0934262bf634f6ee47" } +source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "4ffda1fe6841bcb2bfedb4a465c36ef8db0079b3" } [[language]] name = "gdscript" diff --git a/runtime/queries/sql/highlights.scm b/runtime/queries/sql/highlights.scm index 46b4c716a136..e575debc572a 100644 --- a/runtime/queries/sql/highlights.scm +++ b/runtime/queries/sql/highlights.scm @@ -34,10 +34,10 @@ (marginalia) @comment.block ((literal) @constant.numeric.integer - (#match? @constant.numeric.integer "^%d+$")) + (#match? @constant.numeric.integer "^[-+]?\\d+$")) ((literal) @constant.numeric.float - (#match? @constant.numeric.float "^[-|+]?%d*\.%d*$")) + (#match? @constant.numeric.float "^[-+]?\\d*\\.\\d*$")) (parameter) @variable.parameter From 833a64263643af1621c3945d3b7af12da707bcbe Mon Sep 17 00:00:00 2001 From: ds-cbo <82801887+ds-cbo@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:14:43 +0100 Subject: [PATCH 6/6] use gh-pages branch --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 744fa8e6ec6b..77a6c60dca4f 100644 --- a/languages.toml +++ b/languages.toml @@ -1813,7 +1813,7 @@ injection-regex = "sql" [[grammar]] name = "sql" -source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "4ffda1fe6841bcb2bfedb4a465c36ef8db0079b3" } +source = { git = "https://github.com/DerekStride/tree-sitter-sql", rev = "da2d1eff425b146d3c8cab7be8dfa98b11d896dc" } [[language]] name = "gdscript"