def escaped
import yaml-for-bend@0.1.1.0/parse.bend as Parseimport Base
686# A scalar's text as the YAML test suite writes it: backslashes, breaks
687# and tabs escaped.
688def escaped(s: String) -> String:
689 match s:
690 case SNil{}:
691 ""
692 case SCon{c, t}:
693 match c:
694 case '\\':
695 "\\\\" ++ escaped(t)
696 case '\n':
697 "\\n" ++ escaped(t)
698 case '\t':
699 "\\t" ++ escaped(t)
700 case '\r':
701 "\\r" ++ escaped(t)
702 case _:
703 escaped.other(c, escaped(t))