| @@ 451-462 (lines=12) @@ | ||
| 448 | * @param integer $tokenValue The target value, e.g. T_ELSE |
|
| 449 | * @return bool Whether a matching token was found |
|
| 450 | */ |
|
| 451 | public function skipTo($tokenValue) |
|
| 452 | { |
|
| 453 | while (++$this->offset < $this->cnt) |
|
| 454 | { |
|
| 455 | if (isset($this->tokens[$this->offset][0]) && $this->tokens[$this->offset][0] === $tokenValue) |
|
| 456 | { |
|
| 457 | return true; |
|
| 458 | } |
|
| 459 | } |
|
| 460 | ||
| 461 | return false; |
|
| 462 | } |
|
| 463 | ||
| 464 | /** |
|
| 465 | * Iterate through tokens until the stream reaches given token or the end of stream |
|
| @@ 470-481 (lines=12) @@ | ||
| 467 | * @param array|string $token The target token, either a string or a [tokenValue, string] pair |
|
| 468 | * @return bool Whether a matching token was found |
|
| 469 | */ |
|
| 470 | public function skipToToken($token) |
|
| 471 | { |
|
| 472 | while (++$this->offset < $this->cnt) |
|
| 473 | { |
|
| 474 | if (isset($this->tokens[$this->offset]) && $this->tokens[$this->offset] === $token) |
|
| 475 | { |
|
| 476 | return true; |
|
| 477 | } |
|
| 478 | } |
|
| 479 | ||
| 480 | return false; |
|
| 481 | } |
|
| 482 | ||
| 483 | /** |
|
| 484 | * Test whether the stream is at a valid offset |
|