Haanga_Compiler::getOpCodes PHP Method

getOpCodes() public method

@param string $code Template content
public getOpCodes ( string $code, string $file ) : Haanga_AST
$code string
$file string File path (used for erro reporting) @return Haanga_AST
return Haanga_AST
    public function getOpCodes($code, $file)
    {
        $oldfile = $this->file;
        $this->file = $file;
        $parsed = Haanga_Compiler_Tokenizer::init($code, $this, $file);
        $body = new Haanga_AST();
        if (isset($parsed[0]) && $parsed[0]['operation'] == 'base') {
            throw new Exception("{% base is not supported on inlines %}");
        }
        $body = new Haanga_AST();
        $this->generate_op_code($parsed, $body);
        $this->file = $oldfile;
        return $body;
    }