Quick note here, I went to implement \ x HEXDIGIT HEXDIGIT and \ [0-3] [0-7] [0-7] for escaping byte sequences in b""BYTES_LIT, but from the spec's lexis, all the escaping from STRING_LIT should be supported...
So another way to go about this is to refactor parse_string to parse_bytes_literal(s: &str) -> Result<Vec<u8>, ParseError> instead, and have the "newer" parse_string call into it to then String::from_utf8 the parsed bytes... I think that'd be closer to the spec, tho a bigger change. This change mostly allows us to now represent arbitrary byte sequence and work with them, which wasn't possible before.
Quick note here, I went to implement
\ x HEXDIGIT HEXDIGIT
and\ [0-3] [0-7] [0-7]
for escaping byte sequences inb""
BYTES_LIT
, but from the spec's lexis, all the escaping fromSTRING_LIT
should be supported...So another way to go about this is to refactor
parse_string
toparse_bytes_literal(s: &str) -> Result<Vec<u8>, ParseError>
instead, and have the "newer"parse_string
call into it to thenString::from_utf8
the parsed bytes... I think that'd be closer to the spec, tho a bigger change. This change mostly allows us to now represent arbitrary byte sequence and work with them, which wasn't possible before.