Lexer::nextToken PHP Method

nextToken() public method

public nextToken ( )
    public function nextToken()
    {
        static $i = 0;
        switch (++$i) {
            case 2:
                return $this->token('indent');
            case 4:
                return $this->token('text', 'Foo Bar');
            case 7:
                return $this->token('text', 'Hello');
            default:
                return $this->token('newline');
        }
    }

Usage Example

Example #1
0
 /**
  * @param string $body
  * @return Token
  */
 private function lexOne($body)
 {
     $lexer = new Lexer(new Source($body));
     return $lexer->nextToken();
 }