def Fmt.format.go

bend-kit-fmt@0.1.0.0 · fmt.bend:98

import bend-kit-fmt@0.1.0.0/fmt.bend as Fmt
import Base

98# Each token eats at least one char, so fuel f is the template length.
99def Fmt.format.go(f: Nat, p: Tok & String, args: List<&2, String>) -> String:
100  match f:
101    case 0n:
102      SNil{}
103    case 1n+g:
104      (tok, rest) = p
105      match tok:
106        case TEnd{}:
107          SNil{}
108        case TChr{c}:
109          SCon{c, Fmt.format.go(g, Fmt.next(rest), args)}
110        case THole{}:
111          match args:
112            case Nil{}:
113              "{}" ++ Fmt.format.go(g, Fmt.next(rest), Nil{})
114            case Con{a, more}:
115              a ++ Fmt.format.go(g, Fmt.next(rest), more)

Uses (8)

Used by (1)