aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/koka/indents.scm
blob: 0a47bcbbd24130ae3da0fdea0898cacaab745340 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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