aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/koka/indents.scm
diff options
context:
space:
mode:
authorMatthew Toohey2024-03-18 12:14:10 +0000
committerGitHub2024-03-18 12:14:10 +0000
commit2e4653ea312dcb69d2453eccaa7c0f873cce6aa5 (patch)
treed5346475ed6f5c01e5daa8f834743b4c51a90c1f /runtime/queries/koka/indents.scm
parent94d210c9bf78af1d170534bc3398b334f289be33 (diff)
add koka language support (#8727)
Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
Diffstat (limited to 'runtime/queries/koka/indents.scm')
-rw-r--r--runtime/queries/koka/indents.scm39
1 files changed, 39 insertions, 0 deletions
diff --git a/runtime/queries/koka/indents.scm b/runtime/queries/koka/indents.scm
new file mode 100644
index 00000000..0a47bcbb
--- /dev/null
+++ b/runtime/queries/koka/indents.scm
@@ -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