in python/moz/l10n/formats/mf2/message_parser.py [0:0]
def text(self) -> str:
text = ""
at_esc = False
for ch in self.source[self.pos :]:
if at_esc:
if ch not in esc_chars:
raise MF2ParseError(self, f"Invalid escape: \\{ch}")
text += ch
at_esc = False
elif ch == "\x00":
raise MF2ParseError(self, "NUL character is not allowed")
elif ch == "\\":
at_esc = True
elif ch == "{" or ch == "}":
break
else:
text += ch
self.pos += 1
return text