예제 #1
0
 /**
  * This method return a tuple representing the token discovered.
  *
  * @access public
  * @param \Unicity\IO\Reader $reader                        the reader to be used
  * @return \Unicity\Lexer\Scanner\Tuple                     a tuple representing the token
  *                                                          discovered
  */
 public function process(IO\Reader $reader)
 {
     $index = $reader->position();
     $char = $reader->readChar($index, false);
     if ($char !== null && preg_match('/^[_a-z]$/i', $char)) {
         $lookahead = $index;
         do {
             $lookahead++;
             $next = $reader->readChar($lookahead, false);
         } while ($next !== null && preg_match('/^[_a-z0-9]$/i', $next));
         $token = $reader->readRange($index, $lookahead);
         $type = $this->keywords->hasValue($token) ? Lexer\Scanner\TokenType::keyword() : Lexer\Scanner\TokenType::identifier();
         $tuple = new Lexer\Scanner\Tuple($type, new Common\String($token));
         return $tuple;
     }
     return null;
 }
예제 #2
0
 /**
  * This method returns whether a path should be logged.
  *
  * @access protected
  * @param string $path                                      the path to be evaluated
  * @return boolean                                          whether the path should be logged
  */
 protected function doLog($path)
 {
     return !$this->ignorables->hasValue($path) && !$this->ignorables->hasValue(static::buildPathUsingWildcards($path));
 }