ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 46 of file class.ilDclTokenizer.php.

References ilDclExpressionParser\getOperators().

Referenced by ilDclExpressionParser\parse().

47  {
48  $operators = array_keys(ilDclExpressionParser::getOperators());
49  $pattern = '#((^\[\[)[\d\.]+)|(\(|\)|\\' . implode("|\\", $operators) . ')#';
50  $tokens = preg_split($pattern, $math_expression, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
51 
52  return array_map('trim', $tokens);
53  }
+ 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 19 of file class.ilDclTokenizer.php.

References $r, and $results.

Referenced by ilDclExpressionParser\parse().

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

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