1 | <?php |
||
12 | class Parser implements \Iterator |
||
13 | { |
||
14 | /** |
||
15 | * @var Math |
||
16 | */ |
||
17 | private $math; |
||
18 | |||
19 | /** |
||
20 | * @var BufferInterface |
||
21 | */ |
||
22 | private $empty; |
||
23 | |||
24 | /** |
||
25 | * @var ScriptInterface |
||
26 | */ |
||
27 | private $script; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | private $count = 0; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | private $position = 0; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | private $end = 0; |
||
43 | |||
44 | /** |
||
45 | * @var int |
||
46 | */ |
||
47 | private $execPtr = 0; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | private $data = ''; |
||
53 | |||
54 | /** |
||
55 | * @var Operation[] |
||
56 | */ |
||
57 | private $array = array(); |
||
58 | |||
59 | /** |
||
60 | * ScriptParser constructor. |
||
61 | * @param Math $math |
||
62 | * @param ScriptInterface $script |
||
63 | */ |
||
64 | 2598 | public function __construct(Math $math, ScriptInterface $script) |
|
73 | |||
74 | /** |
||
75 | * @return int |
||
76 | */ |
||
77 | 2 | public function getPosition() |
|
81 | |||
82 | /** |
||
83 | * @param string $packFormat |
||
84 | * @param integer $strSize |
||
85 | * @return array|bool |
||
86 | */ |
||
87 | 72 | private function unpackSize($packFormat, $strSize) |
|
99 | |||
100 | /** |
||
101 | * @param int $ptr |
||
102 | * @return Operation |
||
103 | */ |
||
104 | 2572 | private function doNext($ptr) |
|
142 | |||
143 | /** |
||
144 | * @param $begin |
||
145 | * @param null|int $length |
||
146 | * @return Script |
||
147 | */ |
||
148 | 130 | public function slice($begin, $length = null) |
|
166 | |||
167 | /** |
||
168 | * |
||
169 | */ |
||
170 | 2584 | public function rewind() |
|
175 | |||
176 | /** |
||
177 | * @return Operation |
||
178 | */ |
||
179 | 2572 | public function current() |
|
189 | |||
190 | /** |
||
191 | * @return int |
||
192 | */ |
||
193 | public function key() |
||
197 | |||
198 | /** |
||
199 | * @return Operation |
||
200 | */ |
||
201 | 2512 | public function next() |
|
211 | |||
212 | /** |
||
213 | * @return bool |
||
214 | */ |
||
215 | 2584 | public function valid() |
|
219 | |||
220 | /** |
||
221 | * @return Operation[] |
||
222 | */ |
||
223 | 1326 | public function decode() |
|
232 | |||
233 | /** |
||
234 | * @return string |
||
235 | */ |
||
236 | 6 | public function getHumanReadable() |
|
252 | } |
||
253 |