Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1,
                     new ImplicitBaseClassCompilerStep(typeof(WithAction), "Execute",
                                                       //default namespaces
                                                       "Rhino.DSL.Tests.FeaturesDSL"));
     pipeline.Insert(2, new UseSymbolsStep());
 }
        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            foreach (Assembly asm in ReferencedAssemblies)
            {
                compiler.Parameters.AddAssembly(asm);
            }

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(StateMachineBuilder), "Prepare",
                                                                 ImportedNamespaces.ToArray()));
            pipeline.Insert(2, new UseSymbolsStep());
        }
Ejemplo n.º 4
0
        /// <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(_namespaces));

            pipeline.InsertAfter(typeof(MacroAndAttributeExpansion),
                                 new CorrelateTypesToModuleName(moduleNameToContainedTypes));
        }
Ejemplo n.º 5
0
 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());
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     compiler.Parameters.AddAssembly(typeof(BooCompiler).Assembly);
     compiler.Parameters.Ducky = true;
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(M), "Prepare"));
     base.CustomizeCompiler(compiler, pipeline, urls);
 }
Ejemplo n.º 8
0
 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());
 }
        public static void ReplaceOptional(this CompilerPipeline pipeline, Type optionalPipelineStepType, ICompilerStep step)
        {
            int index = pipeline.Find(optionalPipelineStepType);

            if (index >= 0)
            {
                pipeline.RemoveAt(index);
                pipeline.Insert(index - 1, step);
            }
        }
Ejemplo n.º 10
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"));
        }
Ejemplo n.º 11
0
        void SetupCompiler(CompilerPipeline pipeline)
        {
            _compiler = new BooCompiler();
            _compiler.Parameters.Input.Add(new FileInput(_file));
            _compiler.Parameters.OutputType     = CompilerOutputType.Library;
            _compiler.Parameters.OutputAssembly = _outfile;
            _compiler.Parameters.References.Add(typeof(ScriptCompiler <>).Assembly);
            _compiler.Parameters.References.Add(typeof(Mono.Cecil.AssemblyFactory).Assembly);
            _compiler.Parameters.References.Add(typeof(NUnit.Framework.Assert).Assembly);

            _compiler.Parameters.Pipeline = pipeline;
            pipeline.Insert(1, new PrepareScript <TScript> ());
            _instantiater = new InstantiateScript <TScript> ();
            pipeline.Add(_instantiater);
        }
 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());
     pipeline.ReplaceOptional(typeof(ExpandDuckTypedExpressions), new ExpandUnityDuckTypedExpressions());
     pipeline.InsertBefore(typeof(EmitAssembly), new Lint());
     pipeline.InsertBefore(typeof(EmitAssembly), new EnableRawArrayIndexing());
     pipeline.InsertAfter(typeof(BindBaseTypes), new CheckBaseTypes());
     return(pipeline);
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Customise the compiler to fit this DSL engine.
        /// This is the most commonly overriden method.
        /// </summary>
        protected virtual void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            compiler.Parameters.Ducky = true;
            compiler.Parameters.Debug = true;

            /*
             * foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
             * {
             *  try
             *  {
             *      string loc = asm.Location;
             *      if (!compiler.Parameters.References.Contains(asm)) compiler.Parameters.References.Add(asm);
             *  }
             *  catch (Exception) {  }
             * }*/

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(_actualBaseType, DSLMethodName, Namespaces.ToArray()));
        }
Ejemplo n.º 14
0
 protected override void AddCompilerSteps(BooCompiler compiler, string filename, CompilerPipeline pipeline)
 {
     compiler.Parameters.References.Add(typeof(XmlDocument).Assembly);
     pipeline.Insert(1, new AutoImportCompilerStep("System.Xml"));
 }
Ejemplo n.º 15
0
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(DemoDslBase), "Execute"));
 }
Ejemplo n.º 16
0
 protected override void AddCompilerSteps(BooCompiler compiler, string filename, CompilerPipeline pipeline)
 {
     pipeline.Insert(1, new AutoReferenceFilesCompilerStep(Path.GetDirectoryName(filename)));
 }
Ejemplo n.º 17
0
 protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
 {
     pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(BaseScheduler), "Prepare",
                                                          "Rhino.DSL.Tests.SchedulingDSL"));
 }