def esc
bend-kit-regex@0.8.0.0 · regex.bend:117
import bend-kit-regex@0.8.0.0/regex.bend as Regex
import Base
117
118def esc(s: String) -> Esc:
119 match s:
120 case SNil{}:
121 EBad{}
122 case SCon{'d', t}:
123 EItems{perl.d(), t}
124 case SCon{'D', t}:
125 EItems{perl.D(), t}
126 case SCon{'w', t}:
127 EItems{perl.w(), t}
128 case SCon{'W', t}:
129 EItems{perl.W(), t}
130 case SCon{'s', t}:
131 EItems{perl.s(), t}
132 case SCon{'S', t}:
133 EItems{perl.S(), t}
134 case SCon{'p', t}:
135 prop(False{}, t)
136 case SCon{'P', t}:
137 prop(True{}, t)
138 case SCon{'A', t}:
139 EAssert{0, t}
140 case SCon{'z', t}:
141 EAssert{1, t}
142 case SCon{'b', t}:
143 EAssert{2, t}
144 case SCon{'B', t}:
145 EAssert{3, t}
146 case SCon{'n', t}:
147 EPoint{10, t}
148 case SCon{'t', t}:
149 EPoint{9, t}
150 case SCon{'r', t}:
151 EPoint{13, t}
152 case SCon{'f', t}:
153 EPoint{12, t}
154 case SCon{'v', t}:
155 EPoint{11, t}
156 case SCon{Chr{+c}, t}:
157 esc.other(is_alnum(c), c, t)