1 | <?php |
||
15 | class Lexer |
||
16 | { |
||
17 | /** |
||
18 | * Lex the input string by moving through it trying to match any of |
||
19 | * the defined language tokens. |
||
20 | * |
||
21 | * @param $string |
||
22 | * |
||
23 | * @return array |
||
24 | * @throws \Exception |
||
25 | */ |
||
26 | public static function lex($string) |
||
44 | |||
45 | /** |
||
46 | * Tries to match any of the tokens to the current cursor position. |
||
47 | * |
||
48 | * @param $string |
||
49 | * @param $cursor |
||
50 | * |
||
51 | * @return array|bool |
||
52 | */ |
||
53 | public static function matchToken($string, $cursor) |
||
67 | } |
||
68 |