1 | <?php |
||
16 | class Tokenizer implements \Iterator { |
||
17 | /** |
||
18 | * @var SymbolTable |
||
19 | */ |
||
20 | protected $symbol_table; |
||
21 | |||
22 | /** |
||
23 | * @var mixed[] |
||
24 | */ |
||
25 | protected $tokens; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $position; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $source; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $unparsed; |
||
41 | |||
42 | /** |
||
43 | * @var int |
||
44 | */ |
||
45 | protected $parsing_position; |
||
46 | |||
47 | /** |
||
48 | * @var bool |
||
49 | */ |
||
50 | protected $is_end_token_added; |
||
51 | |||
52 | static $UNPARSED_PREVIEW_FOR_ERROR = 10; |
||
|
|||
53 | |||
54 | 46 | public function __construct(SymbolTable $symbol_table, $source) { |
|
63 | |||
64 | // Methods from Iterator-interface |
||
65 | |||
66 | /** |
||
67 | * @return array (Symbol,$matches) |
||
68 | */ |
||
69 | 44 | public function current() { |
|
73 | |||
74 | /** |
||
75 | * @inheritdocs |
||
76 | */ |
||
77 | 1 | public function key() { |
|
80 | |||
81 | /** |
||
82 | * @inheritdocs |
||
83 | */ |
||
84 | 39 | public function next() { |
|
87 | |||
88 | /** |
||
89 | * @inheritdocs |
||
90 | */ |
||
91 | 1 | public function rewind() { |
|
94 | |||
95 | /** |
||
96 | * @inheritdocs |
||
97 | */ |
||
98 | 1 | public function valid() { |
|
102 | |||
103 | /** |
||
104 | * Try to parse the next token if there are currently not enough tokens |
||
105 | * in the tokens to get a token for the current position. |
||
106 | * |
||
107 | * @throws ParserException if next token can not be parsed. |
||
108 | */ |
||
109 | 45 | public function maybe_parse_next_token() { |
|
114 | |||
115 | |||
116 | /** |
||
117 | * Try to parse the next token from the source. |
||
118 | * |
||
119 | * @throws ParserException if next token can not be parsed. |
||
120 | */ |
||
121 | 45 | protected function parse_next_token() { |
|
144 | |||
145 | /** |
||
146 | * Go forward in the string we have parsed so far. |
||
147 | * |
||
148 | * @param string $match |
||
149 | * @return null |
||
150 | */ |
||
151 | 39 | public function advance($match) { |
|
158 | |||
159 | /** |
||
160 | * Checkout if everything is parsed. |
||
161 | * |
||
162 | * @return bool |
||
163 | */ |
||
164 | 45 | protected function is_everything_parsed() { |
|
167 | } |
||
168 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.