def as_call

bolt@1.27.0.0 · src/rules/pedantic/rewalk.bend:163

import bolt@1.27.0.0/src/rules/pedantic/rewalk.bend as Rewalk
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

163# the chain is exactly one call, or one pair of parentheses around one: its callee
164def as_call(nn: Tree.Node) -> Maybe<&2, Lex.Tok>:
165  match nn:
166    case Tree.NCons{Tree.Group{Lex.Tok{k, +o, l, c}, +kids, close}, Tree.NNil{}}:
167      as_wrapped(String.eq(o, "("), kids)
168    case Tree.NCons{Tree.Leaf{tok}, Tree.NCons{Tree.Group{Lex.Tok{k, +o, l, c}, kids, close}, Tree.NNil{}}}:
169      as_open(String.eq(o, "("), tok)
170    case other:
171      None{}

Uses (6)

Used by (2)