Skip to content
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

Bibtex cleanups / type improvements #1163

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

CraftSpider
Copy link
Contributor

Best reviewed commit-by-commit if you're looking to understand every change.

This work, so far:

  • Renders Bibtex fully re-entrant outside of the use of CoreBridgeState
  • Makes some changes to CoreBridgeState to allow sound direct usage from Rust
  • Uses Vec instead of a custom buffer type everywhere
  • Makes the hash data a lot more type-safe.
    • In the future, I plan to remove most of the panics and shift even more stuff into the type system for compile-time guarantee of correctness.
    • I also want to shift where lookup_str is defined - it's primarily about the hash, only tangentially touching the pool.
  • There's still more to do, but this is a lot of the stuff I really wanted to happen

@CraftSpider CraftSpider added the port-to-rust Replacing old code with Rust label Feb 28, 2024
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 55.30393% with 750 lines in your changes missing coverage. Please review.

Project coverage is 46.16%. Comparing base (34d643f) to head (2617e26).

Files with missing lines Patch % Lines
crates/engine_bibtex/src/bibs.rs 27.35% 162 Missing ⚠️
crates/engine_bibtex/src/exec.rs 41.42% 140 Missing ⚠️
crates/engine_bibtex/src/log.rs 47.39% 101 Missing ⚠️
crates/engine_bibtex/src/scan.rs 60.62% 100 Missing ⚠️
crates/engine_bibtex/src/bst.rs 54.18% 82 Missing ⚠️
crates/engine_bibtex/src/auxi.rs 47.61% 66 Missing ⚠️
crates/engine_bibtex/src/pool.rs 86.01% 27 Missing ⚠️
crates/engine_bibtex/src/lib.rs 75.26% 23 Missing ⚠️
crates/engine_bibtex/src/hash.rs 67.74% 20 Missing ⚠️
crates/bridge_core/src/lib.rs 75.80% 15 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1163      +/-   ##
==========================================
- Coverage   46.23%   46.16%   -0.07%     
==========================================
  Files         186      184       -2     
  Lines       66139    66197      +58     
==========================================
- Hits        30580    30562      -18     
- Misses      35559    35635      +76     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CraftSpider
Copy link
Contributor Author

Created a new branch off this to play around with an idea I've had that will probably not be part of this PR (which I'm hoping to get merged after I fix up the test I broke) - take a look at CraftSpider@75f5c96 on my bibtex-parsing branch for a new way to parse things. It manages to separate out aux parsing into two parts, just parsing the line, then emitting warnings and making state changes. The parsing part is entirely separate from state, and as such, can now be unit-tested quite easily.

Disclaimer

The library I used, chumsky, is one that I'm a maintainer for. I chose it because both I'm familiar with it, and it has strong error handling/recovery support. The current release version, 0.9, is kind of slow, but the 1.0 alpha version is close to release and both makes it nearly as fast as hand-written parsers and supports zero-copy parsing, meaning aux should be zero-allocation again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
port-to-rust Replacing old code with Rust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant