def lit.shape

bolt@1.27.0.0 · src/rules/correctness/arms.bend:37

import bolt@1.27.0.0/src/rules/correctness/arms.bend as Arms
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/rules/tokens.bend as T

37# `kn+p:` (p a name or `_`) or `kn:`
38def lit.shape(rest: Tree.Node, +kk: U32, +tt: String, +line: U32, +col: U32) -> Arm:
39  match rest:
40    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TOp{}, +o, l, c}},
41        Tree.NCons{Tree.Leaf{Lex.Tok{b, +p, l2, c2}}, Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TColon{}, s, l3, c3}}, more}}}:
42      Bool.pick(Arm, Bool.and(String.eq(o, "+"), binder(b)), APlus{kk, tt ++ "+" ++ p, line, col,
43        T.width(tt)}, AOther{})
44    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TColon{}, s, l, c}}, more}:
45      ALit{kk, line, col, T.width(tt)}
46    case other:
47      AOther{}

Uses (12)

Used by (1)