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