public function __construct() { parent::__construct(); $this->setName('CssLike'); $this->addTest(TokenFilter::suite()); $this->addTest(Tokenizer::suite()); $this->addTest(Parser::suite()); $this->addTest(CssLike::suite()); }
static function match($token = '') { global $config, $lang; self::$matched = false; if (parent::_find_match($token, $config['cmd_tok_rgx']) === true) { $prefix = self::$matched_tokens[0]; $cmd = self::$matched_tokens[1]; // allow for partial matches also, use only first match $matches = preg_grep('/^' . $cmd . '/', $lang['command_names']); $index = !empty($matches) ? key($matches) : false; if ($index !== false) { self::$cmd = $lang['command_names'][$index]; self::$index = $index; self::$matched_token = $prefix . self::$cmd; self::$matched = true; } } return self::$matched; }
function filter_by(array $tasks, $token = '') { global $lang; if (parent::_find_match($token) === true) { $prefix = self::$matched_tokens[0]; $cmd = self::$matched_tokens[1]; // allow for partial matches also, use only first match $matches = preg_grep('/^' . $cmd . '/', $lang['command_names']); $index = !empty($matches) ? key($matches) : false; return $this->filter_by_index($tasks, $index); } else { return $tasks; } }