Contains the swExpression class to evaluate expressions, the swExpressionError class and functions to convert numbers to text
File also popluates the global $swExpressionFunctions array (only once for performance)
swExpression Provides a class evaluate algebraic expressions Removes trailing zeros in fraction of a number XpNative, swExpression, swExpressionError, swExpressionFunctionBoundary swConvertText12, swTrimTrailingZeroes, swUnescape $err, $exp, $swExpressionFunctions, $swExpressionOperators, $swFunctions Short variables: $a, $acc, $arg, $c, $ch, $d, $e, $e2, $f, $fl, $fn, $i, $j, $k, $l, $nbr, $op, $op2, $opi, $rv, $rvi, $s, $t, $tc, $te, $v array, class, exception, math, mb, str, string, variable s
Expressions are tokenized, then compiled to an RPN array.
Compiled expressions can be evaluated provided a value dictionary.
The expression class also initates the native functions in $swExpressionFunctions using swFunctions
This is done late because configuration.php can add functions.
$source
$tokens() numbers 0..9, strings $hex, functions @(id, operators, names, (, ), ","
$rpn()
$stack() value stack during exections
$expectedreturn number of results an expression is expected to return (can be more than 1)Methods
Properties
swExpressionError extends
Stub classMethods
Properties
swExpressionFunctionBoundary Stub classMethods
Properties
Functions
swConvertText12($d)
Converts a number of a string with 12 digit precisionswConvertText15($d)
Converts a number of a string with 15 digit precisionswTrimTrailingZeroes($nbr)
1000 returns 1000
105.32 returns 105.32
105.3200 returns 15.32Used elements
Classes
Functions
Globals
Variables
$aggregatorfirstrun, $args, $comps, $cond, $currentindex, $currentlabel, $dummy, $found, $foundhigher, $globals, $jump, $localdict, $negationpossible, $operatorstack, $opfound, $opprec, $optop, $result, $results, $state, $tests, $valuesFeatures
Others