Lines Matching defs:index

12  * access to any previous token by index.
39 * The index into {@see BufferedTokenStream::tokens()} of the current token
52 protected $index = -1;
86 return $this->index;
99 public function seek(int $index) : void
103 $this->index = $this->adjustSeekIndex($index);
115 if ($this->index >= 0) {
119 $skipEofCheck = $this->index < \count($this->tokens) - 1;
122 $skipEofCheck = $this->index < \count($this->tokens);
130 if ($this->sync($this->index + 1)) {
131 $this->index = $this->adjustSeekIndex($this->index + 1);
136 * Make sure index `i` in tokens has a token.
138 * @return bool `true` if a token is located at index `i`,
179 public function get(int $index) : Token
183 if ($index < 0 || $index >= $count) {
185 'Token index %d out of range 0..%d.',
186 $index,
193 return $this->tokens[$index];
205 if ($this->index - $k < 0) {
209 return $this->tokens[$this->index - $k];
224 $i = $this->index + $k - 1;
239 * the current stream position by adjusting the target token index of a seek
241 * exception is thrown in this method, the current stream index should not
247 * @param int $i The target token index.
249 * @return int The adjusted target token index.
258 if ($this->index === -1) {
267 $this->index = $this->adjustSeekIndex(0);
277 $this->index = -1;
323 * Given a starting index, return the index of the next token on channel.
324 * Return `i` if `tokens[i]` is on channel. Return the index of the EOF
352 * Given a starting index, return the index of the previous token on channel.
356 * If `i` specifies an index at or after the EOF token, the EOF token
357 * index is returned. This is due to the fact that the EOF token is treated