def step
emerging-ezjson@1.3.0.0 · src/lex.bend:247
import emerging-ezjson@1.3.0.0/src/lex.bend as Lex
import Base
247
248def step(mode: Mode, cls: Class, ch: Char, buf: List<&2, Char>, toks: List<&2, Tok>) -> Lex:
249 match mode cls:
250 case Idle{} CPunct{t}:
251 Lex{Idle{}, [], t <> toks}
252 case Idle{} CQuote{}:
253 Lex{Str{}, [], toks}
254 case Idle{} CSpace{}:
255 Lex{Idle{}, [], toks}
256 case Idle{} CBack{}:
257 Lex{Bad{}, [], toks}
258 case Idle{} COther{}:
259 Lex{Word{}, [ch], toks}
260 case Word{} CPunct{t}:
261 Lex{Idle{}, [], t <> TWord{text(buf)} <> toks}
262 case Word{} CQuote{}:
263 Lex{Str{}, [], TWord{text(buf)} <> toks}
264 case Word{} CSpace{}:
265 Lex{Idle{}, [], TWord{text(buf)} <> toks}
266 case Word{} CBack{}:
267 Lex{Bad{}, [], toks}
268 case Word{} COther{}:
269 Lex{Word{}, ch <> buf, toks}
270 case Str{} CQuote{}:
271 Lex{Idle{}, [], TStr{text(buf)} <> toks}
272 case Str{} CBack{}:
273 Lex{Esc{}, buf, toks}
274 case Str{} other:
275 step.str(ch, buf, toks)
276 case Esc{} other:
277 escape(ch, buf, toks)
278 case Uni{left, acc} other:
279 unicode(left, acc, ch, buf, toks)
280 case Hi{hi} other:
281 step.hi(hi, ch, buf, toks)
282 case HiEsc{hi} other:
283 step.hiesc(hi, ch, buf, toks)
284 case Lo{left, acc, hi} other:
285 unicode.low(left, acc, hi, ch, buf, toks)
286 case Bad{} other:
287 Lex{Bad{}, [], toks}