| @@ 45-54 (lines=10) @@ | ||
| 42 | * |
|
| 43 | * {@inheritdoc} |
|
| 44 | */ |
|
| 45 | public function next(): void |
|
| 46 | { |
|
| 47 | if (!isset($this->tokens[$this->position])) { |
|
| 48 | throw new SyntaxError('Unexpected end of expression', $this->current->cursor); |
|
| 49 | } |
|
| 50 | ||
| 51 | ++$this->position; |
|
| 52 | ||
| 53 | $this->current = $this->tokens[$this->position]; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Move stream pointer to the beginning. |
|
| @@ 103-112 (lines=10) @@ | ||
| 100 | /** |
|
| 101 | * Sets the pointer to the previous token. |
|
| 102 | */ |
|
| 103 | public function prev(): void |
|
| 104 | { |
|
| 105 | if (!isset($this->tokens[$this->position])) { |
|
| 106 | throw new SyntaxError('Unexpected start of expression', $this->current->cursor); |
|
| 107 | } |
|
| 108 | ||
| 109 | --$this->position; |
|
| 110 | ||
| 111 | $this->current = $this->tokens[$this->position]; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Tests a token and moves to previous one. |
|