コード例 #1
0
ファイル: Mask.php プロジェクト: Nycto/phpVocab
 /**
  * Returns the next token in the stack without shifting it off the list
  *
  * @return \vc\Tokens\Token|NULL Returns NULL if no tokens are left
  */
 public function peekAtToken()
 {
     while ($this->inner->hasToken()) {
         $peek = $this->inner->peekAtToken();
         if (!$peek->is($this->mask)) {
             return $peek;
         }
         $this->inner->popToken();
     }
     return NULL;
 }
コード例 #2
0
ファイル: Until.php プロジェクト: Nycto/phpVocab
 /**
  * Returns the next token in the stack without shifting it off the list
  *
  * @return \vc\Tokens\Token|NULL Returns NULL if no tokens are left
  */
 public function peekAtToken()
 {
     if (!$this->active) {
         return NULL;
     }
     return $this->inner->peekAtToken();
 }
コード例 #3
0
ファイル: Search.php プロジェクト: Nycto/phpVocab
 /**
  * @see \vc\iface\Tokens\Search::findSkipping
  */
 public function peekToSkipping(array $types)
 {
     while ($this->reader->hasToken()) {
         $token = $this->reader->peekAtToken();
         $type = $token->getType();
         if (in_array($type, $types)) {
             return $token;
         }
         $this->reader->popToken();
     }
 }
コード例 #4
0
ファイル: Path.php プロジェクト: Nycto/phpVocab
 /**
  * Reads the path of a namespace
  *
  * @param \vc\iface\Tokens\Reader $reader The token source to pull from
  * @return NULL
  */
 public function parsePath(\vc\iface\Tokens\Reader $reader)
 {
     // Skip past any white space
     while ($reader->hasToken() && $reader->peekAtToken()->is(Token::T_WHITESPACE)) {
         $reader->popToken();
     }
     if (!$reader->hasToken()) {
         throw new \vc\Tokens\Exception\UnexpectedEnd(array(Token::T_STRING, Token::T_NS_SEPARATOR));
     }
     $reader->peekAtToken()->expect(array(Token::T_STRING, Token::T_NS_SEPARATOR));
     $path = array();
     while ($reader->hasToken()) {
         $token = $reader->peekAtToken();
         if ($token->is(array(Token::T_STRING, Token::T_NS_SEPARATOR))) {
             $path[] = $token->getContent();
         } else {
             break;
         }
         $reader->popToken();
     }
     return implode('', $path);
 }
コード例 #5
0
ファイル: Comments.php プロジェクト: Nycto/phpVocab
 /**
  * Returns the next token in the stack without shifting it off the list
  *
  * @return \vc\Tokens\Token|NULL Returns NULL if no tokens are left
  */
 public function peekAtToken()
 {
     return $this->inner->peekAtToken();
 }