Lines Matching refs:this

23      * The {@see TokenSource} from which tokens for this stream are fetched.
68 * this field.
76 $this->tokenSource = $tokenSource;
81 return $this->tokenSource;
86 return $this->index;
101 $this->lazyInit();
103 $this->index = $this->adjustSeekIndex($index);
108 return \count($this->tokens);
115 if ($this->index >= 0) {
116 if ($this->fetchedEOF) {
119 $skipEofCheck = $this->index < \count($this->tokens) - 1;
122 $skipEofCheck = $this->index < \count($this->tokens);
126 if (!$skipEofCheck && $this->LA(1) === Token::EOF) {
130 if ($this->sync($this->index + 1)) {
131 $this->index = $this->adjustSeekIndex($this->index + 1);
145 $n = $i - \count($this->tokens) + 1; // how many more elements we need?
148 $fetched = $this->fetch($n);
158 if ($this->fetchedEOF) {
164 $token = $this->tokenSource->nextToken();
165 $token->setTokenIndex(\count($this->tokens));
167 $this->tokens[] = $token;
170 $this->fetchedEOF = true;
181 $count = \count($this->tokens);
191 $this->lazyInit();
193 return $this->tokens[$index];
198 $token = $this->LT($i);
205 if ($this->index - $k < 0) {
209 return $this->tokens[$this->index - $k];
214 $this->lazyInit();
221 return $this->LB(-$k);
224 $i = $this->index + $k - 1;
226 $this->sync($i);
228 if ($i >= \count($this->tokens)) {
231 return $this->tokens[\count($this->tokens) - 1];
234 return $this->tokens[$i];
241 * exception is thrown in this method, the current stream index should not
244 * For example, {@see CommonTokenStream} overrides this method to ensure
258 if ($this->index === -1) {
259 $this->setup();
265 $this->sync(0);
267 $this->index = $this->adjustSeekIndex(0);
271 * Reset this token stream by setting its token source.
275 $this->tokenSource = $tokenSource;
276 $this->tokens = [];
277 $this->index = -1;
278 $this->fetchedEOF = false;
286 return $this->tokens;
300 $this->lazyInit();
303 if ($stop >= \count($this->tokens)) {
304 $stop = \count($this->tokens) - 1;
308 $t = $this->tokens[$i];
329 $this->sync($i);
331 if ($i >= \count($this->tokens)) {
332 return $this->getLength() - 1;
335 $token = $this->tokens[$i];
343 $this->sync($i);
345 $token = $this->tokens[$i];
362 while ($i >= 0 && $this->tokens[$i]->getChannel() !== $channel) {
378 $this->lazyInit();
380 if ($tokenIndex < 0 || $tokenIndex >= \count($this->tokens)) {
381 throw new \RuntimeException(\sprintf('%d not in 0..%d', $tokenIndex, \count($this->tokens) - 1));
384 $nextOnChannel = $this->nextTokenOnChannel($tokenIndex + 1, Lexer::DEFAULT_TOKEN_CHANNEL);
387 $to = $nextOnChannel === -1 ? \count($this->tokens) - 1 : $nextOnChannel;
389 return $this->filterForChannel($from_, $to, $channel);
401 $this->lazyInit();
403 if ($tokenIndex < 0 || $tokenIndex >= \count($this->tokens)) {
404 throw new \RuntimeException(\sprintf('%d not in 0..%d', $tokenIndex, \count($this->tokens) - 1));
407 $prevOnChannel = $this->previousTokenOnChannel($tokenIndex - 1, Lexer::DEFAULT_TOKEN_CHANNEL);
417 return $this->filterForChannel($from, $to, $channel);
427 $t = $this->tokens[$i];
447 return $this->tokenSource->getSourceName();
451 * Get the text of all tokens in this buffer.
455 $this->lazyInit();
456 $this->fill();
464 if ($stop >= \count($this->tokens)) {
465 $stop = \count($this->tokens) - 1;
470 $t = $this->tokens[$i];
484 return $this->getTextByInterval(new Interval(0, \count($this->tokens) - 1));
490 $stopIndex = $stop === null ? \count($this->tokens) - 1 : $stop->getTokenIndex();
492 return $this->getTextByInterval(new Interval($startIndex, $stopIndex));
497 return $this->getTextByInterval($context->getSourceInterval());
505 $this->lazyInit();
507 while ($this->fetch(1000) === 1000) {