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'); } }
/** * @param string $body * @return Token */ private function lexOne($body) { $lexer = new Lexer(new Source($body)); return $lexer->nextToken(); }