public Parse ( |
||
input | ||
리턴 |
protected virtual PrologCompilerResults FromFile(PrologCompilerParameters options, string fileName) { PrologCompilerResults results = new PrologCompilerResults(); PrologCodeParser parser = new PrologCodeParser(); PrologCodeUnit unit = new PrologCodeUnit(); try { StreamReader reader = new StreamReader(fileName); unit = parser.Parse(reader); } catch (FileNotFoundException) { results.Errors.Add(new PrologCompilerError("P0008", "Input file not found.", fileName, false, 0, 0)); return(results); } return(FromUnit(options, unit)); }
PrologCompilerResults IPrologCompiler.CompileAbstractCodeFromFile(PrologCompilerParameters p, string fileName) { PrologCompilerResults results = new PrologCompilerResults(); PrologCodeParser parser = new PrologCodeParser(); PrologCodeUnit unit = new PrologCodeUnit(); try { StreamReader reader = new StreamReader(fileName); unit = parser.Parse(reader); /* Get errors after parsing */ results.Errors = parser.Errors; } catch (FileNotFoundException) { results.Errors.Add(new PrologCompilerError("P0008", "Input file not found.", fileName, false, 0, 0)); return(results); } results.AbstractInstructions = new ArrayList(); GenerateCodeFromUnit(unit, results.AbstractInstructions); /* patch predicates */ //PatchPredicates(results.AbstractInstructions, GetPredicateAddresses(results.AbstractInstructions)); /* Save foreign methods */ //results.ForeignMethods = GetForeignMethods(unit.Methods); /* save namespaces */ results.Namespaces = unit.Namespaces; /* save assembly files */ results.AssemblyFiles = unit.AssemblyFiles; /* return results */ return(results); }
PrologCompilerResults IPrologCompiler.CompileAbstractCodeFromFile(PrologCompilerParameters p, string fileName) { PrologCompilerResults results = new PrologCompilerResults(); PrologCodeParser parser = new PrologCodeParser(); PrologCodeUnit unit = new PrologCodeUnit(); try { StreamReader reader = new StreamReader(fileName); unit = parser.Parse(reader); /* Get errors after parsing */ results.Errors = parser.Errors; } catch (FileNotFoundException) { results.Errors.Add(new PrologCompilerError("P0008", "Input file not found.", fileName, false, 0, 0)); return results; } results.AbstractInstructions = new ArrayList(); GenerateCodeFromUnit(unit, results.AbstractInstructions); /* patch predicates */ //PatchPredicates(results.AbstractInstructions, GetPredicateAddresses(results.AbstractInstructions)); /* Save foreign methods */ //results.ForeignMethods = GetForeignMethods(unit.Methods); /* save namespaces */ results.Namespaces = unit.Namespaces; /* save assembly files */ results.AssemblyFiles = unit.AssemblyFiles; /* return results */ return results; }
protected virtual PrologCompilerResults FromFile(PrologCompilerParameters options, string fileName) { PrologCompilerResults results = new PrologCompilerResults(); PrologCodeParser parser = new PrologCodeParser(); PrologCodeUnit unit = new PrologCodeUnit(); try { StreamReader reader = new StreamReader(fileName); unit = parser.Parse(reader); } catch (FileNotFoundException) { results.Errors.Add(new PrologCompilerError("P0008", "Input file not found.", fileName, false, 0, 0)); return results; } return FromUnit(options, unit); }