represent null properly and handle unknown xref entry types correctly
introduces TT_Null as the token type of a properly parsed "null" object.
lookup_xref
by design does not handle the case of an unknown xref type.
resolve
maps the null object (including, therefore, unknown xref types) to NULL.
note that this means there are two layers of semantic values:
- what the parser (i.e.
h_parse
) returns. this is the semantics according to our grammar and represents a middle ground between "what was written" and "what was meant", a kind of "literal" semantics if you will. - what
resolve
returns is "semantic value according to PDF". this means mostly resolving references, as the name implies, but also includes mapping PDF's concept of "null object" to the NULL pointer.
i chose this setup because i think PDF "null" is kind of obviously meant to correspond to NULL. the alternative of strictly distinguishing TT_Null (PDF's null) from C's NULL seemed, at least to me at this time, as just a self-imposed extra hoop to jump through.
please have a look.