From 33ba346e60c3151fcdafc55d0e547556dc803c03 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 24 Feb 2023 06:37:45 -0500 Subject: feat!: add `@keyword.coroutine` capture --- queries/c_sharp/highlights.scm | 7 ++-- queries/clojure/highlights.scm | 14 ++++---- queries/cpp/highlights.scm | 15 ++++---- queries/dart/highlights.scm | 13 ++++--- queries/ecma/highlights.scm | 79 +++++++++++++++++++++-------------------- queries/gdscript/highlights.scm | 9 +++-- queries/hack/highlights.scm | 7 ++-- queries/kotlin/highlights.scm | 8 ++++- queries/python/highlights.scm | 7 ++-- queries/rust/highlights.scm | 7 ++-- queries/starlark/highlights.scm | 5 +++ queries/svelte/highlights.scm | 3 ++ queries/swift/highlights.scm | 6 +++- queries/thrift/highlights.scm | 11 ++++-- queries/tlaplus/highlights.scm | 4 ++- queries/vala/highlights.scm | 7 ++-- queries/zig/highlights.scm | 13 ++++--- 17 files changed, 137 insertions(+), 78 deletions(-) (limited to 'queries') diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index ddb08eca4..c2bac3c1d 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -337,8 +337,6 @@ "implicit" "explicit" "override" - "async" - "await" "class" "delegate" "enum" @@ -358,6 +356,11 @@ "fixed" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + [ "const" "extern" diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index 00a692521..e5609b25b 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -112,6 +112,9 @@ "deftype")) ((sym_lit) @keyword (#eq? @keyword "declare")) +((sym_name) @keyword.coroutine + (#any-of? @keyword.coroutine + "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "!" ">!!")) ((sym_lit) @keyword.function (#match? @keyword.function "^(defn|defn-|fn|fn[*])$")) @@ -148,13 +151,13 @@ (#any-of? @function.macro "." ".." "->" "->>" "amap" "areduce" "as->" "assert" "binding" "bound-fn" "delay" "do" "dosync" - "doto" "extend-protocol" "extend-type" "future" + "doto" "extend-protocol" "extend-type" "gen-class" "gen-interface" "io!" "lazy-cat" "lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter" "monitor-exit" "proxy" "proxy-super" "pvalues" - "refer-clojure" "reify" "set!" "some->" "some->>" "sync" + "refer-clojure" "reify" "set!" "some->" "some->>" "time" "unquote" "unquote-splicing" "var" "vswap!" - "ex-cause" "ex-data" "ex-message")) + "ex-cause" "ex-data" "ex-message")) ((sym_lit) @function.macro (#match? @function.macro "^with\\-.*$")) @@ -175,9 +178,8 @@ "any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte" "aset-char" "aset-double" "aset-float" "aset-int" "aset-long" "aset-short" "assoc" "assoc!" "assoc-in" - "associative?" "atom" "await" "await-for" "await1" - "bases" "bean" "bigdec" "bigint" "biginteger" "bit-and" - "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or" + "associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger" + "bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or" "bit-set" "bit-shift-left" "bit-shift-right" "bit-test" "bit-xor" "boolean" "boolean-array" "boolean?" "booleans" "bound-fn*" "bound?" "bounded-count" diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 1f770e9f8..0f12dd8df 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -143,11 +143,19 @@ "template" "typename" "using" - "co_await" "concept" "requires" ] @keyword +[ + "co_await" +] @keyword.coroutine + +[ + "co_yield" + "co_return" +] @keyword.coroutine.return + [ "public" "private" @@ -156,11 +164,6 @@ "final" ] @type.qualifier -[ - "co_yield" - "co_return" -] @keyword.return - [ "new" "delete" diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm index f5e391092..154a92b3a 100644 --- a/queries/dart/highlights.scm +++ b/queries/dart/highlights.scm @@ -195,14 +195,12 @@ [ "return" - "yield" ] @keyword.return ; Built in identifiers: ; alone these are marked as keywords [ - "await" "deferred" "factory" "get" @@ -216,17 +214,22 @@ "typedef" ] @keyword +[ + "async" + "async*" + "sync*" + "await" + "yield" +] @keyword.coroutine + [ (const_builtin) (final_builtin) "abstract" - "async" - "async*" "covariant" "dynamic" "external" "static" - "sync*" ] @type.qualifier ; when used as an identifier: diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm index e347098a3..cdae02ab2 100644 --- a/queries/ecma/highlights.scm +++ b/queries/ecma/highlights.scm @@ -210,15 +210,15 @@ ;---------- [ -"if" -"else" -"switch" -"case" + "if" + "else" + "switch" + "case" ] @conditional [ -"import" -"from" + "import" + "from" ] @include (export_specifier "as" @include) @@ -227,53 +227,56 @@ (namespace_import "as" @include) [ -"for" -"of" -"do" -"while" -"continue" + "for" + "of" + "do" + "while" + "continue" ] @repeat [ -"async" -"await" -"break" -"class" -"const" -"debugger" -"export" -"extends" -"get" -"in" -"instanceof" -"let" -"set" -"static" -"target" -"typeof" -"var" -"with" + "break" + "class" + "const" + "debugger" + "export" + "extends" + "get" + "in" + "instanceof" + "let" + "set" + "static" + "target" + "typeof" + "var" + "with" ] @keyword [ -"return" -"yield" + "async" + "await" +] @keyword.coroutine + +[ + "return" + "yield" ] @keyword.return [ - "function" + "function" ] @keyword.function [ - "new" - "delete" + "new" + "delete" ] @keyword.operator [ - "throw" - "try" - "catch" - "finally" + "throw" + "try" + "catch" + "finally" ] @exception (export_statement diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 073096556..c6c6dae13 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -159,12 +159,15 @@ "func" @keyword.function [ - "await" "return" ] @keyword.return -(call (identifier) @keyword.return - (#eq? @keyword.return "yield")) +[ + "await" +] @keyword.coroutine + +(call (identifier) @keyword.coroutine + (#eq? @keyword.coroutine "yield")) ;; Builtins diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm index e79d62c75..ffb365c87 100644 --- a/queries/hack/highlights.scm +++ b/queries/hack/highlights.scm @@ -17,8 +17,6 @@ "function" @keyword.function [ - "async" - "await" "type" "interface" "implements" @@ -31,6 +29,11 @@ "insteadof" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + [ "use" "include" diff --git a/queries/kotlin/highlights.scm b/queries/kotlin/highlights.scm index 2fd2c089b..caf62f1f0 100644 --- a/queries/kotlin/highlights.scm +++ b/queries/kotlin/highlights.scm @@ -307,7 +307,13 @@ ; "typeof" ; NOTE: It is reserved for future use ] @keyword -("fun") @keyword.function +[ + "suspend" +] @keyword.coroutine + +[ + "fun" +] @keyword.function (jump_expression) @keyword.return diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 54ad82b09..fe66d7ca3 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -240,8 +240,6 @@ [ "assert" - "async" - "await" "class" "exec" "global" @@ -252,6 +250,11 @@ "as" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + [ "return" "yield" diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index db80fbb32..c24a278f6 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -169,8 +169,6 @@ (use_as_clause "as" @include) [ - "async" - "await" "default" "dyn" "enum" @@ -188,6 +186,11 @@ "where" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + [ "ref" (mutable_specifier) diff --git a/queries/starlark/highlights.scm b/queries/starlark/highlights.scm index 401b985d7..a92832d68 100644 --- a/queries/starlark/highlights.scm +++ b/queries/starlark/highlights.scm @@ -228,6 +228,11 @@ "as" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + [ "return" ] @keyword.return diff --git a/queries/svelte/highlights.scm b/queries/svelte/highlights.scm index 058682a7c..e1a67296e 100644 --- a/queries/svelte/highlights.scm +++ b/queries/svelte/highlights.scm @@ -8,6 +8,9 @@ (as) ] @keyword +((special_block_keyword) @keyword.coroutine + (#eq? @keyword.coroutine "await")) + [ "{" "}" diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm index c6220984e..5773c2377 100644 --- a/queries/swift/highlights.scm +++ b/queries/swift/highlights.scm @@ -22,7 +22,6 @@ (function_declaration (simple_identifier) @method) (function_declaration ["init" @constructor]) (throws) @keyword -"async" @keyword (where_keyword) @keyword (parameter external_name: (simple_identifier) @parameter) (parameter name: (simple_identifier) @parameter) @@ -47,6 +46,11 @@ "some" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + [ (getter_specifier) (setter_specifier) diff --git a/queries/thrift/highlights.scm b/queries/thrift/highlights.scm index c6ff6464f..5df609c3d 100644 --- a/queries/thrift/highlights.scm +++ b/queries/thrift/highlights.scm @@ -86,7 +86,6 @@ "include" "interaction" "namespace" - "oneway" "optional" "required" "senum" @@ -96,10 +95,13 @@ "union" ] @keyword +[ + "oneway" +] @keyword.coroutine + ; Deprecated Keywords [ - "async" "cocoa_prefix" "cpp_namespace" "csharp_namespace" @@ -118,7 +120,12 @@ "xsd_optional" ] @keyword +[ + "async" +] @keyword.coroutine + ; Extended Keywords + [ "client" "idempotent" diff --git a/queries/tlaplus/highlights.scm b/queries/tlaplus/highlights.scm index a94a91f4e..2199359f8 100644 --- a/queries/tlaplus/highlights.scm +++ b/queries/tlaplus/highlights.scm @@ -81,7 +81,6 @@ (pcal_algorithm_start) "algorithm" "assert" - "await" "begin" "call" "define" @@ -98,6 +97,9 @@ "when" "with" ] @keyword +[ + "await" +] @keyword.coroutine (pcal_with ("=") @keyword) (pcal_process ("=") @keyword) [ diff --git a/queries/vala/highlights.scm b/queries/vala/highlights.scm index 1c9732dff..5ad7e0345 100644 --- a/queries/vala/highlights.scm +++ b/queries/vala/highlights.scm @@ -90,7 +90,6 @@ [ "abstract" - "async" "class" "construct" "continue" @@ -114,6 +113,11 @@ "with" ] @keyword +[ + "async" + "yield" +] @keyword.coroutine + [ "const" "dynamic" @@ -183,7 +187,6 @@ [ "return" - "yield" ] @keyword.return [ diff --git a/queries/zig/highlights.scm b/queries/zig/highlights.scm index e3e91dc65..60e5b373a 100644 --- a/queries/zig/highlights.scm +++ b/queries/zig/highlights.scm @@ -95,10 +95,17 @@ field_constant: (IDENTIFIER) @constant "asm" "defer" "errdefer" - "nosuspend" "test" ] @keyword +[ + "async" + "await" + "suspend" + "nosuspend" + "resume" +] @keyword.coroutine + [ "fn" ] @keyword.function @@ -111,10 +118,6 @@ field_constant: (IDENTIFIER) @constant [ "return" - "async" - "await" - "suspend" - "resume" ] @keyword.return [ -- cgit v1.2.3-70-g09d2