예제 #1
0
        /// <summary>
        /// Parse the input file and converts it into the AST.
        /// </summary>
        /// <param name="grammarType">Grammar rule to be tested.</param>
        /// <param name="inputFile">Input file to be tested.</param>
        /// <returns>AST node of the loaded input file.</returns>
        public static BaseAstNode LoadAst(Type grammarType, string inputFile)
        {
            var grammar = new MasterTestGrammar();

            grammar.Root = (NonTerminal)Activator.CreateInstance(grammarType, grammar);

            return(MasterParser.ParseAndCreateAst <BaseAstNode>(inputFile, grammar));
        }
예제 #2
0
 /// <summary>
 /// Loads a PDDL problem from the given input file. Does not include an input data validation.
 /// </summary>
 /// <param name="domainContext">Context of the corresponding domain.</param>
 /// <param name="problemFilePath">PDDL problem input file.</param>
 /// <returns>PDDL problem input data.</returns>
 public static PDDL.Problem LoadProblem(PDDL.Domain domainContext, string problemFilePath)
 {
     PDDL.Problem problem = MasterExporter.ToProblem(domainContext, MasterParser.ParseAndCreateAst <ProblemAstNode>(problemFilePath, new MasterGrammarProblem()));
     problem.FilePath = problemFilePath;
     return(problem);
 }
예제 #3
0
 /// <summary>
 /// Loads a PDDL domain from the given input file. Does not include an input data validation.
 /// </summary>
 /// <param name="domainFilePath">PDDL domain input file.</param>
 /// <returns>PDDL domain input data.</returns>
 public static PDDL.Domain LoadDomain(string domainFilePath)
 {
     PDDL.Domain domain = MasterExporter.ToDomain(MasterParser.ParseAndCreateAst <DomainAstNode>(domainFilePath, new MasterGrammarDomain()));
     domain.FilePath = domainFilePath;
     return(domain);
 }