yob / pdf-reader

The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.
MIT License
1.82k stars 271 forks source link

Simplify prepare_inline_token #379

Closed sebbASF closed 3 years ago

sebbASF commented 3 years ago

Also check for whitespace after EI.

Uses state machine to keep track of matching. Should reduce object creation.

sebbASF commented 3 years ago

Note: this passes all the tests for me. I realise that this does not fix the issue, but it should be easier to allow for less restrictive matching once the approach is decided.

yob commented 3 years ago

Cool, I like it. I reckon it's debatable if this is a simplification, but I like the state machine, I like the new raise if EI is not found, and I like the new test.

Can you rebase onto main to resolve the conflict, and make the following change to allow the new complexity in this method to pass the cane checks in CI?

diff --git a/Rakefile b/Rakefile
index 69e418a..64997f7 100644
--- a/Rakefile
+++ b/Rakefile
@@ -14,7 +14,7 @@ desc "Run cane to check quality metrics"
 Cane::RakeTask.new(:quality) do |cane|
   cane.abc_max = 20
   cane.style_measure = 100
-  cane.max_violations = 31
+  cane.max_violations = 32
sebbASF commented 3 years ago

Hope I got the rebase right.

yob commented 3 years ago

The rebase went a bit screwy - I think there's 4 unique commits we're after, but the branch now has more than that.

No dramas though - I cherry-picked the 4 commits into a new branch and merged them in as f5def5d. Thanks!

sebbASF commented 3 years ago

Sorry for the trouble.