public function testCommentSkipped() { $compiler = new PrologCompiler(new WAMService()); $prog = $compiler->compileFile(FIXTURES_DIR . "basket.pro"); $this->assertNotNull($prog); // @todo I can't further test the preprocessing because it is not decoupled from compiling : need to refactor }
protected function consult($fileName) { $pc = new PrologCompiler($this); $prog = $pc->compileFile($fileName); if ($prog == null) { if (false === strpos($fileName, ".pro")) { // if compilation didn't work, try with different file extension $this->writeLn("Trying \"" . $fileName . ".prolog\" instead."); $prog = $pc->compileFile($fileName . ".prolog"); } } if ($prog == null) { // program could not be compiled/loaded for whatever reason $this->backtrack(); } else { if ($this->debugOn > 1) { // in case of debug mode, display the WAM code $this->writeLn($prog->__toString()); } $this->p->owner = $this; $this->p->addProgram($prog); // add program to that already in memory $this->p->updateLabels(); // and don't forget to update the jump labels $this->programCounter++; } }