1 | <?php |
||
18 | abstract class MultistateLexer extends SimpleLexer implements MultistateLexerInterface |
||
19 | { |
||
20 | /** |
||
21 | * @var int |
||
22 | */ |
||
23 | protected const DEFAULT_STATE = 0x00; |
||
24 | |||
25 | /** |
||
26 | * @var array|int[] |
||
27 | */ |
||
28 | protected $states = []; |
||
29 | |||
30 | /** |
||
31 | * @var array|int[] |
||
32 | */ |
||
33 | protected $transitions = []; |
||
34 | |||
35 | /** |
||
36 | * @param string $token |
||
37 | * @param int $state |
||
38 | * @param int|null $nextState |
||
39 | * @return MultistateLexerInterface |
||
40 | */ |
||
41 | public function state(string $token, int $state, int $nextState = null): MultistateLexerInterface |
||
51 | |||
52 | /** |
||
53 | * @return iterable |
||
54 | */ |
||
55 | public function getTokenDefinitions(): iterable |
||
65 | |||
66 | /** |
||
67 | * @param string $token |
||
68 | * @return int |
||
69 | */ |
||
70 | protected function getTokenState(string $token): int |
||
74 | |||
75 | /** |
||
76 | * @param string $token |
||
77 | * @return int |
||
78 | */ |
||
79 | protected function getNextState(string $token): int |
||
83 | } |
||
84 |