Moodle  2.2.1
http://www.collinsharper.com
Spreadsheet_Excel_Writer_Parser Class Reference
Inheritance diagram for Spreadsheet_Excel_Writer_Parser:
Collaboration diagram for Spreadsheet_Excel_Writer_Parser:

Public Member Functions

 Spreadsheet_Excel_Writer_Parser ($byte_order, $biff_version)
 _initializeHashes ()
 _convert ($token)
 _convertNumber ($num)
 _convertString ($string)
 _convertFunction ($token, $num_args)
 _convertRange2d ($range)
 _convertRange3d ($token)
 _convertRef2d ($cell)
 _convertRef3d ($cell)
 _packExtRef ($ext_ref)
 _getRefIndex ($ext_ref)
 _getSheetIndex ($sheet_name)
 setExtSheet ($name, $index)
 _cellToPackedRowcol ($cell)
 _rangeToPackedRange ($range)
 _cellToRowcol ($cell)
 _advance ()
 _match ($token)
 parse ($formula)
 _condition ()
 _expression ()
 _parenthesizedExpression ()
 _term ()
 _fact ()
 _func ()
 _createTree ($value, $left, $right)
 toReversePolish ($tree=array())

Data Fields

 $_current_char
 $_current_token
 $_formula
 $_lookahead
 $_parse_tree
 $_byte_order
 $_ext_sheets
 $_references
 $_BIFF_version

Detailed Description

Definition at line 106 of file Parser.php.


Member Function Documentation

_advance ( )

Advance to the next valid token.

private

Definition at line 1104 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_cellToPackedRowcol ( cell)

pack() row and column into the required 3 or 4 byte format.

private

Parameters:
string$cellThe Excel cell reference to be packed
Returns:
array Array containing the row and column in packed() format

Definition at line 992 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_cellToRowcol ( cell)

Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero indexed row and column number. Also returns two (0,1) values to indicate whether the row or column are relative references.

private

Parameters:
string$cellThe Excel cell reference in A1 format.
Returns:
array

Definition at line 1074 of file Parser.php.

Here is the caller graph for this function:

It parses a condition. It assumes the following rule: Cond -> Expr [(">" | "<") Expr]

private

Returns:
mixed The parsed ptg'd tree on success, PEAR_Error on failure

Definition at line 1302 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_convert ( token)

Convert a token to the proper ptg value.

private

Parameters:
mixed$tokenThe token to convert.
Returns:
mixed the converted token on success. PEAR_Error if the token is not recognized

Definition at line 539 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_convertFunction ( token,
num_args 
)

Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes.

private

Parameters:
string$tokenThe name of the function for convertion to ptg value.
integer$num_argsThe number of arguments the function receives.
Returns:
string The packed ptg for the function

Definition at line 645 of file Parser.php.

_convertNumber ( num)

Convert a number token to ptgInt or ptgNum

private

Parameters:
mixed$numan integer or double for conversion to its ptg value

Definition at line 599 of file Parser.php.

Here is the caller graph for this function:

_convertRange2d ( range)

Convert an Excel range such as A1:D4 to a ptgRefV.

private

Parameters:
string$rangeAn Excel range in the A1:A2 or A1..A2 format.

Definition at line 666 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_convertRange3d ( token)

Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d.

private

Parameters:
string$tokenAn Excel range in the Sheet1!A1:A2 format.
Returns:
mixed The packed ptgArea3d token on success, PEAR_Error on failure.

Definition at line 715 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_convertRef2d ( cell)

Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.

private

Parameters:
string$cellAn Excel cell reference
Returns:
string The cell in packed() format with the corresponding ptg

Definition at line 779 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_convertRef3d ( cell)

Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d.

private

Parameters:
string$cellAn Excel cell reference
Returns:
mixed The packed ptgRef3d token on success, PEAR_Error on failure.

Definition at line 812 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_convertString ( string)

Convert a string token to ptgStr

private

Parameters:
string$stringA string for conversion to its ptg value.
Returns:
mixed the converted token on success. PEAR_Error if the string is longer than 255 characters.

Definition at line 620 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_createTree ( value,
left,
right 
)

Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements.

private

Parameters:
mixed$valueThe value of this node.
mixed$leftThe left array (sub-tree) or a final node.
mixed$rightThe right array (sub-tree) or a final node.
Returns:
array A tree

Definition at line 1597 of file Parser.php.

Here is the caller graph for this function:

It parses a expression. It assumes the following rule: Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term

private

Returns:
mixed The parsed ptg'd tree on success, PEAR_Error on failure

Definition at line 1363 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_fact ( )

It parses a factor. It assumes the following rule: Fact -> ( Expr ) | CellRef | CellRange | Number | Function

private

Returns:
mixed The parsed ptg'd tree on success, PEAR_Error on failure

Definition at line 1463 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_func ( )

It parses a function call. It assumes the following rule: Func -> ( Expr [,Expr]* )

private

Returns:
mixed The parsed ptg'd tree on success, PEAR_Error on failure

Definition at line 1541 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_getRefIndex ( ext_ref)

Look up the REF index that corresponds to an external sheet name (or range). If it doesn't exist yet add it to the workbook's references array. It assumes all sheet names given must exist.

private

Parameters:
string$ext_refThe name of the external reference
Returns:
mixed The reference index in packed() format on success, PEAR_Error on failure

Definition at line 903 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_getSheetIndex ( sheet_name)

Look up the index that corresponds to an external sheet name. The hash of sheet names is updated by the addworksheet() method of the Spreadsheet_Excel_Writer_Workbook class.

private

Returns:
integer The sheet index, -1 if the sheet was not found

Definition at line 961 of file Parser.php.

Here is the caller graph for this function:

Initialize the ptg and function hashes.

private

Definition at line 187 of file Parser.php.

Here is the caller graph for this function:

_match ( token)

Checks if it's a valid token.

private

Parameters:
mixed$tokenThe token to check.
Returns:
mixed The checked token or false on failure

Definition at line 1154 of file Parser.php.

Here is the caller graph for this function:

_packExtRef ( ext_ref)

Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure.

private

Parameters:
string$ext_refThe name of the external reference
Returns:
string The reference index in packed() format

Definition at line 857 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

This function just introduces a ptgParen element in the tree, so that Excel doesn't get confused when working with a parenthesized formula afterwards.

private

See also:
_fact()
Returns:
array The parsed ptg'd tree

Definition at line 1411 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_rangeToPackedRange ( range)

pack() row range into the required 3 or 4 byte format. Just using maximum col/rows, which is probably not the correct solution

private

Parameters:
string$rangeThe Excel range to be packed
Returns:
array Array containing (row1,col1,row2,col2) in packed() format

Definition at line 1027 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_term ( )

It parses a term. It assumes the following rule: Term -> Fact [("*" | "/") Fact]

private

Returns:
mixed The parsed ptg'd tree on success, PEAR_Error on failure

Definition at line 1424 of file Parser.php.

Here is the call graph for this function:

Here is the caller graph for this function:

parse ( formula)

The parsing method. It parses a formula.

public

Parameters:
string$formulaThe formula to parse, without the initial equal sign (=).
Returns:
mixed true on success, PEAR_Error on failure

Definition at line 1282 of file Parser.php.

Here is the call graph for this function:

setExtSheet ( name,
index 
)

This method is used to update the array of sheet names. It is called by the addWorksheet() method of the Spreadsheet_Excel_Writer_Workbook class.

public

See also:
Spreadsheet_Excel_Writer_Workbook::addWorksheet()
Parameters:
string$nameThe name of the worksheet being added
integer$indexThe index of the worksheet being added

Definition at line 980 of file Parser.php.

Spreadsheet_Excel_Writer_Parser ( byte_order,
biff_version 
)

The class constructor

Parameters:
integer$byte_orderThe byte order (Little endian or Big endian) of the architecture (optional). 1 => big endian, 0 (default) little endian.

Definition at line 168 of file Parser.php.

Here is the call graph for this function:

toReversePolish ( tree = array())

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

public

Parameters:
array$treeThe optional tree to convert.
Returns:
string The tree in reverse polish notation

Definition at line 1629 of file Parser.php.

Here is the call graph for this function:


Field Documentation

$_BIFF_version

Definition at line 160 of file Parser.php.

$_byte_order

Definition at line 142 of file Parser.php.

$_current_char

Definition at line 112 of file Parser.php.

$_current_token

Definition at line 118 of file Parser.php.

$_ext_sheets

Definition at line 148 of file Parser.php.

$_formula

Definition at line 124 of file Parser.php.

$_lookahead

Definition at line 130 of file Parser.php.

$_parse_tree

Definition at line 136 of file Parser.php.

$_references

Definition at line 154 of file Parser.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations