def text.step
ezsys@0.1.0.0 · src/text.bend:112
import ezsys@0.1.0.0/src/text.bend as Text
import Base
112
113def text.step(
114 +hd: Char,
115 +tl: String,
116 mode: Mode,
117 +open: String,
118 +close: String,
119 +pairs: text.Pairs()
120) -> String & Mode:
121 match mode:
122 case Plain{}:
123 text.plain(String.starts_with(SCon{hd, tl}, open), hd, open)
124 case Opening{left}:
125 ("", text.enter(left))
126 case InKey{key}:
127 text.shut(String.starts_with(SCon{hd, tl}, close), hd, key, open, close,
128 pairs)
129 case Closing{left}:
130 ("", text.leave(left))