Documentation

Tokenizer
in package

Pdf extract tokenizer class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
6.0.0

Table of Contents

Properties

$data  : string
Raw data being tokenized
$length  : int
Length of the raw data
$pos  : int
Current byte offset into the data

Methods

__construct()  : mixed
Constructor
getData()  : string
Get the raw data being tokenized
getPosition()  : int
Get the current byte offset
isDelimiter()  : bool
Determine if a byte is a PDF delimiter
isWhitespace()  : bool
Determine if a byte is PDF whitespace
next()  : array<string|int, mixed>
Read the next token
setPosition()  : void
Set the current byte offset
readAngleClose()  : array<string|int, mixed>|null
Read a token starting with '>' (dict-close, or a stray byte to skip)
readAngleOpen()  : array<string|int, mixed>
Read a token starting with '<' (hex string or dict-open)
readKeyword()  : array<string|int, mixed>
Read a keyword token
readLiteralString()  : array<string|int, mixed>
Read a literal string token
readName()  : array<string|int, mixed>
Read a name token
readNumber()  : array<string|int, mixed>
Read a number token
skipWhitespaceAndComments()  : void
Skip whitespace and comments

Properties

$data

Raw data being tokenized

protected string $data

$length

Length of the raw data

protected int $length

$pos

Current byte offset into the data

protected int $pos

Methods

__construct()

Constructor

public __construct(string $data[, int $pos = 0 ]) : mixed

Instantiate a tokenizer.

Parameters
$data : string
$pos : int = 0

getData()

Get the raw data being tokenized

public getData() : string
Return values
string

getPosition()

Get the current byte offset

public getPosition() : int
Return values
int

isDelimiter()

Determine if a byte is a PDF delimiter

public static isDelimiter(string $c) : bool
Parameters
$c : string
Return values
bool

isWhitespace()

Determine if a byte is PDF whitespace

public static isWhitespace(string $c) : bool
Parameters
$c : string
Return values
bool

next()

Read the next token

public next() : array<string|int, mixed>
Return values
array<string|int, mixed>

setPosition()

Set the current byte offset

public setPosition(int $pos) : void
Parameters
$pos : int

readAngleClose()

Read a token starting with '>' (dict-close, or a stray byte to skip)

protected readAngleClose() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

readAngleOpen()

Read a token starting with '<' (hex string or dict-open)

protected readAngleOpen() : array<string|int, mixed>
Return values
array<string|int, mixed>

readKeyword()

Read a keyword token

protected readKeyword() : array<string|int, mixed>
Return values
array<string|int, mixed>

readLiteralString()

Read a literal string token

protected readLiteralString() : array<string|int, mixed>
Return values
array<string|int, mixed>

readName()

Read a name token

protected readName() : array<string|int, mixed>
Return values
array<string|int, mixed>

readNumber()

Read a number token

protected readNumber() : array<string|int, mixed>
Return values
array<string|int, mixed>

skipWhitespaceAndComments()

Skip whitespace and comments

protected skipWhitespaceAndComments() : void

        
On this page

Search results