You are here

public function Twig_TokenStream::next in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/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/twig/lib/Twig/TokenStream.php
Tests a token and returns it or throws a syntax error.
Twig_TokenStream::nextIf in vendor/twig/twig/lib/Twig/TokenStream.php
Tests a token, sets the pointer to the next one and returns it or throws a syntax error.

File

vendor/twig/twig/lib/Twig/TokenStream.php, line 56

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];
}