From eb09e80e4d78b6d7cdbda2d38898fdab824f6870 Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Tue, 27 Sep 2022 17:24:39 +0100 Subject: [PATCH 1/3] Update highlights.scm --- runtime/queries/wgsl/highlights.scm | 60 +++++++++++++++++------------ 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/runtime/queries/wgsl/highlights.scm b/runtime/queries/wgsl/highlights.scm index 7fbc87d827f1..5286bce7611f 100644 --- a/runtime/queries/wgsl/highlights.scm +++ b/runtime/queries/wgsl/highlights.scm @@ -1,23 +1,41 @@ -(const_literal) @constant.numeric +(int_literal) @constant.numeric.integer +(float_literal) @constant.numeric.float +(bool_literal) @constant.builtin.boolean -(type_declaration) @type +(global_constant_declaration) @variable +(global_variable_declaration) @variable +(compound_statement) @variable +(const_expression) @function + +(variable_identifier_declaration + (identifier) @variable + (type_declaration) @type) (function_declaration - (identifier) @function) + (identifier) @function + (function_return_type_declaration + (type_declaration) @type)) + +(parameter + (variable_identifier_declaration + (identifier) @variable.parameter + (type_declaration) @type)) (struct_declaration (identifier) @type) + +(struct_declaration + (struct_member + (variable_identifier_declaration + (identifier) @variable.other.member + (type_declaration) @type))) (type_constructor_or_function_call_expression (type_declaration) @function) -(parameter - (variable_identifier_declaration (identifier) @variable.parameter)) - [ "struct" "bitcast" - ; "block" "discard" "enable" "fallthrough" @@ -26,36 +44,28 @@ "private" "read" "read_write" - "return" "storage" "type" "uniform" "var" "workgroup" "write" + "override" (texel_format) -] @keyword ; TODO reserved keywords +] @keyword -[ - (true) - (false) -] @constant.builtin.boolean +"fn" @keyword.function + +"return" @keyword.control.return [ "," "." ":" ";" ] @punctuation.delimiter -;; brackets -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket +["(" ")" "[" "]" "{" "}"] @punctuation.bracket [ "loop" "for" + "while" "break" "continue" "continuing" @@ -64,7 +74,6 @@ [ "if" "else" - "elseif" "switch" "case" "default" @@ -92,10 +101,13 @@ "*" "~" "^" + "@" + "++" + "--" ] @operator (attribute - (identifier) @variable.other.member) + (identifier) @attribute) (comment) @comment From 4f3b61fec24e57fc52a29b9e2a650026d2d9aa70 Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Tue, 27 Sep 2022 17:26:52 +0100 Subject: [PATCH 2/3] Update languages.toml --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index a7b8f93d4ad0..ab204fcce255 100644 --- a/languages.toml +++ b/languages.toml @@ -848,7 +848,7 @@ indent = { tab-width = 4, unit = " " } [[grammar]] name = "wgsl" -source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "f00ff52251edbd58f4d39c9c3204383253032c11" } +source = { git = "https://github.com/szebniok/tree-sitter-wgsl", rev = "272e89ef2aeac74178edb9db4a83c1ffef80a463" } [[language]] name = "llvm" From 042b1e6380e42510379699d43faeeb477fbe5153 Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Fri, 30 Sep 2022 21:25:20 +0100 Subject: [PATCH 3/3] Update highlights.scm Cleaned up the formatting --- runtime/queries/wgsl/highlights.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/wgsl/highlights.scm b/runtime/queries/wgsl/highlights.scm index 5286bce7611f..baf9dd8fc7be 100644 --- a/runtime/queries/wgsl/highlights.scm +++ b/runtime/queries/wgsl/highlights.scm @@ -25,7 +25,7 @@ (identifier) @type) (struct_declaration - (struct_member + (struct_member (variable_identifier_declaration (identifier) @variable.other.member (type_declaration) @type))) @@ -58,7 +58,7 @@ "return" @keyword.control.return -[ "," "." ":" ";" ] @punctuation.delimiter +["," "." ":" ";"] @punctuation.delimiter ["(" ")" "[" "]" "{" "}"] @punctuation.bracket