pdftract/crates
jedarden d3fc0de330 feat(pdftract-1os1): implement q/Q stack with depth limit 64 and overflow diagnostics
Implement the q (push) and Q (pop) operators driving a Vec<GraphicsState>
save stack with the PDF spec's 64-level depth limit.

Changes:
- Changed MAX_GSTATE_DEPTH from 32 to 64 per PDF spec section 8.4
- Added gstate_overflow_logged flag to emit overflow diagnostic only once per page
- Q at depth 0 is a no-op that emits GSTATE_STACK_UNDERFLOW diagnostic

Acceptance criteria (all PASS):
- 64 nested q calls succeed; 65th emits diagnostic
- 64 q + 64 Q restores to initial state
- Q at depth 0 is a no-op (no panic)
- 1000 paired q...Q operations succeed (depth never exceeds 1)
- Diagnostic emitted exactly once per page even after multiple overflows

Closes: pdftract-1os1

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 16:05:14 -04:00
..
pdftract-cer-diff docs(pdftract-aawrz): add LICENSE-MIT and LICENSE-APACHE files 2026-05-23 10:36:28 -04:00
pdftract-cli feat(pdftract-64p5): implement classify CLI subcommand and --auto flag 2026-05-24 15:16:56 -04:00
pdftract-core feat(pdftract-1os1): implement q/Q stack with depth limit 64 and overflow diagnostics 2026-05-24 16:05:14 -04:00
pdftract-libpdftract feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
pdftract-py feat(pdftract-2nu0s): implement Python SDK contract conformance 2026-05-24 08:55:11 -04:00