ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDclTokenizer Class Reference

Class ilDclTokenizer. More...

+ Collaboration diagram for ilDclTokenizer:

Static Public Member Functions

static getTokens ($expression)
 Split expression by & (ignore escaped &-symbols with backslash)
static getMathTokens ($math_expression)
 Generate tokens for a math expression.

Detailed Description

Member Function Documentation

static ilDclTokenizer::getMathTokens (   $math_expression)
static

Generate tokens for a math expression.

Parameters
string$math_expressionExpression of type math
Returns
array

Definition at line 44 of file class.ilDclTokenizer.php.

References ilDclExpressionParser\getOperators().

Referenced by ilDclExpressionParser\parse().

{
$operators = array_keys(ilDclExpressionParser::getOperators());
$pattern = '#((^\[\[)[\d\.]+)|(\(|\)|\\' . implode("|\\", $operators) . ')#';
$tokens = preg_split($pattern, $math_expression, - 1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
return array_map('trim', $tokens);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilDclTokenizer::getTokens (   $expression)
static

Split expression by & (ignore escaped &-symbols with backslash)

Parameters
string$expressionGlobal expression to parse
Returns
array

Definition at line 18 of file class.ilDclTokenizer.php.

References $results.

Referenced by ilDclExpressionParser\parse().

{
$expression = ltrim($expression, '=');
$expression = trim($expression);
preg_match_all("/([^\\\\&]|\\\\&)*/ui", $expression, $matches);
$results = $matches[0];
$return = array();
foreach ($results as $r) {
if (!$r) {
continue;
}
$return[] = str_ireplace('\&', '&', $r);
}
return array_map('trim', $return);
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: