def look.plan

emerging-ezjson@1.3.0.0 · src/pull.bend:520

import emerging-ezjson@1.3.0.0/src/pull.bend as Pull
import Base
import emerging-ezjson@1.3.0.0/src/lex.bend as Lex

520# one character between tokens. The suffix stays with the stepper: a bracket
521# closes on it, a comma does not keep it, and a word keeps only its own char
522def look.plan(
523  ch: Char,
524  +stack: List<&2, Frame>,
525  +goal: Goal,
526  +done: Bool,
527  cls: Lex.Class
528) -> St:
529  match cls:
530    case Lex.CSpace{}:
531      idle.space(stack, goal, done)
532    case Lex.CPunct{tok}:
533      punct.on(tok, stack, goal, done)
534    case Lex.CQuote{}:
535      look.quote(stack, goal, done, expect.str.for(stack, goal, done))
536    case Lex.CBack{}:
537      err.st(goal)
538    case Lex.COther{}:
539      look.word(ch, stack, goal, done, expect.val(stack, done))

Uses (14)

Used by (1)