def text.shut
import ezsys@0.1.0.0/src/text.bend as Textimport Base
96# a character in a key: the start of the close delimiter, or part of the key
97def text.shut(
98 at: Bool,
99 hd: Char,
100 +key: String,
101 +open: String,
102 +close: String,
103 +pairs: text.Pairs()
104) -> String & Mode:
105 match at:
106 case False{}:
107 ("", InKey{key ++ SCon{hd, SNil{}}})
108 case True{}:
109 (text.put(open, close, key, text.value(pairs, key)),
110 text.leave(text.tail(close)))