/** * Parse input string * * @param string|null $input * * @return float|int|array */ public function parse($input = null) { if (null !== $input) { $this->input = $input; } $this->nextCardinal = null; $this->nextSymbol = null; $this->lexer->setInput($this->input); // Move Lexer to first token $this->lexer->moveNext(); // Parse and return value return $this->point(); }
public function testReusedLexer() { $lexer = new Lexer(); foreach ($this->testDataSource() as $data) { $input = $data['input']; $expectedTokens = $data['expectedTokens']; $index = 0; $lexer->setInput($input); while (null !== ($actual = $lexer->peek())) { $this->assertEquals($expectedTokens[$index++], $actual); } } }