You are here

public function AbstractLexer::peek in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_annotation_discovery/lib/Doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php \Doctrine\Common\Lexer\AbstractLexer::peek()

Moves the lookahead token forward.

Return value

array | null The next token or NULL if there are no more tokens ahead.

1 call to AbstractLexer::peek()
AbstractLexer::glimpse in modules/providers/service_container_annotation_discovery/lib/Doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
Peeks at the next token, returns it and immediately resets the peek.

File

modules/providers/service_container_annotation_discovery/lib/Doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php, line 173

Class

AbstractLexer
Base class for writing simple lexers, i.e. for creating small DSLs.

Namespace

Doctrine\Common\Lexer

Code

public function peek() {
  if (isset($this->tokens[$this->position + $this->peek])) {
    return $this->tokens[$this->position + $this->peek++];
  }
  else {
    return null;
  }
}