Ejemplo n.º 1
0
 /**
  * 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();
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }