-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[text-format] Fix parsing of string literals #730
base: master
Are you sure you want to change the base?
Conversation
Can you please add some test that would fail without this PR? |
/// The raw bytes for a single char or escape sequence in a string literal | ||
/// | ||
/// The raw bytes are available via an `into_iter` implementation. | ||
pub struct DecodedBytes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be not used outside of the crate, so it should not be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the return type of a public method, so it needs to be pub. We could modify that signature to return impl Iterator
, if that is preferable?
This renames `next_byte_value` to `next_str_lit_bytes` and may return between 1..=4 bytes per call, representing the variable-length nature of the UTF-8 encoding.
0eaddf2
to
59d6e61
Compare
I've added a test case that fails without this patch but passes with it. |
Merged in bdc1428. |
It should be bumped tomorrow or so. |
This renames
next_byte_value
tonext_str_lit_bytes
and changes the signature so that it returns between 1..=4 bytes per call, representing the variable-length nature of the UTF-8 encoding.note: I'm not sure how best to add tests for this, and it needs it; in particular there should be a test case of a text-format input that contains a non-ascii string literal. There should probably also be more tests for the weird byte escapes? But definitely a case with non-ascii text.