You are here

public function Twig_TokenStream::next in Translation template extractor 7.2

Same name and namespace in other branches
  1. 6.3 vendor/Twig/TokenStream.php \Twig_TokenStream::next()
  2. 7.3 vendor/Twig/TokenStream.php \Twig_TokenStream::next()

Sets the pointer to the next token and returns the old one.

Return value

Twig_Token

2 calls to Twig_TokenStream::next()
Twig_TokenStream::expect in vendor/Twig/TokenStream.php
Tests a token and returns it or throws a syntax error.
Twig_TokenStream::nextIf in vendor/Twig/TokenStream.php
Tests a token, sets the pointer to the next one and returns it or throws a syntax error.

File

vendor/Twig/TokenStream.php, line 57

Class

Twig_TokenStream
Represents a token stream.

Code

public function next() {
  if (!isset($this->tokens[++$this->current])) {
    throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current - 1]
      ->getLine(), $this->filename);
  }
  return $this->tokens[$this->current - 1];
}