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 21 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.53561% with 743 lines in your changes are missing coverage. Please review.

Project coverage is 46.37%. Comparing base (4c539b0) to head (3565f03).

Files 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.85% 101 Missing ⚠️
crates/engine_bibtex/src/bst.rs 55.42% 74 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 76.56% 15 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1163      +/-   ##
==========================================
- Coverage   46.41%   46.37%   -0.04%     
==========================================
  Files         176      174       -2     
  Lines       65121    65180      +59     
==========================================
+ Hits        30223    30228       +5     
- Misses      34898    34952      +54     

☔ 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.

@CraftSpider CraftSpider marked this pull request as ready for review April 1, 2024 03:56
@CraftSpider CraftSpider requested a review from pkgw April 17, 2024 22:26
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.

None yet

1 participant