function tokenize() { while (($this->chunk = substr($this->code, $this->index)) !== FALSE) { $types = array('identifier', 'comment', 'whitespace', 'line', 'heredoc', 'string', 'number', 'regex', 'js', 'literal'); foreach ($types as $type) { if ($d = $this->{$type . '_token'}()) { $this->index += $d; break; } } } $this->close_indentation(); if ($this->options['rewrite']) { $rewriter = new Rewriter($this->tokens); $this->tokens = $rewriter->rewrite(); } return $this->tokens; }
public function __construct($object, $data) { parent::__construct($object, $data); }
$i += $block($this->tokens[$i], $i, $this->tokens); } return TRUE; } function tag($i) { return isset($this->tokens[$i]) ? $this->tokens[$i][0] : NULL; } function tag_postfix_conditionals() { $condition = function ($token, $i) { return in_array($token[0], t('TERMINATOR', 'INDENT')); }; $self = $this; $this->scan_tokens(function (&$token, $i) use(&$condition, &$self) { if (!($token[0] === t('IF'))) { return 1; } $original =& $token; $self->detect_end($i + 1, $condition, function ($token, $i) use(&$original) { if ($token[0] !== t('INDENT')) { $original[0] = t('POST_IF'); // 'POST_'.$original[0]; } }); return 1; }); } } Rewriter::init();
/** * * @param type $method */ static function methodExists($method) { $perc = explode("\\", $method); $file = $_SERVER["DOCUMENT_ROOT"]; for ($i = 1; $i < count($perc) - 2; $i++) { $file .= $perc[$i] . "/"; } $file_php = $perc[count($perc) - 2]; $filename = Rewriter::fileVariants($file, $file_php); if ($filename === false) { return false; } $class = substr($method, 0, strrpos($method, "\\")); if (method_exists($class, $perc[count($perc) - 1])) { return array("class" => $class, "method" => $perc[count($perc) - 1]); } return false; }