A ordered set of ICompilerStep implementations that should be executed in sequence.
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(BooConfigReader), "Prepare", "Horn.Core.Dsl"));
     pipeline.InsertBefore(typeof(ProcessMethodBodiesWithDuckTyping), new RightShiftToMethodCompilerStep());
     pipeline.Insert(2, new UnderscorNamingConventionsToPascalCaseCompilerStep());
     pipeline.Insert(3, new UseSymbolsStep());
 }
 protected override void AddCompilerSteps(BooCompiler compiler, string filename, CompilerPipeline pipeline)
 {
     compiler.Parameters.AddAssembly(typeof(Boo.Lang.Compiler.Ast.DepthFirstTransformer).Assembly);
     compiler.Parameters.Pipeline.Insert(1,
         new MethodSubstitutionBaseClassCompilerStep(typeof(MyMethodSubstitutionBaseClass),
             "System",
             "Boo.Lang.Compiler.Ast.DepthFirstTransformer"));
 }
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1,
                     new ImplicitBaseClassCompilerStep(typeof (BaseDaemonConfigurationDSL), "Prepare",
                                                       "Puppy.Monitoring.Daemon.DSL"));
     pipeline.InsertBefore(typeof (ProcessMethodBodiesWithDuckTyping),
                           new UnderscoreNamingConventionsToPascalCaseCompilerStep());
 }
Exemple #4
0
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, 
     string[] urls)
 {
     int step = 1;
     pipeline.Insert(step++, new ImplicitBaseClassCompilerStep(typeof (MigrationBase), "Execute", "evo.Core.DSL"));
     pipeline.Insert(step++, new AutoImportCompilerStep("System", "evo.Core", "evo.Core.DSL"));
     pipeline.Insert(step++, new UseSymbolsStep());
     pipeline.Insert(step++, new AutoReferenceFilesCompilerStep());
 }
 public static void ReplaceOptional(CompilerPipeline pipeline, Type optionalPipelineStepType, ICompilerStep step)
 {
     int num = pipeline.Find(optionalPipelineStepType);
     if (num >= 0)
     {
         pipeline.RemoveAt(num);
         pipeline.Insert(num - 1, step);
     }
 }
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            pipeline.Insert(1,
                            new ImplicitBaseClassCompilerStep(typeof (BaseOrderActionsDSL), "Prepare",
                                                               //default namespaces
                                                               "Rhino.DSL.Tests.SchedulingDSL"));
			pipeline.InsertBefore(typeof (ProcessMethodBodiesWithDuckTyping),
							 new UnderscoreNamingConventionsToPascalCaseCompilerStep());
        }
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof (PhantomBase), "Execute", typeof(UtilityFunctions).Namespace));
     pipeline.Insert(2, new ExpressionToTargetNameStep());
     pipeline.Insert(3, new ExpressionToDependencyNamesStep());
     pipeline.Insert(4, new ExpressionToCallTargetNameStep());
     pipeline.Insert(5, new UseSymbolsStep());
     pipeline.Insert(6, new AutoReferenceFilesCompilerStep());
 }
 public static CompilerPipeline AdjustPipeline(EvaluationContext context, CompilerPipeline pipeline)
 {
     pipeline.InsertAfter(typeof(IntroduceUnityGlobalNamespaces), new IntroduceScriptingNamespace(context));
     pipeline.InsertAfter(typeof(IntroduceScriptingNamespace), new IntroduceImports(context));
     pipeline.InsertAfter(typeof(ApplySemantics), new IntroduceEvaluationContext(context));
     pipeline.Replace(typeof(ProcessUnityScriptMethods), new ProcessScriptingMethods(context));
     pipeline.InsertAfter(typeof(ProcessScriptingMethods), new IntroduceReturnValue());
     return pipeline;
 }
 public CompilerContext Compile(string name, string code, CompilerPipeline pipeline = null, Action<CompilerParameters> prepare = null) {
     if(null==pipeline) pipeline = new Parse();
     var compiler = new BooCompiler();
     compiler.Parameters.Pipeline = pipeline;
     compiler.Parameters.Input.Add(new ReaderInput(name, new StringReader(code)));
     if(prepare!=null) {
         prepare(compiler.Parameters);
     }
     return compiler.Run();
 }
 protected override void CustomizeCompiler(
     BooCompiler compiler,
     CompilerPipeline pipeline,
     string[] urls)
 {
     pipeline.Insert(1,
         new ImplicitBaseClassCompilerStep(
             typeof(ResponseStrategy),
             "ExecuteRule",
             "System.Net.Mail"));
 }
 protected override void CustomizeCompiler(
   BooCompiler compiler,
   CompilerPipeline pipeline,
   string[] urls)
 {
   pipeline.Insert(1,
                   new ImplicitBaseClassCompilerStep(
                     typeof(QuoteGeneratorRule),
                     "Evaluate",
                     "BooDslExampleApp.QuoteGeneration"));
   pipeline.Insert(2, new UseSymbolsStep());
 }
        /// <summary>
        /// Customise the compiler to fit the etl engine
        /// </summary>
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            compiler.Parameters.References.Add(typeof(EtlDslEngine).Assembly);
            compiler.Parameters.References.Add(typeof(EtlProcess).Assembly);
            pipeline.Insert(1, new AutoReferenceFilesCompilerStep());
            pipeline.Insert(2, new UseModuleNameAsNamespaceIfMissing());
            pipeline.Insert(3, new AutoImportCompilerStep(
                "Rhino.Etl.Core",
                "Rhino.Etl.Dsl",
                "Rhino.Etl.Dsl.Macros"));

            pipeline.InsertAfter(typeof(MacroAndAttributeExpansion), new CorrelateTypesToModuleName(moduleNameToContainedTypes));
        }
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     // save to disk
     pipeline = new CompileToFile();
     compiler.Parameters.Pipeline = pipeline;
     //compiler.Parameters.Ducky = true;
     pipeline.Insert(1,
                     new AnonymousBaseClassCompilerStep(typeof (DeclerativeDslBase),
                                                        "Prepare", // method to override  
                                                        "DSL.Demo.Model",
                                                        "DSL.Demo.Declerative")); // namespace to add
     pipeline.Insert(2, new CaptureCompilerContextStep());
 }
Exemple #14
0
		public void EventSequence()
		{
			var calls = new List<string>();
			var pipeline = new CompilerPipeline();
			pipeline.Before += delegate { calls.Add("before"); };
			pipeline.BeforeStep += delegate { calls.Add("before step"); };
			pipeline.Add(new ActionStep(() => calls.Add("step")));
			pipeline.AfterStep += delegate { calls.Add("after step"); };
			pipeline.After += delegate { calls.Add("after"); };
			pipeline.Run(new CompilerContext());
			Assert.AreEqual(
				new string[] {"before", "before step", "step", "after step", "after"},
				calls.ToArray());
		}
        public static CompilerPipeline Extend(CompilerPipeline pipeline) {
            if(pipeline.Find(typeof(ExtensionsPreprocessorCompilerStep))==-1) {
#if !LIB2
                if (pipeline.Find(typeof (BooParsingStep)) != -1) {
                    pipeline.InsertAfter(typeof (BooParsingStep), new ExtensionsPreprocessorCompilerStep());
                }
#else
                if (pipeline.Find(typeof(Parsing)) != -1)
                {
                    pipeline.InsertAfter(typeof(Parsing), new ExtensionsPreprocessorCompilerStep());
                }
#endif
            }
            return pipeline;
        }
 public static CompilerPipeline AdjustBooPipeline(CompilerPipeline pipeline)
 {
     pipeline.Insert(0, new PreProcess());
     pipeline.Replace(typeof(Parsing), new UnityScript.Steps.Parse());
     pipeline.Replace(typeof(IntroduceGlobalNamespaces), new IntroduceUnityGlobalNamespaces());
     pipeline.InsertAfter(typeof(PreErrorChecking), new ApplySemantics());
     pipeline.InsertAfter(typeof(ApplySemantics), new ApplyDefaultVisibility());
     pipeline.InsertBefore(typeof(ExpandDuckTypedExpressions), new ProcessAssignmentToDuckMembers());
     pipeline.Replace(typeof(ProcessMethodBodiesWithDuckTyping), new ProcessUnityScriptMethods());
     pipeline.InsertAfter(typeof(ProcessUnityScriptMethods), new AutoExplodeVarArgsInvocations());
     pipeline.InsertAfter(typeof(ProcessUnityScriptMethods), new ProcessEvalInvocations());
     UnityScriptCompilerModule.ReplaceOptional(pipeline, typeof(ExpandDuckTypedExpressions), new ExpandUnityDuckTypedExpressions());
     pipeline.InsertBefore(typeof(EmitAssembly), new Lint());
     pipeline.InsertBefore(typeof(EmitAssembly), new EnableRawArrayIndexing());
     pipeline.InsertAfter(typeof(BindBaseTypes), new CheckBaseTypes());
     return pipeline;
 }
 public Assembly Compile(ExtensionsFileSystemProvider provider) {
     var compiler = new BooCompiler();
     var pipeline = Pipeline ??( Pipeline = new CompileToFile());
     ExtensionsPreprocessorCompilerStep.Extend(pipeline);
     compiler.Parameters.Pipeline = pipeline;
     var files = provider.GetFileNames();
     if(files.Length==0) {
         WriteLog("no input files provided");
     }
     foreach (var fileName in files) {
         WriteLog("input added: " + fileName);
         compiler.Parameters.Input.Add(new FileInput(fileName));
     }
     compiler.Parameters.References.Add(typeof (IRegistryLoader).Assembly); //need to use Comdiv.Core
     compiler.Parameters.References.Add(typeof (IDictionary<string, object>).Assembly); //need to use System
     WriteLog("compiler created");
     //loading other dlls:
     foreach (var referencedAssembly in provider.GetReferencedAssemblies()) {
         WriteLog("add assembly " + referencedAssembly.GetName().Name);
         compiler.Parameters.References.Add(referencedAssembly);
     }
     compiler.Parameters.OutputAssembly = provider.GetLibraryPath();
     WriteLog("output is setted : " + provider.GetLibraryPath());
     WriteLog("start compiler");
     var result = compiler.Run();
     LastCompiledContext = result;
     if (result.Errors.Count != 0) {
         WriteLog("error occured!");
         WriteLog(result.Errors.ToString());
         ConsoleLogHost.Current.logerror(result.Errors.ToString());
         throw new CompilerErrorException(result);
     }
     //if (result.Warnings.Count != 0)
     //{
     //    WriteLog("warrnings!");
     //    WriteLog(result.Warnings.ToString());
     //}
     WriteLog("compilation successfull");
     if(Pipeline is CompileToMemory) {
         return result.GeneratedAssembly;
     }else {
         return provider.LoadAssembly();
     }
 }
Exemple #18
0
		public void CurrentStep()
		{
			var pipeline = new CompilerPipeline();

			var step1 = new ActionStep(delegate {});
			pipeline.Add(step1);

			ActionStep step2 = null;
			step2 = new ActionStep(() => Assert.AreSame(step2, pipeline.CurrentStep));
			pipeline.Add(step2);

			var currentSteps = new Boo.Lang.List();
			pipeline.Before += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.BeforeStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.AfterStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.After += (sender, args) => currentSteps.Add(pipeline.CurrentStep);

			pipeline.Run(new CompilerContext());

			Assert.AreEqual(
				new object[] { null, step1, step1, step2, step2, null },
				currentSteps.ToArray());
		}
Exemple #19
0
		public CompilerParameters(IReflectionTypeSystemProvider reflectionProvider, bool loadDefaultReferences)
		{
			_libPaths = new List<string>();
			_systemDir = Permissions.WithDiscoveryPermission(() => GetSystemDir());
			if (_systemDir != null)
			{
				_libPaths.Add(_systemDir);
				_libPaths.Add(Directory.GetCurrentDirectory());
			}
			_pipeline = null;
			_input = new CompilerInputCollection();
			_resources = new CompilerResourceCollection();
			_compilerReferences = new CompilerReferenceCollection(reflectionProvider);

			_maxExpansionIterations = 12;
			_outputAssembly = String.Empty;
			_outputType = CompilerOutputType.Auto;
			_outputWriter = Console.Out;
			_debug = true;
			_checked = true;
			_generateInMemory = true;
			_stdLib = true;
			_delaySign = false;

			Strict = false;
			TraceLevel = TraceLevel.Off;

			if (loadDefaultReferences)
				LoadDefaultReferences();
		}
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof (BaseScheduler), "Prepare",
                                                           "Rhino.DSL.Tests.SchedulingDSL"));
 }
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            var steps = new List<ICompilerStep>();

            steps.Add(new IncludeSupportStep(new PhantomDslEngine(importBuilders) {InIncludeMode = true}));
            if (!InIncludeMode) {
                steps.Add(new UnescapeNamesStep());
                steps.Add(new ExpressionToTargetNameStep());
                steps.Add(new ExpressionToDependencyNamesStep());
                steps.Add(new ExpressionToCleanupNameStep());
                steps.Add(new ExpressionToCallTargetNameStep());
                steps.Add(new AutoReferenceFilesCompilerStep());
                steps.Add(new TaskImportStep(importBuilders.ToArray()));

                steps.Add(new ImplicitBaseClassCompilerStep(typeof (PhantomBase), "Execute", typeof (UtilityFunctions).Namespace));
            }

            steps.Reverse();
            foreach (var step in steps) {
                pipeline.Insert(1, step);
            }

            if (!InIncludeMode)
                pipeline.InsertBefore(typeof (ProcessMethodBodiesWithDuckTyping), new AutoRunAllRunnablesStep());

            compiler.Parameters.References.Add(typeof(UtilityFunctions).Assembly);
        }
Exemple #22
0
 public void SetUp()
 {
     _pipeline = new CompilerPipeline();
 }
 public static CompilerPipeline RawParsing()
 {
     CompilerPipeline pipeline;
     CompilerPipeline pipeline1 = pipeline = new CompilerPipeline();
     pipeline.Add(new PreProcess());
     pipeline.Add(new UnityScript.Steps.Parse());
     return pipeline;
 }
 void ViewFactory_PreparePipeline(CompilerPipeline obj) {
     obj.Replace(typeof (TransformToBrailStep),new MONORAILTransformToBrailStep(this.Options));
 }
Exemple #25
0
		public void ExecutionOrder()
		{
			var order = new List<string>();
			var p1 = new ActionStep(() => order.Add("p1"));
			var p2 = new ActionStep(() => order.Add("p2"));

			var pipeline = new CompilerPipeline { p1, p2 };
			pipeline.Run(new CompilerContext());

			Assert.AreEqual(new[] { "p1", "p2" }, order.ToArray());
		}
 protected override void AddCompilerSteps(BooCompiler compiler, string filename, CompilerPipeline pipeline)
 {
     compiler.Parameters.Pipeline.Insert(1,
         new ImplicitBaseClassCompilerStep(typeof (MyAnonymousBaseClass), "Run"));
 }
 protected override void AddCompilerSteps(BooCompiler compiler, string filename, CompilerPipeline pipeline)
 {
     pipeline.Insert(1, new AutoReferenceFilesCompilerStep(Path.GetDirectoryName(filename)));
 }
 protected override void AddCompilerSteps(BooCompiler compiler, string filename, CompilerPipeline pipeline)
 {
     compiler.Parameters.References.Add(typeof(XmlDocument).Assembly);
     pipeline.Insert(1, new AutoImportCompilerStep("System.Xml"));
 }
Exemple #29
0
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            ParameterDeclarationCollection parameters = new ParameterDeclarationCollection();
            ParameterDeclaration newParameterDeclaration =
                new ParameterDeclaration("input", new SimpleTypeReference("System.String"));
            parameters.Add(newParameterDeclaration);

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(MyClassWithParams),
                "Hello",
                parameters,
                "System"));
        }
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     compiler.Parameters.Ducky = true;
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(Service), "ConfigureService", "DslConfig", "System"));
 }