Exemple #1
0
        static int Main(string[] args)
        {
            CommandLineParameters programParams = ParseParameters(args);

            if (!ValidateFilesExists(programParams.Files))
            {
                return(-2);
            }

            CompilerDriver driver = new CompilerDriver(programParams);
            CompileStatus  status = driver.CompileFiles();

            if (status.Success)
            {
                Console.WriteLine("Built successfully");
            }
            else
            {
                Console.WriteLine("Error building");
                Console.WriteLine(String.Join("\n",
                                              status.Errors.Select(e => String.Format("File: {0} Line:{1} Column:{2} {3}", e.ErrorSourceFile, e.ErrorLineNumber, e.ErrorPositionInLine, e.ErrorMessage))
                                              ));
            }

            Console.ReadLine();
            return(0);
        }
Exemple #2
0
        private static CommandLineParameters ParseParameters(string[] args)
        {
            CommandLineParameters programParams = new CommandLineParameters {
                Files = new List <string>(args), OutputDirectory = ".", OutputFileName = "outputFile", ExitOnFirstError = false
            };

            if (programParams.Files.Count == 0)
            {
                {
                    string testFileName = @"..\..\..\SampleCode\CoreLibrary.cleps";

                    if (File.Exists(testFileName))
                    {
                        programParams.Files.Add(testFileName);
                    }
                }
                {
                    string testFileName = @"..\..\..\SampleCode\TestProgram.cleps";

                    if (File.Exists(testFileName))
                    {
                        programParams.Files.Add(testFileName);
                    }
                }
            }

            return(programParams);
        }
Exemple #3
0
        private static CommandLineParameters ParseParameters(string[] args)
        {
            CommandLineParameters programParams = new CommandLineParameters { Files = new List<string>(args), OutputDirectory = ".", OutputFileName = "outputFile", ExitOnFirstError = false };
            if (programParams.Files.Count == 0)
            {
                {
                    string testFileName = @"..\..\..\SampleCode\CoreLibrary.cleps";

                    if (File.Exists(testFileName))
                    {
                        programParams.Files.Add(testFileName);
                    }
                }
                {
                    string testFileName = @"..\..\..\SampleCode\TestProgram.cleps";

                    if (File.Exists(testFileName))
                    {
                        programParams.Files.Add(testFileName);
                    }
                }
            }

            return programParams;
        }