/** * Compile the $code and return the "opcodes" * (the Abstract syntax tree). * * @param string $code Template content * @param string $file File path (used for erro reporting) * * @return Haanga_AST * */ public function getOpCodes($code, $file) { $oldfile = $this->file; $this->file = $file; $parsed = Haanga_Compiler_Lexer::init($code, $this, $file); $body = new Haanga_AST(); if (isset($parsed[0]) && $parsed[0]['operation'] == 'base') { $this->Error("{% base is not supported on inlines %}"); } $body = new Haanga_AST(); $this->generate_op_code($parsed, $body); $this->file = $oldfile; return $body; }