-
-
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
EdnError rework (new parse impl) #150
Conversation
0a2d384
to
3965bc3
Compare
3965bc3 @evaporei |
Added a new Error for duplicate in sets, matching clojure. |
Sorry for the delay, I'm moving to another city and have had limited time. I can take a look as soon as the branch is updated |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #150 +/- ##
==========================================
- Coverage 73.43% 71.37% -2.06%
==========================================
Files 8 9 +1
Lines 862 877 +15
==========================================
- Hits 633 626 -7
- Misses 229 251 +22 ☔ View full report in Codecov by Sentry. |
No worries, I don't think it's too urgent. It would be nice to be merged in so I can tackle the other issues though. Rebased, which is what I assume you meant. No other changes. Tell me if you want this broken up/squashed in a different way. I think #138 should be a higher priority (github release action -> crates.io publishing). I think we should do a final 0.17 before this PR gets merged too. |
…ing, with well defined data.
Clojure's behavior: (clojure.edn/read-string "#{1 2 2 3}") java.lang.IllegalArgumentException: Duplicate key: 2 [at <repl>:1:1]
Code coverage bot seems really bad? It's marking tons of things as untested. To compare, here's the source based coverage generated by https://github.com/Grinkers/edn-rs/blob/5ad0427304dc9a05276ef2de36013c82e5ab22e8/bb.edn#L38 |
Resolves #119
Performance
Note this is using the benchmark in
main
branch. The performance increase should be much better on larger strings, as there is now noclone()
in parse. The only allocations are for constructing the EDN struct and for parsing numbers. Note that the walker is now all pointer based. Peeking was a big reason previously for the clones, you can see the new performance characteristics (utf-8 complexity but no allocations) https://godbolt.org/z/zK9dEzrYnBefore
After
Debug
given
Before
Err(ParseEdn("None could not be parsed at char count 58"))
After
Err(EdnError { code: UnexpectedEOF, line: Some(1), column: Some(74), index: Some(73) })
Examples/tests can be seen in https://github.com/Grinkers/edn-rs/blob/parse/tests/error_messages.rs
Errors
In this rework, the following strings were also previously being parsed as valid EDN. Fuzzing invalid EDN is still a TODO (separate issue/PR).