class Parser (View source)

Constants

REGEX_SHEET_TITLE_UNQUOTED

REGEX_SHEET_TITLE_QUOTED

Properties

int $currentCharacter The index of the character we are currently looking at.
string $currentToken The token we are working on.
string $lookAhead The character ahead of the current char.
array $references Array of sheet references in the form of REF structures.

Methods

__construct()

The class constructor.

setExtSheet(string $name, int $index)

This method is used to update the array of sheet names. It is called by the addWorksheet() method of the \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook class.

mixed
parse(string $formula)

The parsing method. It parses a formula.

string
toReversePolish(array $tree = [])

Builds a string containing the tree in reverse polish notation (What you would use in a HP calculator stack).

Details

__construct()

The class constructor.

setExtSheet(string $name, int $index)

This method is used to update the array of sheet names. It is called by the addWorksheet() method of the \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook class.

Parameters

string $name The name of the worksheet being added
int $index The index of the worksheet being added

See also

mixed parse(string $formula)

The parsing method. It parses a formula.

Parameters

string $formula the formula to parse, without the initial equal sign (=)

Return Value

mixed true on success

string toReversePolish(array $tree = [])

Builds a string containing the tree in reverse polish notation (What you would use in a HP calculator stack).

The following tree:.

+ / \ 2 3

produces: "23+"

The following tree:

+ / \ 3 * / \ 6 A1

produces: "36A1*+"

In fact all operands, functions, references, etc... are written as ptg's

Parameters

array $tree the optional tree to convert

Return Value

string The tree in reverse polish notation