-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
languages: add koka #8727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
languages: add koka #8727
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,272 @@ | ||
| ; Function calls | ||
|
|
||
| (appexpr | ||
| function: (appexpr | ||
| (atom | ||
| (qidentifier | ||
| [ | ||
| (qvarid) @function | ||
| (qidop) @function | ||
| (identifier | ||
| [(varid) (idop)] @function) | ||
| ]))) | ||
| ["(" (block) (fnexpr)]) | ||
|
|
||
| (ntlappexpr | ||
| function: (ntlappexpr | ||
| (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) | ||
| ]))) | ||
| "[") | ||
|
|
||
| (ntlappexpr | ||
| field: (atom | ||
| (qidentifier | ||
| [ | ||
| (qvarid) @function | ||
| (qidop) @function | ||
| (identifier | ||
| [(varid) (idop)] @function) | ||
| ]))) | ||
|
|
||
| (ntlappexpr | ||
| (ntlappexpr | ||
| field: (atom | ||
| (qidentifier | ||
| [ | ||
| (qvarid) @variable | ||
| (qidop) @variable | ||
| (identifier | ||
| [(varid) (idop)] @variable) | ||
| ]))) | ||
| "[") | ||
|
|
||
| [ | ||
| "initially" | ||
| "finally" | ||
| ] @function.special | ||
|
|
||
| ; Function definitions | ||
|
|
||
| (puredecl | ||
| (funid | ||
| (identifier | ||
| [(varid) (idop)] @function))) | ||
|
|
||
| (fundecl | ||
| (funid | ||
| (identifier | ||
| [(varid) (idop)] @function))) | ||
|
|
||
| (operation | ||
| (identifier | ||
| [(varid) (idop)] @function)) | ||
|
|
||
| ; Identifiers | ||
|
|
||
| (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) | ||
|
|
||
| (qconid) @namespace | ||
|
|
||
| (qidop) @namespace | ||
|
|
||
| (varid) @variable | ||
|
|
||
| (conid) @constructor | ||
|
|
||
| ; Operators | ||
|
|
||
| [ | ||
| "!" | ||
| "~" | ||
| "=" | ||
| ":=" | ||
| (idop) | ||
| (op) | ||
| (qidop) | ||
| ] @operator | ||
|
|
||
| ; Keywords | ||
|
|
||
| [ | ||
| "as" | ||
| "behind" | ||
| (externtarget) | ||
| "forall" | ||
| "handle" | ||
| "handler" | ||
| "in" | ||
| "infix" | ||
| "infixl" | ||
| "infixr" | ||
| "inject" | ||
| "mask" | ||
| "other" | ||
| "pub" | ||
| "public" | ||
| "some" | ||
| ] @keyword | ||
mtoohey31 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| [ | ||
| "con" | ||
| "control" | ||
| "ctl" | ||
| "fn" | ||
| "fun" | ||
| "rawctl" | ||
| "rcontrol" | ||
| ] @keyword.function | ||
|
|
||
| "with" @keyword.control | ||
|
|
||
| [ | ||
| "elif" | ||
| "else" | ||
| "if" | ||
| "match" | ||
| "then" | ||
| ] @keyword.control.conditional | ||
|
|
||
| [ | ||
| "import" | ||
| "include" | ||
| "module" | ||
mtoohey31 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ] @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 | ||
|
|
||
| ; Delimiters | ||
|
|
||
| (matchrule "|" @punctuation.delimiter) | ||
|
|
||
| [ | ||
| "," | ||
| "->" | ||
| "." | ||
| ":" | ||
| "::" | ||
| "<-" | ||
| ";" | ||
| ] @punctuation.delimiter | ||
|
|
||
| [ | ||
| "<" | ||
| ">" | ||
| "(" | ||
| ")" | ||
| "[" | ||
| "]" | ||
| "{" | ||
| "}" | ||
| ] @punctuation.bracket | ||
|
|
||
| ; Literals | ||
|
|
||
| [ | ||
| (string) | ||
| (char) | ||
| ] @string | ||
|
|
||
| (escape) @constant.character.escape | ||
|
|
||
| (float) @constant.numeric.float | ||
| (int) @constant.numeric.integer | ||
|
|
||
| ; Comment | ||
|
|
||
| [ | ||
| (linecomment) | ||
| (blockcomment) | ||
| ] @comment | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| [ | ||
| (appexpr ["[" "("]) ; Applications. | ||
| (ntlappexpr ["[" "("]) | ||
| (atom ["[" "("]) ; Lists and tuples. | ||
| (program (moduledecl "{")) ; Braced module declarations. | ||
| (funbody) | ||
| (block) | ||
| (handlerexpr) | ||
| (opclausex) | ||
| ] @indent | ||
|
|
||
| [ | ||
| (typedecl | ||
| [(typeid) (opdecls)]) ; Avoid matching single-operation effects. | ||
| (externdecl) | ||
| (matchexpr) | ||
| (matchrule) | ||
|
|
||
| ; For ifexprs, branches (once they exist) will contain blocks if they're | ||
| ; indented so we just need to make sure the initial indent happens when we're | ||
| ; creating them. | ||
| "then" | ||
| "else" | ||
| ] @indent @extend | ||
|
|
||
| (matchrule "->" @indent @extend) | ||
|
|
||
| ; Handling for error recovery. | ||
| (ERROR "fun") @indent @extend | ||
| (ERROR "match") @indent @extend | ||
| (ERROR "->" @indent.always @extend) | ||
|
|
||
| ; Don't outdent on function parameter declarations. | ||
| (atom ")" @outdent @extend.prevent-once) | ||
|
|
||
| [ | ||
| "]" | ||
| "}" | ||
| ] @outdent @extend.prevent-once |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ([(linecomment) (blockcomment)] @injection.content | ||
| (#set! injection.language "comment")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| (modulebody) @local.scope | ||
|
|
||
| (block) @local.scope | ||
|
|
||
| (pattern | ||
| (identifier | ||
| (varid) @local.definition)) | ||
|
|
||
| (decl | ||
| (apattern | ||
| (pattern | ||
| (identifier | ||
| (varid) @local.definition)))) | ||
|
|
||
| (puredecl | ||
| (funid | ||
| (identifier | ||
| (varid) @local.definition))) | ||
|
|
||
| (puredecl | ||
| (binder | ||
| (identifier | ||
| (varid) @local.definition))) | ||
|
|
||
| (decl | ||
| (binder | ||
| (identifier | ||
| (varid) @local.definition))) | ||
|
|
||
| (identifier (varid) @local.reference) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.