@@ 213-223 (lines=11) @@ | ||
210 | * |
|
211 | * @return array |
|
212 | */ |
|
213 | protected function any($openKind, $parseFn, $closeKind) |
|
214 | { |
|
215 | $this->expect($openKind); |
|
216 | $nodes = []; |
|
217 | ||
218 | while (!$this->skip($closeKind)) { |
|
219 | array_push($nodes, $parseFn($this)); |
|
220 | } |
|
221 | ||
222 | return $nodes; |
|
223 | } |
|
224 | ||
225 | /** |
|
226 | * Returns a non-empty list of parse nodes, determined by the parseFn. |
|
@@ 238-248 (lines=11) @@ | ||
235 | * |
|
236 | * @return array |
|
237 | */ |
|
238 | protected function many($openKind, $parseFn, $closeKind) |
|
239 | { |
|
240 | $this->expect($openKind); |
|
241 | $nodes = [$parseFn($this)]; |
|
242 | ||
243 | while (!$this->skip($closeKind)) { |
|
244 | array_push($nodes, $parseFn($this)); |
|
245 | } |
|
246 | ||
247 | return $nodes; |
|
248 | } |
|
249 | ||
250 | /** |
|
251 | * Converts a name lex token into a name parse node. |