Exemplo n.º 1
0
        private static OutputStream GetSelectedOutput(ParsedCommandOptions options)
        {
            var o = options.FindOption("output", "out", "o")?.Argument;

            if (o == null || o.ToLower() == "console")
            {
                return(new ConsoleStream());
            }
            else
            {
                return(new FileOutputStream(o));
            }
        }
Exemplo n.º 2
0
        public static void Compile(ParsedCommandOptions opts)
        {
            Console.WriteLine("Reading parse file..");

            var output = GetSelectedOutput(opts);
            var input  = new MultiFileInputStream(new List <string>(new string[] { @"C:\Users\yveem\source\repos\Redmond\TestInput.txt" }));
            //var input = GetAllCSFiles(@"C:\Users\yveem\source\repos\CompileTestProject");
            //var input = GetAllCSFiles(@"C:\Users\yveem\source\repos\Redmond");

            ParseFile parseFile = new ParseFile(@"C:\Users\yveem\source\repos\Redmond\TestParse.parse").Read();

            string inputFile = opts.FindOption("input", "i")?.Argument ??
                               @"C:\Users\yveem\source\repos\Redmond\TestInput.txt";

            var context = new CompilationContext(parseFile, input, output);

            context.Compile();
        }