def lf

yaml-for-bend@0.1.1.0 · scan.bend:245

import yaml-for-bend@0.1.1.0/scan.bend as Scan
import Base

245# Line breaks as "\n": "\r\n" and a lone "\r" both become one, as YAML reads
246# them.
247def lf(s: String) -> String:
248  match s:
249    case SNil{}:
250      SNil{}
251    case SCon{c, t}:
252      match c:
253        case '\r':
254          match t:
255            case SCon{'\n', u}:
256              SCon{'\n', lf(u)}
257            case _:
258              SCon{'\n', lf(t)}
259        case _:
260          SCon{c, lf(t)}

Uses (6)

Used by (1)