ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclTokenizer.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
19  public static function getTokens($expression)
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  }
37 
38 
46  public static function getMathTokens($math_expression)
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  }
54 }
$r
Definition: example_031.php:79
static getTokens($expression)
Split expression by & (ignore escaped &-symbols with backslash)
static getMathTokens($math_expression)
Generate tokens for a math expression.
Create styles array
The data for the language used.
Class ilDclTokenizer.
$results
Definition: svg-scanner.php:47