Compiler.php
private function onTokenFound($token) {
        if (is_array($token)) $token = array_pop($token);
        $token = trim($token);

        $tokenParts = explode(' ', $token);
        $tag        = array_shift($tokenParts);
        $params     = implode(' ', $tokenParts);

        if ($this->_blocks->has($tag)) {
            if ($this->_blocks->getDeepValue($tag . '/runtime')) {
                $res = '<?php $this->_compiler->invokeBlock(\'' . $tag . '\', ' . $this->compileExpression($params) . '); ?>';
            } else {
                $res = $this->onBlockTagOpen($tag, $params);
            }
        } elseif (substr($tag, 0, strlen($this->_config['blockClose'])) == $this->_config['blockClose']) {
            $tag = substr($tag, strlen($this->_config['blockClose']));
            $res = $this->onBlockTagClose($tag, $params);
        } else {
            $res = $this->onVarEchoToken($token, $params);
        }
        return $res;
    }
private function onTokenFound($token) {
        if (is_array($token)) $token = array_pop($token);
        $token = trim($token);

        $tokenParts = explode(' ', $token);
        $tag        = array_shift($tokenParts);
        $params     = implode(' ', $tokenParts);

        if ($this->_blocks->has($tag)) {
            if ($this->_blocks->getDeepValue($tag . '/runtime')) {
                $res = '<?php $this->_compiler->invokeBlock(\'' . $tag . '\', ' . $this->compileExpression($params) . '); ?>';
            } else {
                $res = $this->onBlockTagOpen($tag, $params);
            }
        } elseif (substr($tag, 0, strlen($this->_config['blockClose'])) == $this->_config['blockClose']) {
            $tag = substr($tag, strlen($this->_config['blockClose']));
            $res = $this->onBlockTagClose($tag, $params);
        } else {
            $res = $this->onVarEchoToken($token, $params);
        }
        return $res;
    }
Since it called step by step we can create context for each tag
@param $token
@return string