| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public static function lex($string) |
||
| 27 | { |
||
| 28 | $tokens = []; |
||
| 29 | $cursor = 0; |
||
| 30 | |||
| 31 | while ($cursor < strlen($string)) { |
||
| 32 | $result = static::matchToken($string, $cursor); |
||
| 33 | if ($result === false) { |
||
| 34 | throw new UqlLexerException('Can\'t parse at character ' . $cursor . ': "' . substr($string, $cursor, 50) . '[...]"'); |
||
| 35 | } elseif ($result['token'] != "T_WHITESPACE") { |
||
| 36 | // We found a non-whitespace token. Store it. |
||
| 37 | $tokens[] = $result; |
||
| 38 | } |
||
| 39 | $cursor += strlen($result['match']); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $tokens; |
||
| 43 | } |
||
| 44 | |||
| 68 |