PHPExcel_Writer_Excel5
[ class tree: PHPExcel_Writer_Excel5 ] [ index: PHPExcel_Writer_Excel5 ] [ all elements ]

Class: PHPExcel_Writer_Excel5_Parser

Source Location: /PHPExcel/Writer/Excel5/Parser.php

Class Overview


Class for parsing Excel formulas


Author(s):

Variables

Methods



Class Details

[line 35]
Class for parsing Excel formulas

Class for parsing Excel formulas




Tags:

author:  Xavier Noguer <xnoguer@rezebra.com>


[ Top ]


Class Variables

$_BIFF_version =

[line 89]

The BIFF version for the workbook

The BIFF version for the workbook




Tags:

access:  private

Type:   integer


[ Top ]

$_byte_order =

[line 71]

The byte order.

The byte order. 1 => big endian, 0 => little endian.




Tags:

access:  private

Type:   integer


[ Top ]

$_current_char =

[line 41]

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 47]

The token we are working on.

The token we are working on.




Tags:

access:  private

Type:   string


[ Top ]

$_ext_sheets =

[line 77]

Array of external sheets

Array of external sheets




Tags:

access:  private

Type:   array


[ Top ]

$_formula =

[line 53]

The formula to parse

The formula to parse




Tags:

access:  private

Type:   string


[ Top ]

$_lookahead =

[line 59]

The character ahead of the current char

The character ahead of the current char




Tags:

access:  private

Type:   string


[ Top ]

$_parse_tree =

[line 65]

The parse tree to be generated

The parse tree to be generated




Tags:

access:  private

Type:   string


[ Top ]

$_references =

[line 83]

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 PHPExcel_Writer_Excel5_Parser [line 97]

PHPExcel_Writer_Excel5_Parser PHPExcel_Writer_Excel5_Parser( integer $byte_order, $biff_version)

The class constructor

The class constructor




Parameters:

integer   $byte_order   The byte order (Little endian or Big endian) of the architecture
   $biff_version  

[ Top ]

method parse [line 1201]

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 899]

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:



Parameters:

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

[ Top ]

method toReversePolish [line 1500]

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 1023]

void _advance( )

Advance to the next valid token.

Advance to the next valid token.




Tags:

access:  private


[ Top ]

method _cellToPackedRowcol [line 911]

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 993]

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 1218]

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 491]

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 595]

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 551]

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 616]

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 659]

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 708]

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 738]

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 571]

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 1468]

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 1258]

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 1340]

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 1418]

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 822]

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 880]

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 116]

void _initializeHashes( )

Initialize the ptg and function hashes.

Initialize the ptg and function hashes.




Tags:

access:  private


[ Top ]

method _match [line 1073]

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 777]

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 1297]

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 946]

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 1310]

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, 05 Jan 2009 20:38:20 +0100 by phpDocumentor 1.4.1