Esempio n. 1
0
 public function parse($program)
 {
     $parser = $this->factory->newParser();
     $program = $parser->parse($program);
     $this->data = $parser->getData();
     return $program;
 }
Esempio n. 2
0
 /**
  * @return Unpacker
  */
 public function load($filename, $load_compiled = true, $compile = true)
 {
     if ($load_compiled) {
         $unpacker = $this->loadCompiled($filename);
         if ($unpacker) {
             return $unpacker;
         }
     }
     $program = file_get_contents($filename);
     if ($compile) {
         $compiler = $this->factory->newCompiler($program);
         $compiler->compile($filename);
         // load the compiled file, but don't recursively recompile if
         // something goes horribly wrong.
         return $this->load($filename, true, false);
     }
     if (empty($program)) {
         throw new RuntimeException("Could not load {$filename}");
     }
     L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'selecting XOUP interpreter for %s', array($filename));
     return $this->factory->newInterpreter($program);
 }
Esempio n. 3
0
 /**
  * Utility method for SSLStruct subclasses
  * 
  * @return Unpacker
  */
 protected function getUnpackerForFile($filename)
 {
     return $this->xoup_factory->newLoader()->load($filename);
 }