unescape_string

Function unescape_string 

Source
pub fn unescape_string(s: &str) -> Result<String, String>
Expand description

Unescape special characters in a quoted string.

Per TOON spec §7.1, only these escape sequences are valid:

  • \\\
  • \""
  • \n → newline
  • \r → carriage return
  • \t → tab

Any other escape sequence MUST cause an error.

§Errors

Returns an error if the string contains an invalid escape sequence or if a backslash appears at the end of the string.