PHPExcel_Writer_Excel5

# Class: PHPExcel_Writer_Excel5_Parser Source Location: /PHPExcel/Writer/Excel5/Parser.php
### Class Overview
PHPExcel_Writer_Excel5_Parser #### Author(s): #### Copyright: Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel) | ### Variables $_BIFF_version $_current_char $_current_token $_ext_sheets $_formula $_lookahead $_parse_tree $_references | ### Methods __construct parse setExtSheet toReversePolish _advance _cellToPackedRowcol _cellToRowcol _condition _convert _convertFunction _convertNumber _convertRange2d _convertRange3d _convertRef2d _convertRef3d _convertString _createTree _expression _fact _func _getRefIndex _getSheetIndex _initializeHashes _match _packExtRef _parenthesizedExpression _rangeToPackedRange _term
### Class Details [line 75] PHPExcel_Writer_Excel5_Parser PHPExcel_Writer_Excel5_Parser #### Tags:
copyright: | Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
[ Top ] ### Class Variables #### $_BIFF_version = [line 123] The BIFF version for the workbook The BIFF version for the workbook #### Tags:
access: | private
Type: | integer
[ Top ] #### $_current_char = [line 81] The index of the character we are currently looking at The index of the character we are currently looking at #### Tags:
access: | private
Type: | integer
[ Top ] #### $_current_token = [line 87] The token we are working on. The token we are working on. #### Tags:
access: | private
Type: | string
[ Top ] #### $_ext_sheets = [line 111] Array of external sheets Array of external sheets #### Tags:
access: | private
Type: | array
[ Top ] #### $_formula = [line 93] The formula to parse The formula to parse #### Tags:
access: | private
Type: | string
[ Top ] #### $_lookahead = [line 99] The character ahead of the current char The character ahead of the current char #### Tags:
access: | private
Type: | string
[ Top ] #### $_parse_tree = [line 105] The parse tree to be generated The parse tree to be generated #### Tags:
access: | private
Type: | string
[ Top ] #### $_references = [line 117] Array of sheet references in the form of REF structures Array of sheet references in the form of REF structures #### Tags:
access: | private
Type: | array
[ Top ] ### Class Methods ### constructor __construct [line 131]
`PHPExcel_Writer_Excel5_Parser __construct( $biff_version, integer $byte_order)`
The class constructor The class constructor #### Tags:
access: | public
#### Parameters:
integer | $byte_order | The byte order (Little endian or Big endian) of the architecture (optional). 1 => big endian, 0 (default) little endian.
| $biff_version |
[ Top ] ### method parse [line 1234]
`mixed parse( string $formula)`
The parsing method. The parsing method. It parses a formula. #### Tags:
return: | true on success
access: | public
#### Parameters:
string | $formula | The formula to parse, without the initial equal sign (=).
[ Top ] ### method setExtSheet [line 932]
`void setExtSheet( string $name, integer $index)`
This method is used to update the array of sheet names. called by the addWorksheet() method of the PHPExcel_Writer_Excel5_Workbook class. This method is used to update the array of sheet names. It is called by the addWorksheet() method of the PHPExcel_Writer_Excel5_Workbook class. #### Tags:
see: | PHPExcel_Writer_Excel5_Workbook::addWorksheet()
access: | public
#### Parameters:
string | $name | The name of the worksheet being added
integer | $index | The index of the worksheet being added
[ Top ] ### method toReversePolish [line 1537]
`string toReversePolish( [array $tree = array()])`
Builds a string containing the tree in reverse polish notation (What you would use in a HP calculator stack). 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 #### Tags:
return: | The tree in reverse polish notation
access: | public
#### Parameters:
array | $tree | The optional tree to convert.
[ Top ] ### method _advance [line 1056]
`void _advance( )`
Advance to the next valid token. Advance to the next valid token. #### Tags:
access: | private
[ Top ] ### method _cellToPackedRowcol [line 944]
`array _cellToPackedRowcol( string $cell)`
pack() row and column into the required 3 or 4 byte format. pack() row and column into the required 3 or 4 byte format. #### Tags:
return: | Array containing the row and column in packed() format
access: | private
#### Parameters:
string | $cell | The Excel cell reference to be packed
[ Top ] ### method _cellToRowcol [line 1026]
`array _cellToRowcol( string $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. whether the row or column are relative references. 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. #### Tags:
access: | private
#### Parameters:
string | $cell | The Excel cell reference in A1 format.
[ Top ] ### method _condition [line 1251]
`mixed _condition( )`
It parses a condition. It parses a condition. It assumes the following rule: Cond -> Expr [(">" | "<") Expr] #### Tags:
return: | The parsed ptg'd tree on success
access: | private
[ Top ] ### method _convert [line 524]
`mixed _convert( mixed $token)`
Convert a token to the proper ptg value. Convert a token to the proper ptg value. #### Tags:
return: | the converted token on success
access: | private
#### Parameters:
mixed | $token | The token to convert.
[ Top ] ### method _convertFunction [line 628]
`string _convertFunction( string $token, integer $num_args)`
Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes. Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes. #### Tags:
return: | The packed ptg for the function
access: | private
#### Parameters:
string | $token | The name of the function for convertion to ptg value.
integer | $num_args | The number of arguments the function receives.
[ Top ] ### method _convertNumber [line 584]
`void _convertNumber( mixed $num)`
Convert a number token to ptgInt or ptgNum Convert a number token to ptgInt or ptgNum #### Tags:
access: | private
#### Parameters:
mixed | $num | an integer or double for conversion to its ptg value
[ Top ] ### method _convertRange2d [line 649]
`void _convertRange2d( string $range, [ $class = 0])`
Convert an Excel range such as A1:D4 to a ptgRefV. Convert an Excel range such as A1:D4 to a ptgRefV. #### Tags:
access: | private
#### Parameters:
string | $range | An Excel range in the A1:A2 or A1..A2 format.
| $class |
[ Top ] ### method _convertRange3d [line 692]
`mixed _convertRange3d( string $token)`
Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d. Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d. #### Tags:
return: | The packed ptgArea3d token on success.
access: | private
#### Parameters:
string | $token | An Excel range in the Sheet1!A1:A2 format.
[ Top ] ### method _convertRef2d [line 741]
`string _convertRef2d( string $cell)`
Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV. Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV. #### Tags:
return: | The cell in packed() format with the corresponding ptg
access: | private
#### Parameters:
string | $cell | An Excel cell reference
[ Top ] ### method _convertRef3d [line 771]
`mixed _convertRef3d( string $cell)`
Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d. Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d. #### Tags:
return: | The packed ptgRef3d token on success.
access: | private
#### Parameters:
string | $cell | An Excel cell reference
[ Top ] ### method _convertString [line 604]
`mixed _convertString( string $string)`
Convert a string token to ptgStr Convert a string token to ptgStr #### Tags:
return: | the converted token on success
access: | private
#### Parameters:
string | $string | A string for conversion to its ptg value.
[ Top ] ### method _createTree [line 1505]
`array _createTree( mixed $value, mixed $left, mixed $right)`
Creates a tree. as elements. Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements. #### Tags:
return: | A tree
access: | private
#### Parameters:
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.
[ Top ] ### method _expression [line 1291]
`mixed _expression( )`
It parses a expression. It parses a expression. It assumes the following rule: Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term #### Tags:
return: | The parsed ptg'd tree on success
access: | private
[ Top ] ### method _fact [line 1373]
`mixed _fact( )`
It parses a factor. It parses a factor. It assumes the following rule: Fact -> ( Expr ) | CellRef | CellRange | Number | Function #### Tags:
return: | The parsed ptg'd tree on success
access: | private
[ Top ] ### method _func [line 1455]
`mixed _func( )`
It parses a function call. It parses a function call. It assumes the following rule: Func -> ( Expr [,Expr]* ) #### Tags:
return: | The parsed ptg'd tree on success
access: | private
[ Top ] ### method _getRefIndex [line 855]
`mixed _getRefIndex( string $ext_ref)`
Look up the REF index that corresponds to an external sheet name (or range). array. 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. #### Tags:
return: | The reference index in packed() format on success
access: | private
#### Parameters:
string | $ext_ref | The name of the external reference
[ Top ] ### method _getSheetIndex [line 913]
`integer _getSheetIndex( $sheet_name)`
Look up the index that corresponds to an external sheet name. sheet names is updated by the addworksheet() method of the PHPExcel_Writer_Excel5_Workbook class. Look up the index that corresponds to an external sheet name. The hash of sheet names is updated by the addworksheet() method of the PHPExcel_Writer_Excel5_Workbook class. #### Tags:
return: | The sheet index, -1 if the sheet was not found
access: | private
#### Parameters:
| $sheet_name |
[ Top ] ### method _initializeHashes [line 149]
`void _initializeHashes( )`
Initialize the ptg and function hashes. Initialize the ptg and function hashes. #### Tags:
access: | private
[ Top ] ### method _match [line 1106]
`mixed _match( mixed $token)`
Checks if it's a valid token. Checks if it's a valid token. #### Tags:
return: | The checked token or false on failure
access: | private
#### Parameters:
mixed | $token | The token to check.
[ Top ] ### method _packExtRef [line 810]
`string _packExtRef( string $ext_ref)`
Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure. Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure. #### Tags:
return: | The reference index in packed() format
access: | private
#### Parameters:
string | $ext_ref | The name of the external reference
[ Top ] ### method _parenthesizedExpression [line 1330]
`array _parenthesizedExpression( )`
This function just introduces a ptgParen element in the tree, so that Excel doesn't get confused when working with a parenthesized formula afterwards. This function just introduces a ptgParen element in the tree, so that Excel doesn't get confused when working with a parenthesized formula afterwards. #### Tags:
return: | The parsed ptg'd tree
see: | PHPExcel_Writer_Excel5_Parser::_fact()
access: | private
[ Top ] ### method _rangeToPackedRange [line 979]
`array _rangeToPackedRange( string $range)`
pack() row range into the required 3 or 4 byte format. pack() row range into the required 3 or 4 byte format. Just using maximum col/rows, which is probably not the correct solution #### Tags:
return: | Array containing (row1,col1,row2,col2) in packed() format
access: | private
#### Parameters:
string | $range | The Excel range to be packed
[ Top ] ### method _term [line 1343]
`mixed _term( )`
It parses a term. It parses a term. It assumes the following rule: Term -> Fact [("*" | "/") Fact] #### Tags:
return: | The parsed ptg'd tree on success
access: | private
[ Top ] Documentation generated on Mon, 11 Jan 2010 08:12:48 +0100 by phpDocumentor 1.4.1