Class for parsing Excel formulas
Located in /libraries/pear/Spreadsheet/Excel/Writer/Parser.php (line 106)
PEAR | --Spreadsheet_Excel_Writer_Parser
The BIFF version for the workbook
The byte order. 1 => big endian, 0 => little endian.
The index of the character we are currently looking at
The token we are working on.
Array of external sheets
The formula to parse
The character ahead of the current char
The parse tree to be generated
Array of sheet references in the form of REF structures
The class constructor
The parsing method. It parses a formula.
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.
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
Advance to the next valid token.
pack() row and column into the required 3 or 4 byte format.
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.
It parses a condition. It assumes the following rule: Cond -> Expr [(">" | "<") Expr]
Convert a token to the proper ptg value.
Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes.
Convert a number token to ptgInt or ptgNum
Convert an Excel range such as A1:D4 to a ptgRefV.
Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d.
Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d.
Convert a string token to ptgStr
Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements.
It parses a expression. It assumes the following rule:
Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term
It parses a factor. It assumes the following rule:
Fact -> ( Expr ) | CellRef | CellRange | Number | Function
It parses a function call. It assumes the following rule: Func -> ( Expr [,Expr]* )
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.
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.
Initialize the ptg and function hashes.
Checks if it's a valid token.
Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure.
This function just introduces a ptgParen element in the tree, so that Excel doesn't get confused when working with a parenthesized formula afterwards.
pack() row range into the required 3 or 4 byte format.
Just using maximum col/rows, which is probably not the correct solution
It parses a term. It assumes the following rule: Term -> Fact [("*" | "/") Fact]
Documentation generated on Fri, 11 Feb 2005 18:13:48 +0000 by phpDocumentor 1.3.0RC3