예제 #1
0
 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;
 }
예제 #2
0
 public function __construct($object, $data)
 {
     parent::__construct($object, $data);
 }
예제 #3
0
            $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();
예제 #4
0
파일: Route.php 프로젝트: Zanej/cms
 /**
  * 
  * @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;
 }