ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 47 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 !!!DIC refactoring-script warning.!!! There is an isolated 'global' whithout any variable behind. Either this is a comment, or something is seriously wrong
       @return array

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

References $r, $results, and array.

Referenced by ilDclExpressionParser\parse().

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

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