MediaWiki REL1_31
|
Public Member Functions | |
doExpression ( $expr) | |
Evaluate a mathematical expression. | |
doOperation ( $op, &$stack) | |
Public Attributes | |
$maxStackSize = 100 | |
$names | |
$precedence | |
$words | |
Definition at line 65 of file ExprParser.php.
ExprParser::doExpression | ( | $expr | ) |
Evaluate a mathematical expression.
The algorithm here is based on the infix to RPN algorithm given in http://montcs.bloomu.edu/~bobmon/Information/RPN/infix2rpn.shtml It's essentially the same as Dijkstra's shunting yard algorithm.
string | $expr |
ExprError |
Definition at line 179 of file ExprParser.php.
References $matches, doOperation(), EXPR_ABS, EXPR_ARCCOS, EXPR_ARCSINE, EXPR_ARCTAN, EXPR_CEIL, EXPR_COSINE, EXPR_DIVIDE, EXPR_EQUALITY, EXPR_EXP, EXPR_EXPONENT, EXPR_FLOOR, EXPR_GREATER, EXPR_GREATEREQ, EXPR_LESS, EXPR_LESSEQ, EXPR_LN, EXPR_MINUS, EXPR_NEGATIVE, EXPR_NOT, EXPR_NOTEQ, EXPR_NUMBER_CLASS, EXPR_OPEN, EXPR_PI, EXPR_PLUS, EXPR_POSITIVE, EXPR_POW, EXPR_SINE, EXPR_SQRT, EXPR_TANGENS, EXPR_TIMES, EXPR_TRUNC, and EXPR_WHITE_CLASS.
ExprParser::doOperation | ( | $op, | |
& | $stack ) |
int | $op | |
array | &$stack |
ExprError |
Definition at line 394 of file ExprParser.php.
References $result, $value, EXPR_ABS, EXPR_AND, EXPR_ARCCOS, EXPR_ARCSINE, EXPR_ARCTAN, EXPR_CEIL, EXPR_COSINE, EXPR_DIVIDE, EXPR_EQUALITY, EXPR_EXP, EXPR_EXPONENT, EXPR_FLOOR, EXPR_FMOD, EXPR_GREATER, EXPR_GREATEREQ, EXPR_LESS, EXPR_LESSEQ, EXPR_LN, EXPR_MINUS, EXPR_MOD, EXPR_NEGATIVE, EXPR_NOT, EXPR_NOTEQ, EXPR_OR, EXPR_PLUS, EXPR_POSITIVE, EXPR_POW, EXPR_ROUND, EXPR_SINE, EXPR_SQRT, EXPR_TANGENS, EXPR_TIMES, and EXPR_TRUNC.
Referenced by doExpression().
ExprParser::$maxStackSize = 100 |
Definition at line 66 of file ExprParser.php.
ExprParser::$names |
Definition at line 107 of file ExprParser.php.
ExprParser::$precedence |
Definition at line 68 of file ExprParser.php.
ExprParser::$words |
Definition at line 144 of file ExprParser.php.