ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
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) More...
 
static getMathTokens ($math_expression)
 Generate tokens for a math expression. More...
 

Detailed Description

Member Function Documentation

◆ getMathTokens()

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().

44  {
45  $operators = array_keys(ilDclExpressionParser::getOperators());
46  $pattern = '#((^\[\[)[\d\.]+)|(\(|\)|\\' . implode("|\\", $operators) . ')#';
47  $tokens = preg_split($pattern, $math_expression, - 1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
48 
49  return array_map('trim', $tokens);
50  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTokens()

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 $r, and $results.

Referenced by ilDclExpressionParser\parse().

18  {
19  $expression = ltrim($expression, '=');
20  $expression = trim($expression);
21  preg_match_all("/([^\\\\&]|\\\\&)*/ui", $expression, $matches);
22 
23  $results = $matches[0];
24 
25  $return = array();
26  foreach ($results as $r) {
27  if (!$r) {
28  continue;
29  }
30  $return[] = str_ireplace('\&', '&', $r);
31  }
32 
33  return array_map('trim', $return);
34  }
$r
Definition: example_031.php:79
$results
+ Here is the caller graph for this function:

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