Skip to main content

Module parse

Module parse 

Source
Expand description

PDF object parser — Lexer tokens → Object tree.

Round-3 Commit 2: builds on crate::reader::lex to recognise every variant the writer can emit (numbers, names, strings, arrays, dicts, indirect references, stream objects, null).

Streams are matched by the trailing stream+EOL marker per ISO 32000-1 §7.3.8. The body is sliced verbatim from the input — no filter decoding here; the reader’s stream object handler (round-3 commit 4) re-runs FlateDecode if the dictionary’s /Filter says so.

Object streams (PDF 1.5+, /Type /ObjStm) are deliberately out of scope for round 3 — the writer doesn’t emit them and parsing them requires a full /XRef stream walker. Round-4+.

Structs§

NoLengthResolver
No-op LengthResolver — every indirect /Length is rejected. Used by Parser::parse_indirect and Parser::parse_object on code paths where the xref table isn’t built yet (the xref-stream parser, the parse_xref_stream_at helper).
Parser
Recursive-descent parser over a Lexer.

Traits§

LengthResolver
Caller-supplied hook that resolves an indirect /Length reference on a stream dictionary to the underlying integer.