feat!: add @keyword.coroutine capture

This commit is contained in:
Amaan Qureshi 2023-02-24 06:37:45 -05:00 committed by Stephan Seitz
parent 1bf4be0441
commit 33ba346e60
17 changed files with 137 additions and 78 deletions

View file

@ -337,8 +337,6 @@
"implicit" "implicit"
"explicit" "explicit"
"override" "override"
"async"
"await"
"class" "class"
"delegate" "delegate"
"enum" "enum"
@ -358,6 +356,11 @@
"fixed" "fixed"
] @keyword ] @keyword
[
"async"
"await"
] @keyword.coroutine
[ [
"const" "const"
"extern" "extern"

View file

@ -112,6 +112,9 @@
"deftype")) "deftype"))
((sym_lit) @keyword ((sym_lit) @keyword
(#eq? @keyword "declare")) (#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 ((sym_lit) @keyword.function
(#match? @keyword.function "^(defn|defn-|fn|fn[*])$")) (#match? @keyword.function "^(defn|defn-|fn|fn[*])$"))
@ -148,13 +151,13 @@
(#any-of? @function.macro (#any-of? @function.macro
"." ".." "->" "->>" "amap" "areduce" "as->" "assert" "." ".." "->" "->>" "amap" "areduce" "as->" "assert"
"binding" "bound-fn" "delay" "do" "dosync" "binding" "bound-fn" "delay" "do" "dosync"
"doto" "extend-protocol" "extend-type" "future" "doto" "extend-protocol" "extend-type"
"gen-class" "gen-interface" "io!" "lazy-cat" "gen-class" "gen-interface" "io!" "lazy-cat"
"lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter" "lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter"
"monitor-exit" "proxy" "proxy-super" "pvalues" "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!" "time" "unquote" "unquote-splicing" "var" "vswap!"
"ex-cause" "ex-data" "ex-message")) "ex-cause" "ex-data" "ex-message"))
((sym_lit) @function.macro ((sym_lit) @function.macro
(#match? @function.macro "^with\\-.*$")) (#match? @function.macro "^with\\-.*$"))
@ -175,9 +178,8 @@
"any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte" "any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte"
"aset-char" "aset-double" "aset-float" "aset-int" "aset-char" "aset-double" "aset-float" "aset-int"
"aset-long" "aset-short" "assoc" "assoc!" "assoc-in" "aset-long" "aset-short" "assoc" "assoc!" "assoc-in"
"associative?" "atom" "await" "await-for" "await1" "associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger"
"bases" "bean" "bigdec" "bigint" "biginteger" "bit-and" "bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or"
"bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or"
"bit-set" "bit-shift-left" "bit-shift-right" "bit-test" "bit-set" "bit-shift-left" "bit-shift-right" "bit-test"
"bit-xor" "boolean" "boolean-array" "boolean?" "bit-xor" "boolean" "boolean-array" "boolean?"
"booleans" "bound-fn*" "bound?" "bounded-count" "booleans" "bound-fn*" "bound?" "bounded-count"

View file

@ -143,11 +143,19 @@
"template" "template"
"typename" "typename"
"using" "using"
"co_await"
"concept" "concept"
"requires" "requires"
] @keyword ] @keyword
[
"co_await"
] @keyword.coroutine
[
"co_yield"
"co_return"
] @keyword.coroutine.return
[ [
"public" "public"
"private" "private"
@ -156,11 +164,6 @@
"final" "final"
] @type.qualifier ] @type.qualifier
[
"co_yield"
"co_return"
] @keyword.return
[ [
"new" "new"
"delete" "delete"

View file

@ -195,14 +195,12 @@
[ [
"return" "return"
"yield"
] @keyword.return ] @keyword.return
; Built in identifiers: ; Built in identifiers:
; alone these are marked as keywords ; alone these are marked as keywords
[ [
"await"
"deferred" "deferred"
"factory" "factory"
"get" "get"
@ -216,17 +214,22 @@
"typedef" "typedef"
] @keyword ] @keyword
[
"async"
"async*"
"sync*"
"await"
"yield"
] @keyword.coroutine
[ [
(const_builtin) (const_builtin)
(final_builtin) (final_builtin)
"abstract" "abstract"
"async"
"async*"
"covariant" "covariant"
"dynamic" "dynamic"
"external" "external"
"static" "static"
"sync*"
] @type.qualifier ] @type.qualifier
; when used as an identifier: ; when used as an identifier:

View file

@ -210,15 +210,15 @@
;---------- ;----------
[ [
"if" "if"
"else" "else"
"switch" "switch"
"case" "case"
] @conditional ] @conditional
[ [
"import" "import"
"from" "from"
] @include ] @include
(export_specifier "as" @include) (export_specifier "as" @include)
@ -227,53 +227,56 @@
(namespace_import "as" @include) (namespace_import "as" @include)
[ [
"for" "for"
"of" "of"
"do" "do"
"while" "while"
"continue" "continue"
] @repeat ] @repeat
[ [
"async" "break"
"await" "class"
"break" "const"
"class" "debugger"
"const" "export"
"debugger" "extends"
"export" "get"
"extends" "in"
"get" "instanceof"
"in" "let"
"instanceof" "set"
"let" "static"
"set" "target"
"static" "typeof"
"target" "var"
"typeof" "with"
"var"
"with"
] @keyword ] @keyword
[ [
"return" "async"
"yield" "await"
] @keyword.coroutine
[
"return"
"yield"
] @keyword.return ] @keyword.return
[ [
"function" "function"
] @keyword.function ] @keyword.function
[ [
"new" "new"
"delete" "delete"
] @keyword.operator ] @keyword.operator
[ [
"throw" "throw"
"try" "try"
"catch" "catch"
"finally" "finally"
] @exception ] @exception
(export_statement (export_statement

View file

@ -159,12 +159,15 @@
"func" @keyword.function "func" @keyword.function
[ [
"await"
"return" "return"
] @keyword.return ] @keyword.return
(call (identifier) @keyword.return [
(#eq? @keyword.return "yield")) "await"
] @keyword.coroutine
(call (identifier) @keyword.coroutine
(#eq? @keyword.coroutine "yield"))
;; Builtins ;; Builtins

View file

@ -17,8 +17,6 @@
"function" @keyword.function "function" @keyword.function
[ [
"async"
"await"
"type" "type"
"interface" "interface"
"implements" "implements"
@ -31,6 +29,11 @@
"insteadof" "insteadof"
] @keyword ] @keyword
[
"async"
"await"
] @keyword.coroutine
[ [
"use" "use"
"include" "include"

View file

@ -307,7 +307,13 @@
; "typeof" ; NOTE: It is reserved for future use ; "typeof" ; NOTE: It is reserved for future use
] @keyword ] @keyword
("fun") @keyword.function [
"suspend"
] @keyword.coroutine
[
"fun"
] @keyword.function
(jump_expression) @keyword.return (jump_expression) @keyword.return

View file

@ -240,8 +240,6 @@
[ [
"assert" "assert"
"async"
"await"
"class" "class"
"exec" "exec"
"global" "global"
@ -252,6 +250,11 @@
"as" "as"
] @keyword ] @keyword
[
"async"
"await"
] @keyword.coroutine
[ [
"return" "return"
"yield" "yield"

View file

@ -169,8 +169,6 @@
(use_as_clause "as" @include) (use_as_clause "as" @include)
[ [
"async"
"await"
"default" "default"
"dyn" "dyn"
"enum" "enum"
@ -188,6 +186,11 @@
"where" "where"
] @keyword ] @keyword
[
"async"
"await"
] @keyword.coroutine
[ [
"ref" "ref"
(mutable_specifier) (mutable_specifier)

View file

@ -228,6 +228,11 @@
"as" "as"
] @keyword ] @keyword
[
"async"
"await"
] @keyword.coroutine
[ [
"return" "return"
] @keyword.return ] @keyword.return

View file

@ -8,6 +8,9 @@
(as) (as)
] @keyword ] @keyword
((special_block_keyword) @keyword.coroutine
(#eq? @keyword.coroutine "await"))
[ [
"{" "{"
"}" "}"

View file

@ -22,7 +22,6 @@
(function_declaration (simple_identifier) @method) (function_declaration (simple_identifier) @method)
(function_declaration ["init" @constructor]) (function_declaration ["init" @constructor])
(throws) @keyword (throws) @keyword
"async" @keyword
(where_keyword) @keyword (where_keyword) @keyword
(parameter external_name: (simple_identifier) @parameter) (parameter external_name: (simple_identifier) @parameter)
(parameter name: (simple_identifier) @parameter) (parameter name: (simple_identifier) @parameter)
@ -47,6 +46,11 @@
"some" "some"
] @keyword ] @keyword
[
"async"
"await"
] @keyword.coroutine
[ [
(getter_specifier) (getter_specifier)
(setter_specifier) (setter_specifier)

View file

@ -86,7 +86,6 @@
"include" "include"
"interaction" "interaction"
"namespace" "namespace"
"oneway"
"optional" "optional"
"required" "required"
"senum" "senum"
@ -96,10 +95,13 @@
"union" "union"
] @keyword ] @keyword
[
"oneway"
] @keyword.coroutine
; Deprecated Keywords ; Deprecated Keywords
[ [
"async"
"cocoa_prefix" "cocoa_prefix"
"cpp_namespace" "cpp_namespace"
"csharp_namespace" "csharp_namespace"
@ -118,7 +120,12 @@
"xsd_optional" "xsd_optional"
] @keyword ] @keyword
[
"async"
] @keyword.coroutine
; Extended Keywords ; Extended Keywords
[ [
"client" "client"
"idempotent" "idempotent"

View file

@ -81,7 +81,6 @@
(pcal_algorithm_start) (pcal_algorithm_start)
"algorithm" "algorithm"
"assert" "assert"
"await"
"begin" "begin"
"call" "call"
"define" "define"
@ -98,6 +97,9 @@
"when" "when"
"with" "with"
] @keyword ] @keyword
[
"await"
] @keyword.coroutine
(pcal_with ("=") @keyword) (pcal_with ("=") @keyword)
(pcal_process ("=") @keyword) (pcal_process ("=") @keyword)
[ [

View file

@ -90,7 +90,6 @@
[ [
"abstract" "abstract"
"async"
"class" "class"
"construct" "construct"
"continue" "continue"
@ -114,6 +113,11 @@
"with" "with"
] @keyword ] @keyword
[
"async"
"yield"
] @keyword.coroutine
[ [
"const" "const"
"dynamic" "dynamic"
@ -183,7 +187,6 @@
[ [
"return" "return"
"yield"
] @keyword.return ] @keyword.return
[ [

View file

@ -95,10 +95,17 @@ field_constant: (IDENTIFIER) @constant
"asm" "asm"
"defer" "defer"
"errdefer" "errdefer"
"nosuspend"
"test" "test"
] @keyword ] @keyword
[
"async"
"await"
"suspend"
"nosuspend"
"resume"
] @keyword.coroutine
[ [
"fn" "fn"
] @keyword.function ] @keyword.function
@ -111,10 +118,6 @@ field_constant: (IDENTIFIER) @constant
[ [
"return" "return"
"async"
"await"
"suspend"
"resume"
] @keyword.return ] @keyword.return
[ [