class

HexaPDF::Tokenizer

Inherits Reference < Object

Tokenizes the content of an IO object following the PDF rules.

See: PDF1.7 s7.2

Constructors

new(io : IO::Memory | File)

Creates a new tokenizer.

Source

Instance methods

next_byte

Reads the byte at the current position and advances the scan pointer.

Source
next_object(allow_end_array_token = false, allow_keyword = false)

Returns the PDF object at the current position. This is different from #next_token because references, arrays and dictionaries consist of multiple tokens.

If +allow_end_array_token+ is +true+, the ']' token is permitted to facilitate the use of this method during array parsing.

If +allow_keyword+ is +true+, the return value may also be a Token instance. See: PDF1.7 s7.3

Source
next_token

Returns a single token read from the current position and advances the position.

Comments and a run of whitespace characters are ignored. A Token of type +:NO_MORE_TOKENS+ is returned if there are no more tokens available.

Source
peek_token

Returns the next token but does not advance the scan pointer.

Source
pos

Returns the current position of the tokenizer inside in the IO object.

Source
pos=(pos)

Sets the position at which the next token should be read.

Source
skip_whitespace

Skips all whitespace at the current position.

See: PDF1.7 s7.2.2

Source

Nested types