Exemple #1
0
        public CompileStatus CompileFiles()
        {
            ClassManager classManager = new ClassManager();
            CompileStatus status = new CompileStatus(Args.ExitOnFirstError);
            ICodeGenerator codeGenerator = new JavaScriptCodeGenerator();
            TypeManager typeManager = new TypeManager();
            EntryPointManager entryPointManager = new EntryPointManager(status, Args.EntryPointClass);

            try
            {
                codeGenerator.Initiate();

                {
                    ClepsClassNamesCollectorVisitor classSkeletonGenerator = new ClepsClassNamesCollectorVisitor(status, classManager, codeGenerator);
                    ParseFilesWithGenerator(classSkeletonGenerator, status);
                }
                {
                    ClepsMemberGeneratorVisitor memberGenerator = new ClepsMemberGeneratorVisitor(status, classManager, codeGenerator, entryPointManager);
                    ParseFilesWithGenerator(memberGenerator, status);
                }
                {
                    ClepsFunctionBodyGeneratorVisitor functionBodyGenerator = new ClepsFunctionBodyGeneratorVisitor(status, classManager, codeGenerator, typeManager);
                    ParseFilesWithGenerator(functionBodyGenerator, status);
                }

                string entryClassName = entryPointManager.GetChosenEntryPointOrNull();

                if (!String.IsNullOrWhiteSpace(entryClassName))
                {
                    codeGenerator.AddEntryPoint(entryClassName, EntryPointManager.EntryPointName);
                }

                codeGenerator.Output(Args.OutputDirectory, Args.OutputFileName, status);
            }
            catch (CompilerLogException)
            {
                //Supress compiler errors
            }
            finally
            {
                codeGenerator.Close();
            }

            return status;
        }
Exemple #2
0
        public CompileStatus CompileFiles()
        {
            ClassManager classManager = new ClassManager();
            CompileStatus status = new CompileStatus(Args.ExitOnFirstError);
            ICodeGenerator codeGenerator = new JavaScriptCodeGenerator();
            TypeManager typeManager = new TypeManager();
            FunctionOverloadManager functionOverloadManager = new FunctionOverloadManager();

            try
            {
                codeGenerator.Initiate();

                {
                    ClepsClassNamesCollectorVisitor classSkeletonGenerator = new ClepsClassNamesCollectorVisitor(status, classManager, codeGenerator);
                    ParseFilesWithGenerator(classSkeletonGenerator, status);
                }
                {
                    ClepsMemberGeneratorVisitor memberGenerator = new ClepsMemberGeneratorVisitor(status, classManager, codeGenerator);
                    ParseFilesWithGenerator(memberGenerator, status);
                }
                //{
                //    ClepsCodeAnalysisGeneratorParser codeAnalysisGenerator = new ClepsCodeAnalysisGeneratorParser(status, classManager, codeGenerator);
                //    ParseFilesWithGenerator(codeAnalysisGenerator, status);
                //}
                {
                    ClepsFunctionBodyGeneratorVisitor functionBodyGenerator = new ClepsFunctionBodyGeneratorVisitor(status, classManager, codeGenerator, typeManager, functionOverloadManager);
                    ParseFilesWithGenerator(functionBodyGenerator, status);
                }
                codeGenerator.Output(Args.OutputDirectory, Args.OutputFileName, status);
            }
            catch (CompilerErrorException)
            {
                //Supress compiler errors
            }
            finally
            {
                codeGenerator.Close();
            }

            return status;
        }