public function getAST($sourcePath) { $lexer = new \Ormin\OBSLexicalParser\TES4\Lexer\ScriptLexer(); $tokens = $lexer->lex(file_get_contents($sourcePath)); $AST = $this->parser->parse($tokens); return $AST; }
public function transpile($sourcePaths, $outputPaths) { $ASTCollection = new TES4ScriptCollection(); foreach ($sourcePaths as $k => $sourcePath) { $lexer = new \Ormin\OBSLexicalParser\TES4\Lexer\ScriptLexer(); $tokens = $lexer->lex(file_get_contents($sourcePath)); $ASTCollection->add($this->parser->parse($tokens), $outputPaths[$k]); } $TES5ASTCollection = $this->converter->convert($ASTCollection); /** * @var TES5Target $target */ foreach ($TES5ASTCollection->getIterator() as $target) { file_put_contents($target->getOutputPath(), $target->getScript()->output()); passthru('lua "Utilities/beautifier.lua" "' . $target->getOutputPath() . '"'); } }