/** * Assert the next token is of a specified type * * @param string $token * @param boolean $moveNext * @return $this */ private function match($token, $moveNext = true) { $lookaheadType = $this->lexer->lookahead['type']; if ($lookaheadType !== $token) { $this->syntaxError($this->lexer->getLiteral($token)); } if ($moveNext) { $this->lexer->moveNext(); } return $this; }
/** * Test lexing an input without placeholders tokenizes as expected * * @covers ::getType */ public function testLexingInputWithoutPlaceholders() { $this->lexer->setInput('/one'); $this->lexer->moveNext(); $this->lexer->moveNext(); $this->assertToken(Lexer::T_STRING, $this->lexer->token['type']); $this->assertEquals('/one', $this->lexer->token['value']); $this->assertNull($this->lexer->lookahead); }