/// <summary> /// Perform the actual compilation of the scripts /// Things to note here: /// * The generated assembly reference the Castle.MonoRail.MonoRailBrail and Castle.MonoRail.Framework assemblies /// * If a common scripts assembly exist, it is also referenced /// * The AddBrailBaseClassStep compiler step is added - to create a class from the view's code /// * The ProcessMethodBodiesWithDuckTyping is replaced with ReplaceUknownWithParameters /// this allows to use naked parameters such as (output context.IsLocal) without using /// any special syntax /// * The FixTryGetParameterConditionalChecks is run afterward, to transform "if ?Error" to "if not ?Error isa IgnoreNull" /// * The ExpandDuckTypedExpressions is replace with a derived step that allows the use of Dynamic Proxy assemblies /// * The IntroduceGlobalNamespaces step is removed, to allow to use common variables such as /// date and list without accidently using the Boo.Lang.BuiltIn versions /// </summary> /// <param name="files"></param> /// <param name="name"></param> /// <returns></returns> private CompilationResult DoCompile(IEnumerable <ICompilerInput> files, string name) { ICompilerInput[] filesAsArray = new List <ICompilerInput>(files).ToArray(); BooCompiler compiler = SetupCompiler(filesAsArray); string filename = Path.Combine(baseSavePath, name); compiler.Parameters.OutputAssembly = filename; // this is here and not in SetupCompiler since CompileCommon is also // using SetupCompiler, and we don't want reference to the old common from the new one if (common != null) { compiler.Parameters.References.Add(common); } // pre procsssor needs to run before the parser var processor = new BrailPreProcessor(this); compiler.Parameters.Pipeline.Insert(0, processor); // inserting the add class step after the parser compiler.Parameters.Pipeline.Insert(2, new TransformToBrailStep(options)); compiler.Parameters.Pipeline.Replace(typeof(ProcessMethodBodiesWithDuckTyping), new ReplaceUknownWithParameters()); //compiler.Parameters.Pipeline.Replace(typeof(ExpandDuckTypedExpressions), // new ExpandDuckTypedExpressions_WorkaroundForDuplicateVirtualMethods()); compiler.Parameters.Pipeline.Replace(typeof(InitializeTypeSystemServices), new InitializeCustomTypeSystem()); compiler.Parameters.Pipeline.InsertBefore(typeof(ReplaceUknownWithParameters), new FixTryGetParameterConditionalChecks()); compiler.Parameters.Pipeline.RemoveAt(compiler.Parameters.Pipeline.Find(typeof(IntroduceGlobalNamespaces))); return(new CompilationResult(compiler.Run(), processor)); }
private static void UnescapeInitialAndClosingDoubleQuotes(MacroStatement macro) { var value = macro.Arguments[0] as StringLiteralExpression; if (value == null) { return; } value.Value = BrailPreProcessor.UnescapeInitialAndClosingDoubleQuotes(value.Value); }
public CompilationResult(CompilerContext context, BrailPreProcessor processor) { this.context = context; this.processor = processor; }