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

Public Member Functions | |
| Parser ($byte_order=0) | |
| _initialize_hashes () | |
| _convert ($token) | |
| _convert_number ($num) | |
| _convert_function ($token, $num_args) | |
| _convert_range2d ($range) | |
| _convert_ref2d ($cell) | |
| _cell_to_packed_rowcol ($cell) | |
| _cell_to_rowcol ($cell) | |
| _advance () | |
| _match ($token) | |
| parse ($formula) | |
| _expression () | |
| _parenthesized_expression () | |
| _term () | |
| _fact () | |
| _func () | |
| _create_tree ($value, $left, $right) | |
| to_reverse_polish ($tree=array()) | |
| __construct () | |
| parse ($filename) | |
| getLine () | |
| getLineType () | |
| getLineTypeStr ($lineType) | |
| getTotalLines () | |
| getCoveredLines () | |
| getUncoveredLines () | |
Protected Member Functions | |
| processLine ($line) | |
| openFileReadOnly () | |
Protected Attributes | |
| $totalLines | |
| $coveredLines | |
| $uncoveredLines | |
| $fileRef | |
| $filename | |
| $line | |
| $logger | |
Definition at line 71 of file Parser.php.
| __construct | ( | ) |
Constructor public
Definition at line 50 of file Parser.php.
| _advance | ( | ) |
Advance to the next valid token.
Definition at line 659 of file Parser.php.


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


| _cell_to_rowcol | ( | $ | 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 boolean values to indicate whether the row or column are relative references.
| string | $cell | The Excel cell reference in A1 format. |
Definition at line 631 of file Parser.php.

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


| _convert_function | ( | $ | token, |
| $ | num_args | ||
| ) |
Convert a function to a ptgFunc or ptgFuncVarV depending on the number of args that it takes.
| string | $token | The name of the function for convertion to ptg value. |
| integer | $num_args | The number of arguments the function recieves. |
Definition at line 510 of file Parser.php.

| _convert_number | ( | $ | num | ) |
Convert a number token to ptgInt or ptgNum
| mixed | $num | an integer or double for conersion to its ptg value |
Definition at line 487 of file Parser.php.

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


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


| _create_tree | ( | $ | value, |
| $ | left, | ||
| $ | right | ||
| ) |
Creates a tree. In fact an array which may have one or two arrays (sub-trees) as elements.
| 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 938 of file Parser.php.

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


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


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


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

| _match | ( | $ | token | ) |
Checks if it's a valid token.
| mixed | $token | The token to check. |
Definition at line 699 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.
Definition at line 805 of file Parser.php.


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


| getCoveredLines | ( | ) |
Returns the number of covered PHP lines
Definition at line 194 of file Parser.php.
| getLine | ( | ) |
Returns the next line from file.
Definition at line 103 of file Parser.php.

| getLineType | ( | ) | [abstract] |
Returns the type of last line read.
The type can be either * LINE_TYPE_EXEC Line that can be executed. * LINE_TYPE_NOEXEC Line that cannot be executed. This includes the variable and function definitions (without initialization), blank lines, non-PHP lines, etc.
Reimplemented in PHPParser.
| getLineTypeStr | ( | $ | lineType | ) |
Returns the string representation of LINE_TYPE
| $lineType |
Definition at line 143 of file Parser.php.

| getTotalLines | ( | ) |
Returns the total lines (PHP, non-PHP) from a file
Definition at line 181 of file Parser.php.
Returns the number of uncovered PHP lines
Note that the sum of covered and uncovered lines may not be equal to total lines.
Definition at line 210 of file Parser.php.
| openFileReadOnly | ( | ) | [protected] |
Opens the file to be parsed in Read-only mode
Reimplemented in PHPParser.
Definition at line 167 of file Parser.php.

| parse | ( | $ | filename | ) |
Parse a given file
| $filename | Full path of the file |
Definition at line 73 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 764 of file Parser.php.

| Parser | ( | $ | byte_order = 0 | ) |
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 79 of file Parser.php.

| processLine | ( | $ | line | ) | [abstract, protected] |
Process the line and classify it into either covered and uncovered.
| $line |
Reimplemented in PHPParser.

| to_reverse_polish | ( | $ | 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 969 of file Parser.php.

$coveredLines [protected] |
Definition at line 36 of file Parser.php.
$filename [protected] |
Definition at line 39 of file Parser.php.
$fileRef [protected] |
Definition at line 38 of file Parser.php.
$line [protected] |
Definition at line 41 of file Parser.php.
$logger [protected] |
Definition at line 42 of file Parser.php.
$totalLines [protected] |
Definition at line 35 of file Parser.php.
$uncoveredLines [protected] |
Definition at line 37 of file Parser.php.