pdf-raku/PDF-Grammar-raku

Changed xref AST

Closed this issue · 0 comments

The xref AST currently looks very similar to the physical structure with an implied sequence of object numbers.

xref
0 4
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n

Produces an AST of:

[
    {
        :obj-count(4),
        :obj-first-num(0);
        :entries[[0, 65535, 0],
                     [9,  0,  1],
                     [74,  0, 1],
                     [120, 0, 1],
                    ]
    }
]

Issue is that the PDF layer has to rebuild this to another intermediate structure that is more logical

[
    {
        :obj-count(4),
        :entries[[0, 65535, 0, 0],
                     [1, 0, 9,   1],
                     [2, 0, 74,  1],
                     [3, 0, 120, 1],
                     ]
    }
]

Proposal is to change AST to the second more logical form. This will help streamline and simplify PDF index loading