Class | PDF::Reader::Parser |
In: |
lib/pdf/reader/parser.rb
|
Parent: | Object |
An internal PDF::Reader class that reads objects from the PDF file and converts them into useable ruby objects (hash‘s, arrays, true, false, etc)
TOKEN_STRATEGY | = | proc { |parser, token| Token.new(token) } |
STRATEGIES | = | { "/" => proc { |parser, token| parser.send(:pdf_name) }, "<<" => proc { |parser, token| parser.send(:dictionary) }, "[" => proc { |parser, token| parser.send(:array) }, "(" => proc { |parser, token| parser.send(:string) }, "<" => proc { |parser, token| parser.send(:hex_string) }, nil => proc { nil }, "true" => proc { true }, "false" => proc { false }, "null" => proc { nil }, "obj" => TOKEN_STRATEGY, "endobj" => TOKEN_STRATEGY, "stream" => TOKEN_STRATEGY, "endstream" => TOKEN_STRATEGY, ">>" => TOKEN_STRATEGY, "]" => TOKEN_STRATEGY, ">" => TOKEN_STRATEGY, ")" => TOKEN_STRATEGY |
Create a new parser around a PDF::Reader::Buffer object
buffer - a PDF::Reader::Buffer object that contains PDF data objects - a PDF::Reader::ObjectHash object that can return objects from the PDF file
Reads the next token from the underlying buffer and convets it to an appropriate object
operators - a hash of supported operators to read from the underlying buffer.