ILIAS
eassessment Revision 61809
|
Public Member Functions | |
__construct ($biff_version) | |
The class constructor. | |
_initializeHashes () | |
Initialize the ptg and function hashes. | |
_convert ($token) | |
Convert a token to the proper ptg value. | |
_convertNumber ($num) | |
Convert a number token to ptgInt or ptgNum. | |
_convertString ($string) | |
Convert a string token to ptgStr. | |
_convertFunction ($token, $num_args) | |
Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes. | |
_convertRange2d ($range, $class=0) | |
Convert an Excel range such as A1:D4 to a ptgRefV. | |
_convertRange3d ($token) | |
Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to a ptgArea3d. | |
_convertRef2d ($cell) | |
Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV. | |
_convertRef3d ($cell) | |
Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a ptgRef3d. | |
_convertError ($errorCode) | |
Convert an error code to a ptgErr. | |
_packExtRef ($ext_ref) | |
Convert the sheet name part of an external reference, for example "Sheet1" or "Sheet1:Sheet2", to a packed structure. | |
_getRefIndex ($ext_ref) | |
Look up the REF index that corresponds to an external sheet name (or range). | |
_getSheetIndex ($sheet_name) | |
Look up the index that corresponds to an external sheet name. | |
setExtSheet ($name, $index) | |
This method is used to update the array of sheet names. | |
_cellToPackedRowcol ($cell) | |
pack() row and column into the required 3 or 4 byte format. | |
_rangeToPackedRange ($range) | |
pack() row range into the required 3 or 4 byte format. | |
_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. | |
_advance () | |
Advance to the next valid token. | |
_match ($token) | |
Checks if it's a valid token. | |
parse ($formula) | |
The parsing method. | |
_condition () | |
It parses a condition. | |
_expression () | |
It parses a expression. | |
_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. | |
_term () | |
It parses a term. | |
_fact () | |
It parses a factor. | |
_func () | |
It parses a function call. | |
_createTree ($value, $left, $right) | |
Creates a tree. | |
toReversePolish ($tree=array()) | |
Builds a string containing the tree in reverse polish notation (What you would use in a HP calculator stack). |
Data Fields | |
const | REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&<>\=\,\;\#\(\)\"\{\}]+' |
Constants. | |
const | REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+' |
$_current_char | |
$_current_token | |
$_formula | |
$_lookahead | |
$_parse_tree | |
$_ext_sheets | |
$_references | |
$_BIFF_version |
Definition at line 60 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::__construct | ( | $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 130 of file Parser.php.
References _initializeHashes().
PHPExcel_Writer_Excel5_Parser::_advance | ( | ) |
Advance to the next valid token.
private
Definition at line 1075 of file Parser.php.
References $_current_char, and _match().
Referenced by _condition(), _expression(), _fact(), _func(), _term(), and parse().
PHPExcel_Writer_Excel5_Parser::_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 963 of file Parser.php.
References $row, and _cellToRowcol().
Referenced by _convertRange2d(), _convertRange3d(), _convertRef2d(), and _convertRef3d().
PHPExcel_Writer_Excel5_Parser::_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 1045 of file Parser.php.
References $row.
Referenced by _cellToPackedRowcol().
PHPExcel_Writer_Excel5_Parser::_condition | ( | ) |
It parses a condition.
It assumes the following rule: Cond -> Expr [(">" | "<") Expr]
private
Definition at line 1250 of file Parser.php.
References _advance(), _createTree(), and _expression().
Referenced by _func(), and parse().
PHPExcel_Writer_Excel5_Parser::_convert | ( | $token | ) |
Convert a token to the proper ptg value.
private
mixed | $token | The token to convert. |
Definition at line 524 of file Parser.php.
References _convertError(), _convertNumber(), _convertRange2d(), _convertRange3d(), _convertRef2d(), _convertRef3d(), and _convertString().
Referenced by toReversePolish().
PHPExcel_Writer_Excel5_Parser::_convertError | ( | $errorCode | ) |
Convert an error code to a ptgErr.
private
mixed | $num | an error codefor conversion to its ptg value |
Definition at line 806 of file Parser.php.
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_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 629 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::_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 585 of file Parser.php.
References PHPExcel_Writer_Excel5_BIFFwriter\getByteOrder().
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_convertRange2d | ( | $range, | |
$class = 0 |
|||
) |
Convert an Excel range such as A1:D4 to a ptgRefV.
private
string | $range | An Excel range in the A1:A2 |
Definition at line 650 of file Parser.php.
References _cellToPackedRowcol().
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_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 690 of file Parser.php.
References _cellToPackedRowcol(), _getRefIndex(), _packExtRef(), and _rangeToPackedRange().
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_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 739 of file Parser.php.
References $row, and _cellToPackedRowcol().
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_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 769 of file Parser.php.
References $row, _cellToPackedRowcol(), _getRefIndex(), and _packExtRef().
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_convertString | ( | $string | ) |
Convert a string token to ptgStr.
private
string | $string | A string for conversion to its ptg value. |
Definition at line 605 of file Parser.php.
References PHPExcel_Shared_String\UTF8toBIFF8UnicodeShort().
Referenced by _convert().
PHPExcel_Writer_Excel5_Parser::_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 1536 of file Parser.php.
Referenced by _condition(), _expression(), _fact(), _func(), _parenthesizedExpression(), and _term().
PHPExcel_Writer_Excel5_Parser::_expression | ( | ) |
It parses a expression.
It assumes the following rule: Expr -> Term [("+" | "-") Term] -> "string" -> "-" Term : Negative value -> "+" Term : Positive value -> Error code
private
Definition at line 1296 of file Parser.php.
References _advance(), _createTree(), and _term().
Referenced by _condition(), and _parenthesizedExpression().
PHPExcel_Writer_Excel5_Parser::_fact | ( | ) |
It parses a factor.
It assumes the following rule: Fact -> ( Expr ) | CellRef | CellRange | Number | Function
private
Definition at line 1398 of file Parser.php.
References _advance(), _createTree(), _func(), and _parenthesizedExpression().
Referenced by _term().
PHPExcel_Writer_Excel5_Parser::_func | ( | ) |
It parses a function call.
It assumes the following rule: Func -> ( Expr [,Expr]* )
private
Definition at line 1486 of file Parser.php.
References _advance(), _condition(), and _createTree().
Referenced by _fact().
PHPExcel_Writer_Excel5_Parser::_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 873 of file Parser.php.
References _getSheetIndex().
Referenced by _convertRange3d(), and _convertRef3d().
PHPExcel_Writer_Excel5_Parser::_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 PHPExcel_Writer_Excel5_Workbook class.
private
Definition at line 932 of file Parser.php.
Referenced by _getRefIndex(), and _packExtRef().
PHPExcel_Writer_Excel5_Parser::_initializeHashes | ( | ) |
Initialize the ptg and function hashes.
private
Definition at line 148 of file Parser.php.
Referenced by __construct().
PHPExcel_Writer_Excel5_Parser::_match | ( | $token | ) |
Checks if it's a valid token.
private
mixed | $token | The token to check. |
Definition at line 1125 of file Parser.php.
Referenced by _advance().
PHPExcel_Writer_Excel5_Parser::_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 828 of file Parser.php.
References _getSheetIndex().
Referenced by _convertRange3d(), and _convertRef3d().
PHPExcel_Writer_Excel5_Parser::_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.
private
Definition at line 1355 of file Parser.php.
References _createTree(), and _expression().
Referenced by _fact().
PHPExcel_Writer_Excel5_Parser::_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 998 of file Parser.php.
Referenced by _convertRange3d().
PHPExcel_Writer_Excel5_Parser::_term | ( | ) |
It parses a term.
It assumes the following rule: Term -> Fact [("*" | "/") Fact]
private
Definition at line 1368 of file Parser.php.
References _advance(), _createTree(), and _fact().
Referenced by _expression().
PHPExcel_Writer_Excel5_Parser::parse | ( | $formula | ) |
The parsing method.
It parses a formula.
public
string | $formula | The formula to parse, without the initial equal sign (=). |
Definition at line 1233 of file Parser.php.
References _advance(), and _condition().
PHPExcel_Writer_Excel5_Parser::setExtSheet | ( | $name, | |
$index | |||
) |
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.
public
string | $name | The name of the worksheet being added |
integer | $index | The index of the worksheet being added |
Definition at line 951 of file Parser.php.
References $name.
PHPExcel_Writer_Excel5_Parser::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:
produces: "23+"
The following tree:
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 1568 of file Parser.php.
References $_parse_tree, and _convert().
PHPExcel_Writer_Excel5_Parser::$_BIFF_version |
Definition at line 122 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::$_current_char |
Definition at line 80 of file Parser.php.
Referenced by _advance().
PHPExcel_Writer_Excel5_Parser::$_current_token |
Definition at line 86 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::$_ext_sheets |
Definition at line 110 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::$_formula |
Definition at line 92 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::$_lookahead |
Definition at line 98 of file Parser.php.
PHPExcel_Writer_Excel5_Parser::$_parse_tree |
Definition at line 104 of file Parser.php.
Referenced by toReversePolish().
PHPExcel_Writer_Excel5_Parser::$_references |
Definition at line 116 of file Parser.php.
const PHPExcel_Writer_Excel5_Parser::REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+' |
Definition at line 74 of file Parser.php.
const PHPExcel_Writer_Excel5_Parser::REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&<>\=\,\;\#\(\)\"\{\}]+' |
Constants.
Definition at line 68 of file Parser.php.