From 2e4653ea312dcb69d2453eccaa7c0f873cce6aa5 Mon Sep 17 00:00:00 2001 From: Matthew Toohey Date: Mon, 18 Mar 2024 08:14:10 -0400 Subject: add koka language support (#8727) Co-authored-by: Pascal Kuthe --- runtime/queries/koka/indents.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 runtime/queries/koka/indents.scm (limited to 'runtime/queries/koka/indents.scm') 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 -- cgit v1.2.3-70-g09d2