Haanga_Compiler::generate_op_code PHP Method

generate_op_code() protected method

Main Loop {{{
protected generate_op_code ( $parsed, &$body )
    protected function generate_op_code($parsed, &$body)
    {
        if (!is_array($parsed)) {
            throw new Exception("Invalid \$parsed array");
        }
        foreach ($parsed as $op) {
            if (!is_array($op)) {
                continue;
            }
            if (!isset($op['operation'])) {
                throw new Exception("Malformed array:" . print_r($op, TRUE));
            }
            if (isset($op['line'])) {
                $this->line = $op['line'];
            }
            if ($this->subtemplate && $this->in_block == 0 && $op['operation'] != 'block') {
                /* ignore most of tokens in subtemplates */
                continue;
            }
            $method = "generate_op_" . $op['operation'];
            if (!is_callable(array($this, $method))) {
                throw new Exception("Compiler: Missing method {$method}");
            }
            $this->{$method}($op, $body);
        }
    }