|
Moodle
2.2.1
http://www.collinsharper.com
|


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 | |
Definition at line 106 of file Parser.php.
| _advance | ( | ) |
Advance to the next valid token.
private
Definition at line 1104 of file Parser.php.


| _cellToPackedRowcol | ( | $ | cell | ) |
pack() row and column into the required 3 or 4 byte format.
private
| string | $cell | The Excel cell reference to be packed |
Definition at line 992 of file Parser.php.


| _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
| string | $cell | The Excel cell reference in A1 format. |
Definition at line 1074 of file Parser.php.

| _condition | ( | ) |
It parses a condition. It assumes the following rule: Cond -> Expr [(">" | "<") Expr]
private
Definition at line 1302 of file Parser.php.


| _convert | ( | $ | token | ) |
Convert a token to the proper ptg value.
private
| mixed | $token | The token to convert. |
Definition at line 539 of file Parser.php.


| _convertFunction | ( | $ | token, |
| $ | num_args | ||
| ) |
Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes.
private
| string | $token | The name of the function for convertion to ptg value. |
| integer | $num_args | The number of arguments the function receives. |
Definition at line 645 of file Parser.php.
| _convertNumber | ( | $ | num | ) |
Convert a number token to ptgInt or ptgNum
private
| mixed | $num | an integer or double for conversion to its ptg value |
Definition at line 599 of file Parser.php.

| _convertRange2d | ( | $ | range | ) |
Convert an Excel range such as A1:D4 to a ptgRefV.
private
| string | $range | An Excel range in the A1:A2 or A1..A2 format. |
Definition at line 666 of file Parser.php.


| _convertRange3d | ( | $ | token | ) |
Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d.
private
| string | $token | An Excel range in the Sheet1!A1:A2 format. |
Definition at line 715 of file Parser.php.


| _convertRef2d | ( | $ | cell | ) |
Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
private
| string | $cell | An Excel cell reference |
Definition at line 779 of file Parser.php.


| _convertRef3d | ( | $ | cell | ) |
Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d.
private
| string | $cell | An Excel cell reference |
Definition at line 812 of file Parser.php.


| _convertString | ( | $ | string | ) |
Convert a string token to ptgStr
private
| string | $string | A string for conversion to its ptg value. |
Definition at line 620 of file Parser.php.


| _createTree | ( | $ | value, |
| $ | left, | ||
| $ | right | ||
| ) |
Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements.
private
| mixed | $value | The value of this node. |
| mixed | $left | The left array (sub-tree) or a final node. |
| mixed | $right | The right array (sub-tree) or a final node. |
Definition at line 1597 of file Parser.php.

| _expression | ( | ) |
It parses a expression. It assumes the following rule: Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term
private
Definition at line 1363 of file Parser.php.


| _fact | ( | ) |
It parses a factor. It assumes the following rule: Fact -> ( Expr ) | CellRef | CellRange | Number | Function
private
Definition at line 1463 of file Parser.php.


| _func | ( | ) |
It parses a function call. It assumes the following rule: Func -> ( Expr [,Expr]* )
private
Definition at line 1541 of file Parser.php.


| _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
| string | $ext_ref | The name of the external reference |
Definition at line 903 of file Parser.php.


| _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
Definition at line 961 of file Parser.php.

Initialize the ptg and function hashes.
private
Definition at line 187 of file Parser.php.

| _match | ( | $ | token | ) |
Checks if it's a valid token.
private
| mixed | $token | The token to check. |
Definition at line 1154 of file Parser.php.

| _packExtRef | ( | $ | ext_ref | ) |
Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure.
private
| string | $ext_ref | The name of the external reference |
Definition at line 857 of file Parser.php.


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
Definition at line 1411 of file Parser.php.


| _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
| string | $range | The Excel range to be packed |
Definition at line 1027 of file Parser.php.


| _term | ( | ) |
It parses a term. It assumes the following rule: Term -> Fact [("*" | "/") Fact]
private
Definition at line 1424 of file Parser.php.


| parse | ( | $ | formula | ) |
The parsing method. It parses a formula.
public
| string | $formula | The formula to parse, without the initial equal sign (=). |
Definition at line 1282 of file Parser.php.

| 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
| string | $name | The name of the worksheet being added |
| integer | $index | The 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
| integer | $byte_order | The 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.

| 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
| array | $tree | The optional tree to convert. |
Definition at line 1629 of file Parser.php.

| $_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.