예제 #1
0
        public static ThemaCompilerContext Compile(string code, Action <ThemaProject> prepareProject = null)
        {
            var project = new ThemaProject {
                ErrorLevel = ErrorLevel.Error, UseEcoOptimization = true, UseEcoProcess = true
            };

            project.SetSelfLog(LogLevel.Debug);
            project.NonResolvedProcessThemaRefIsError = true;
            project.CustomCompiler           = new ApplyEcoProcesses();
            project.DirectSource["main.bxl"] = code;
            if (null != prepareProject)
            {
                prepareProject(project);
            }
            var compiler = new ThemaCompiler();

            var context = compiler.Compile(project);

            Console.WriteLine(project.GetLog());
            foreach (var e in context.Errors)
            {
                Console.WriteLine(e);
            }
            return(context);
        }
		private ThemaCompilerContext exec(params string[] clusters) {
			var proj = new ThemaProject();
			proj.DirectSource["main.bxl"] = code;
			proj.SetSelfLog();
			proj.CustomCompiler = new GenerateXml();
			if (null != clusters) {
				foreach (var cluster in clusters) {
					proj.Clusters.Add(cluster);
				}
			}
			var result = new ThemaCompiler().Compile(proj);
			foreach (var t in result.Themas) {
				Console.WriteLine(t.Value.Xml);
			}
			return result;
		}
예제 #3
0
		public static ThemaCompilerContext Compile(string code, Action<ThemaProject> prepareProject = null) {
			var project = new ThemaProject {ErrorLevel = ErrorLevel.Error, UseEcoOptimization = true, UseEcoProcess = true};
			project.SetSelfLog(LogLevel.Debug);
			project.NonResolvedProcessThemaRefIsError = true;
			project.CustomCompiler = new ApplyEcoProcesses();
			project.DirectSource["main.bxl"] = code;
			if (null != prepareProject) {
				prepareProject(project);
			}
			var compiler = new ThemaCompiler();

			var context = compiler.Compile(project);
			Console.WriteLine(project.GetLog());
			foreach (var e in context.Errors) {
				Console.WriteLine(e);
			}
			return context;
		}
        private ThemaCompilerContext exec(params string[] clusters)
        {
            var proj = new ThemaProject();

            proj.DirectSource["main.bxl"] = code;
            proj.SetSelfLog();
            proj.CustomCompiler = new GenerateXml();
            if (null != clusters)
            {
                foreach (var cluster in clusters)
                {
                    proj.Clusters.Add(cluster);
                }
            }
            var result = new ThemaCompiler().Compile(proj);

            foreach (var t in result.Themas)
            {
                Console.WriteLine(t.Value.Xml);
            }
            return(result);
        }