mirror of
https://github.com/helix-editor/helix.git
synced 2025-10-06 00:13:28 +02:00
Update koka grammar and queries to support koka v3 (#14135)
This commit is contained in:
@@ -3806,7 +3806,7 @@ language-servers = ["koka"]
|
||||
|
||||
[[grammar]]
|
||||
name = "koka"
|
||||
source = { git = "https://github.com/mtoohey31/tree-sitter-koka", rev = "96d070c3700692858035f3524cc0ad944cef2594" }
|
||||
source = { git = "https://github.com/koka-community/tree-sitter-koka", rev = "fd3b482274d6988349ba810ea5740e29153b1baf" }
|
||||
|
||||
[[language]]
|
||||
name = "tact"
|
||||
|
@@ -1,202 +1,26 @@
|
||||
; 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))
|
||||
|
||||
(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)
|
||||
])))
|
||||
"[")
|
||||
; Comment
|
||||
|
||||
[
|
||||
"initially"
|
||||
"finally"
|
||||
] @function.special
|
||||
(linecomment)
|
||||
(blockcomment)
|
||||
] @comment
|
||||
|
||||
; Function definitions
|
||||
; Literals
|
||||
|
||||
(puredecl
|
||||
(funid
|
||||
(identifier
|
||||
[(varid) (idop)] @function)))
|
||||
(string) @string
|
||||
(char) @constant.character
|
||||
|
||||
(fundecl
|
||||
(funid
|
||||
(identifier
|
||||
[(varid) (idop)] @function)))
|
||||
(escape) @constant.character.escape
|
||||
|
||||
(operation
|
||||
(identifier
|
||||
[(varid) (idop)] @function))
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"!"
|
||||
"~"
|
||||
"="
|
||||
":="
|
||||
(idop)
|
||||
(op)
|
||||
(qidop)
|
||||
] @operator
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"as"
|
||||
"behind"
|
||||
(externtarget)
|
||||
"forall"
|
||||
"handle"
|
||||
"handler"
|
||||
"in"
|
||||
"infix"
|
||||
"infixl"
|
||||
"infixr"
|
||||
"inject"
|
||||
"mask"
|
||||
"other"
|
||||
"pub"
|
||||
"public"
|
||||
"some"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"con"
|
||||
"control"
|
||||
"ctl"
|
||||
"fn"
|
||||
"fun"
|
||||
"rawctl"
|
||||
"rcontrol"
|
||||
] @keyword.function
|
||||
|
||||
"with" @keyword.control
|
||||
|
||||
[
|
||||
"elif"
|
||||
"else"
|
||||
"if"
|
||||
"match"
|
||||
"then"
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
"import"
|
||||
"include"
|
||||
"module"
|
||||
] @keyword.control.import
|
||||
|
||||
[
|
||||
"alias"
|
||||
"effect"
|
||||
"struct"
|
||||
"type"
|
||||
"val"
|
||||
"var"
|
||||
] @keyword.storage.type
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"co"
|
||||
"extend"
|
||||
"extern"
|
||||
"fbip"
|
||||
"final"
|
||||
"fip"
|
||||
"inline"
|
||||
"linear"
|
||||
"named"
|
||||
"noinline"
|
||||
"open"
|
||||
"override"
|
||||
"raw"
|
||||
"rec"
|
||||
"ref"
|
||||
"reference"
|
||||
"scoped"
|
||||
"tail"
|
||||
"value"
|
||||
] @keyword.storage.modifier
|
||||
|
||||
"return" @keyword.control.return
|
||||
(float) @constant.numeric.float
|
||||
(int) @constant.numeric.integer
|
||||
|
||||
; Delimiters
|
||||
|
||||
(matchrule "|" @punctuation.delimiter)
|
||||
|
||||
(tatomic "|" @punctuation.delimiter)
|
||||
|
||||
[
|
||||
","
|
||||
"->"
|
||||
@@ -218,21 +42,190 @@
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; Literals
|
||||
; Keywords
|
||||
|
||||
[
|
||||
(string)
|
||||
(char)
|
||||
] @string
|
||||
"as"
|
||||
(externtarget)
|
||||
"forall"
|
||||
"handle"
|
||||
"handler"
|
||||
"in"
|
||||
"infix"
|
||||
"infixl"
|
||||
"infixr"
|
||||
"mask"
|
||||
(behindmod)
|
||||
(pub)
|
||||
"some"
|
||||
] @keyword
|
||||
|
||||
(escape) @constant.character.escape
|
||||
; Lazy constructor
|
||||
(constructor
|
||||
"lazy" @keyword)
|
||||
|
||||
(float) @constant.numeric.float
|
||||
(int) @constant.numeric.integer
|
||||
|
||||
; Comment
|
||||
; Lazy match
|
||||
(matchexpr
|
||||
"lazy" @keyword)
|
||||
|
||||
[
|
||||
(linecomment)
|
||||
(blockcomment)
|
||||
] @comment
|
||||
(con)
|
||||
"ctl"
|
||||
"fn"
|
||||
"fun"
|
||||
] @keyword.function
|
||||
|
||||
"with" @keyword.control
|
||||
|
||||
[
|
||||
"elif"
|
||||
"else"
|
||||
"if"
|
||||
"match"
|
||||
"then"
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
"import"
|
||||
;"include"
|
||||
"module"
|
||||
] @keyword.control.import
|
||||
|
||||
[
|
||||
"alias"
|
||||
"effect"
|
||||
"struct"
|
||||
"type"
|
||||
"val"
|
||||
"var"
|
||||
] @keyword.storage.type
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"extern"
|
||||
"final"
|
||||
(inlinemod)
|
||||
(externinline)
|
||||
(typemod)
|
||||
(structmod)
|
||||
(effectmod)
|
||||
"named"
|
||||
(override)
|
||||
(controlmod)
|
||||
;"scoped" ; scoped is actually an effect modifier, but it is not in the current parser.
|
||||
(tailmod)
|
||||
] @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
|
||||
|
||||
(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
|
||||
|
||||
[
|
||||
"initially"
|
||||
"finally"
|
||||
] @function.builtin
|
||||
|
@@ -1,9 +1,9 @@
|
||||
[
|
||||
(appexpr ["[" "("]) ; Applications.
|
||||
(opexpr [index: (arguments) call: (arguments)]) ; Applications.
|
||||
(atom ["[" "("]) ; Lists and tuples.
|
||||
(program (moduledecl "{")) ; Braced module declarations.
|
||||
(funbody)
|
||||
(block)
|
||||
(constructor)
|
||||
(handlerexpr)
|
||||
(opclausex)
|
||||
] @indent
|
||||
|
@@ -1,25 +0,0 @@
|
||||
(modulebody) @local.scope
|
||||
|
||||
(block) @local.scope
|
||||
|
||||
(pparameter
|
||||
(pattern
|
||||
(identifier
|
||||
(varid) @local.definition.variable.parameter)))
|
||||
|
||||
(puredecl
|
||||
(funid
|
||||
(identifier
|
||||
(varid) @local.definition.function)))
|
||||
|
||||
(puredecl
|
||||
(binder
|
||||
(identifier
|
||||
(varid) @local.definition.function)))
|
||||
|
||||
(decl
|
||||
(binder
|
||||
(identifier
|
||||
(varid) @local.definition.function)))
|
||||
|
||||
(identifier (varid) @local.reference)
|
Reference in New Issue
Block a user