-
Notifications
You must be signed in to change notification settings - Fork 14
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
Ensure Char doesn't match provided delim before marking OK #153
Conversation
In the switch to making Char non-greedy in the 2.5 release, I failed to account for the fact that the parsed Char may in fact be the delimiter provided, in which case we want to match the delim instead of treating it as a successfully parsed Char (Char is greedy in this way like Strings). Luckily we can still do this pretty efficiently by checking our parsed Char against the delimiter, if there is one.
Codecov ReportBase: 91.03% // Head: 88.36% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
==========================================
- Coverage 91.03% 88.36% -2.68%
==========================================
Files 9 8 -1
Lines 1607 1530 -77
==========================================
- Hits 1463 1352 -111
- Misses 144 178 +34
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I think the interaction with EOF is still not quite right, compared to String, for example: julia> Parsers.xparse(String, ",,", 1, 2, Parsers.Options(sentinel=missing, delim=','))
Parsers.Result{Parsers.PosLen}(code=`SUCCESS: SENTINEL | DELIMITED `, tlen=1, val=PosLen(pos=1, len=0, missingvalue=false, escapedvalue=false))
julia> Parsers.xparse(String, ",,", 2, 2, Parsers.Options(sentinel=missing, delim=','))
Parsers.Result{Parsers.PosLen}(code=`SUCCESS: SENTINEL | DELIMITED `, tlen=1, val=PosLen(pos=2, len=0, missingvalue=false, escapedvalue=false))
julia> Parsers.xparse(String, ",,", 3, 2, Parsers.Options(sentinel=missing, delim=','))
Parsers.Result{Parsers.PosLen}(code=`SUCCESS: SENTINEL | EOF `, tlen=0, val=PosLen(pos=3, len=0, missingvalue=false, escapedvalue=false)) julia> Parsers.xparse(Char, ",,", 1, 2, Parsers.Options(sentinel=missing, delim=','))
Parsers.Result{Char}(code=`SUCCESS: SENTINEL | DELIMITED `, tlen=1, val=����)
julia> Parsers.xparse(Char, ",,", 2, 2, Parsers.Options(sentinel=missing, delim=','))
Parsers.Result{Char}(code=`SUCCESS: SENTINEL | DELIMITED | EOF `, tlen=1, val=����)
julia> Parsers.xparse(Char, ",,", 3, 2, Parsers.Options(sentinel=missing, delim=','))
Parsers.Result{Char}(code=`SUCCESS: OK | EOF `, tlen=1, val=) |
@Drvi, I think the JET failures are unrelated? Would you mind taking a look? Otherwise, I think this is ready to merge and tag. |
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.
LGTM
some thoughts on tests but whatever you decide is fine
In the switch to making Char non-greedy in the 2.5 release, I failed to account for the fact that the parsed Char may in fact be the delimiter provided, in which case we want to match the delim instead of treating it as a successfully parsed Char (Char is greedy in this way like Strings).
Luckily we can still do this pretty efficiently by checking our parsed Char against the delimiter, if there is one.