Exemple #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 && !$this->blacklist->hasValue($char)) {
         $lookahead = $index;
         do {
             $lookahead++;
             $next = $reader->readChar($lookahead, false);
         } while ($next !== null && !$this->blacklist->hasValue($next));
         $token = $reader->readRange($index, $lookahead);
         $tuple = new Lexer\Scanner\Tuple(Lexer\Scanner\TokenType::keyword(), new Common\String($token));
         return $tuple;
     }
     return null;
 }
Exemple #2
0
 /**
  * This method returns whether the second hash set is a superset of the first hash
  * set.
  *
  * @access public
  * @static
  * @param Common\ISet $s1                                   the first set
  * @param Common\ISet $s2                                   the second set
  * @return Common\ISet                                      whether the second hash set is a
  *                                                          superset of the first hash set
  */
 public static function isSuperset(Common\ISet $s1, Common\ISet $s2)
 {
     return $s2->hasValues($s1);
 }