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
support bytes creation from hex and ascii #843
Conversation
parser/src/lexer.rs
Outdated
escape = false; | ||
} | ||
x => { | ||
if hex_on { |
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.
I think this if statement must be around the match like this:
if hex_on {
process digit
} else {
match c {
// the rest
}
}
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.
done, with a bigger match, i think, it'll be clearer
parser/src/lexer.rs
Outdated
} | ||
} else { | ||
if escape { | ||
res.push(92); |
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.
Always push 92 here? Not x
?
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.
yes backslash (92) was seen at previous loop but not added since you need the following char to know if its a "pure" backslash or a backslash of a \xXX. So I add the "pure" backslash at next loop before to add c
if we are not hex_on
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.
Maybe you could do '\\' as u8
to make it more clear what character you're adding.
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.
I thought everyone knows ascii table by heart 😁
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.
following clippy i'll use b'x' notation : https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8
Codecov Report
@@ Coverage Diff @@
## master #843 +/- ##
==========================================
+ Coverage 63.16% 63.19% +0.02%
==========================================
Files 87 87
Lines 14382 14467 +85
Branches 3257 3272 +15
==========================================
+ Hits 9085 9143 +58
- Misses 3160 3178 +18
- Partials 2137 2146 +9
Continue to review full report at Codecov.
|
this allows b"blabla\x0f\x1dblabla"