Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/koka/highlights.scm')
-rw-r--r--runtime/queries/koka/highlights.scm313
1 files changed, 160 insertions, 153 deletions
diff --git a/runtime/queries/koka/highlights.scm b/runtime/queries/koka/highlights.scm
index 65eb441d..cec2881f 100644
--- a/runtime/queries/koka/highlights.scm
+++ b/runtime/queries/koka/highlights.scm
@@ -1,51 +1,122 @@
-; Comment
+; Identifiers
-[
- (linecomment)
- (blockcomment)
-] @comment
+(qconid) @namespace
-; Literals
+(qidop) @namespace
-(string) @string
-(char) @constant.character
+(varid) @variable
-(escape) @constant.character.escape
+(conid) @constructor
-(float) @constant.numeric.float
-(int) @constant.numeric.integer
+(puredecl
+ (binder
+ (identifier
+ [(varid) (idop)] @constant)))
-; Delimiters
+; TODO: Highlight vars differently once helix has an appropriate highlight query
+; for that purpose.
-(matchrule "|" @punctuation.delimiter)
+(pparameter
+ (pattern
+ (identifier
+ (varid) @variable.parameter)))
+
+(paramid
+ (identifier
+ (varid) @variable.parameter))
-(tatomic "|" @punctuation.delimiter)
+(typedecl
+ "effect"
+ (varid) @type)
+
+(typeid
+ (varid) @type)
+
+(tbinder
+ (varid) @type)
+
+(typecon
+ (varid) @type)
+
+(qvarid
+ (qid) @namespace)
+
+(modulepath (varid) @namespace)
+
+; Function calls
+
+(appexpr
+ function: (appexpr
+ (atom
+ (qidentifier
+ [
+ (qvarid) @function
+ (qidop) @function
+ (identifier
+ [(varid) (idop)] @function)
+ ])))
+ ["(" (block) (fnexpr)])
+
+(appexpr
+ field: (atom
+ (qidentifier
+ [
+ (qvarid) @function
+ (qidop) @function
+ (identifier
+ [(varid) (idop)] @function)
+ ])))
+
+(appexpr
+ (appexpr
+ field: (atom
+ (qidentifier
+ [
+ (qvarid) @variable
+ (qidop) @variable
+ (identifier
+ [(varid) (idop)] @variable)
+ ])))
+ "[")
[
- ","
- "->"
- "."
- ":"
- "::"
- "<-"
- ";"
-] @punctuation.delimiter
+ "initially"
+ "finally"
+] @function.special
+
+; Function definitions
+
+(puredecl
+ (funid
+ (identifier
+ [(varid) (idop)] @function)))
+
+(fundecl
+ (funid
+ (identifier
+ [(varid) (idop)] @function)))
+
+(operation
+ (identifier
+ [(varid) (idop)] @function))
+
+; Operators
[
- "<"
- ">"
- "("
- ")"
- "["
- "]"
- "{"
- "}"
-] @punctuation.bracket
+ "!"
+ "~"
+ "="
+ ":="
+ (idop)
+ (op)
+ (qidop)
+] @operator
; Keywords
[
"as"
+ "behind"
(externtarget)
"forall"
"handle"
@@ -54,25 +125,22 @@
"infix"
"infixl"
"infixr"
+ "inject"
"mask"
- (behindmod)
- (pub)
+ "other"
+ "pub"
+ "public"
"some"
] @keyword
-; Lazy constructor
-(constructor
- "lazy" @keyword)
-
-; Lazy match
-(matchexpr
- "lazy" @keyword)
-
[
- (con)
+ "con"
+ "control"
"ctl"
"fn"
"fun"
+ "rawctl"
+ "rcontrol"
] @keyword.function
"with" @keyword.control
@@ -87,7 +155,7 @@
[
"import"
- ;"include"
+ "include"
"module"
] @keyword.control.import
@@ -102,130 +170,69 @@
[
"abstract"
+ "co"
+ "extend"
"extern"
+ "fbip"
"final"
- (inlinemod)
- (externinline)
- (typemod)
- (structmod)
- (effectmod)
+ "fip"
+ "inline"
+ "linear"
"named"
- (override)
- (controlmod)
- ;"scoped" ; scoped is actually an effect modifier, but it is not in the current parser.
- (tailmod)
+ "noinline"
+ "open"
+ "override"
+ "raw"
+ "rec"
+ "ref"
+ "reference"
+ "scoped"
+ "tail"
+ "value"
] @keyword.storage.modifier
-(fipmod
- ["fip" "fbip"] @keyword.storage.modifier)
-
"return" @keyword.control.return
-; Operators
-
-[
- "!"
- "~"
- "="
- ":="
- (idop)
- (op)
- (qidop)
-] @operator
-
-(modulepath) @namespace
-
-; Variables
-
-(pattern
- (identifier
- (varid) @variable))
-
-(paramid
- (identifier
- (varid) @variable.parameter))
-
-(pparameter
- (pattern
- (identifier
- (varid) @variable.parameter)))
-
-(pparameter
- (qimplicit) @variable.parameter)
-
-(puredecl
- (binder
- (qidentifier) @constant))
-
-; Named arguments
-(argument
- [(identifier) (qimplicit)] @variable.parameter
- "="
- (expr))
-
-; Types
-
-(typecon
- [(varid) (qvarid)] @type)
-
-(tbinder
- (varid) @type)
-
-(typeid
- (varid) @type)
-
-(typedecl
- "effect"
- (varid) @type)
-
-; Function definitions
-
-(fundecl
- (identifier) @function)
-
-(puredecl
- (qidentifier) @function)
-
-(externdecl
- (qidentifier) @function)
-
-; Effect definitions/usages
+; Delimiters
-(opclause
- (qidentifier) @function)
+(matchrule "|" @punctuation.delimiter)
-(operation
- (identifier) @function)
-
+[
+ ","
+ "->"
+ "."
+ ":"
+ "::"
+ "<-"
+ ";"
+] @punctuation.delimiter
-; Function calls
+[
+ "<"
+ ">"
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
-(opexpr
- (atom
- (name) @function)
- .
- [
- call: "(" (arguments)? ")"
- trailing_lambda: [(block) (fnexpr)]
- ])
+; Literals
-(opexpr
- (atom)
- (name) @function)
+[
+ (string)
+ (char)
+] @string
-(ntlexpr
- (atom
- (name) @function)
- .
- ("(" (arguments)? ")"))
+(escape) @constant.character.escape
-(ntlexpr
- (atom)
- (name) @function)
+(float) @constant.numeric.float
+(int) @constant.numeric.integer
-[(conid) (qconid)] @constructor
+; Comment
[
- "initially"
- "finally"
-] @function.builtin
+ (linecomment)
+ (blockcomment)
+] @comment