コード例 #1
0
ファイル: Scanner.php プロジェクト: vpArth/interpreter.php
 public function testState()
 {
     $scan = new I\Scanner(new I\StringReader("1+2"), $ctx = new I\Context());
     $start = $scan->getState();
     $scan->next()->next()->next()->next();
     $this->assertSame(I\Scanner::EOF, $scan->type());
     $scan->setState($start);
     $this->assertSame('1', $scan->next()->token());
     $this->assertEquals(array(I\Scanner::CHAR, '+'), $scan->peek());
     $this->assertEquals(array(I\Scanner::CHAR, '+'), $scan->peek());
 }