示例#1
0
 /**
  * Peek the type of the next token
  * @return epToken
  */
 protected function peek()
 {
     // peek the next token
     $t = $this->_lexer->peek();
     // ignore new lines
     while ($t && $t->value == "\n") {
         $this->_lexer->next();
         $t = $this->_lexer->peek();
     }
     // set up peeked token
     return $this->_p($t);
 }
示例#2
0
 /**
  * test Peek at EOF
  */
 function testPeekAtEOF()
 {
     // create the lexer
     $l = new epQueryLexer("from classA where var = 1234");
     // read to end
     $i = 0;
     while (($t = $l->next()) !== false) {
         $i++;
     }
     // assert 6 tokens: var x , y , z
     $this->assertEqual(6, $i);
     // eof. peek always returns false
     for ($i = 0; $i < 5; $i++) {
         $t = $l->peek();
         $this->assertTrue($t === false);
     }
 }
 /**
  * Peek the type of the next token
  * @return epQueryToken
  */
 protected function peek()
 {
     // peek the next token
     $t = $this->_lexer->peek();
     // ignore new lines
     while ($t && $t->type == EPQ_T_NEWLINE) {
         $this->_lexer->next();
         $t = $this->_lexer->peek();
     }
     // set up peeked token
     return $this->_p($t);
 }