tectonic-typesetting / tectonic

A modernized, complete, self-contained TeX/LaTeX engine, powered by XeTeX and TeXLive.
https://tectonic-typesetting.github.io/
Other
3.99k stars 162 forks source link

Bibtex cleanups / type improvements #1163

Open CraftSpider opened 8 months ago

CraftSpider commented 8 months ago

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

This work, so far:

codecov[bot] commented 8 months ago

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 :warning:
crates/engine_bibtex/src/exec.rs 41.42% 140 Missing :warning:
crates/engine_bibtex/src/log.rs 47.39% 101 Missing :warning:
crates/engine_bibtex/src/scan.rs 60.62% 100 Missing :warning:
crates/engine_bibtex/src/bst.rs 54.18% 82 Missing :warning:
crates/engine_bibtex/src/auxi.rs 47.61% 66 Missing :warning:
crates/engine_bibtex/src/pool.rs 86.01% 27 Missing :warning:
crates/engine_bibtex/src/lib.rs 75.26% 23 Missing :warning:
crates/engine_bibtex/src/hash.rs 67.74% 20 Missing :warning:
crates/bridge_core/src/lib.rs 75.80% 15 Missing :warning:
... and 4 more
Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

CraftSpider commented 8 months ago

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 https://github.com/CraftSpider/tectonic/commit/75f5c9656efd8f9df6be749202bd9fa644115fa5 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.