Пример #1
0
        public ExportProgressForm(ICompilable helpFile, int expectedLines)
        {
            InitializeComponent();

            this.helpFile      = helpFile;
            this.expectedLines = expectedLines;
        }
Пример #2
0
        private void DoCellClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewCell cell = errors[2, e.RowIndex];

            if (cell.Tag != null && cell.Tag is CompilerError)
            {
                CompilerError err = (CompilerError)cell.Tag;
                if (err.Line >= 0)
                {
                    SetCaret(err.Line, err.Column);
                }
                else
                {
                    cell = errors[0, e.RowIndex];
                    if (cell.Tag != null && cell.Tag is ICompilable)
                    {
                        ICompilable ic = (ICompilable)cell.Tag;
                        if (ic.FirstSourceLine + err.Line <= 0)
                        {
                            CompilerOptionsForm.MarkErrors(ic, err);
                        }
                    }
                }
            }
        }
Пример #3
0
        public ExportProgressForm(ICompilable helpFile, int expectedLines)
        {
            InitializeComponent();

            this.helpFile = helpFile;
            this.expectedLines = expectedLines;
        }
Пример #4
0
        public string Compile(ISomContext somContext)
        {
            string content = somContext.Content;

            for (int i = 12; i > 0; i -= 4)
            {
                var parsed = new SomDocParser(i).Parse(somContext);
                foreach (var pr in parsed)
                {
                    Type typ = Type.GetType($"{pr.CommandType.FullName}, SOM");
                    CompilableCtorMeta ccm  = GetCompilableCtorMeta(pr.CommandType);
                    ConstructorInfo    ctor = GetConstructorInfo(typ);

                    var parseItem = pr.Parsed;
                    var oparms    = pr.Parms(ctor.GetParameters());

                    somContext.Logger.Information("SomTagInterpreter: Indent{i} {o} {p}", i, pr.CommandType.FullName, string.Join(", ", oparms.ToArray()));

                    ICompilable obj = (ICompilable)Activator.CreateInstance(typ, oparms.ToArray());
                    somContext.Content = parseItem;
                    parseItem          = obj.Compile(somContext);
                    parseItem          = RemoveTags(parseItem);
                    content            = content.Replace(pr.Parsed, parseItem);
                    somContext.Content = content;
                    if (pr.Options.Verbose)
                    {
                        somContext.Cache.Write(content);
                    }
                }
            }
            return(somContext.Content);
        }
Пример #5
0
        public virtual CompiledScript Compile(IScriptEngine scriptEngine, string language, string src)
        {
            if (scriptEngine is ICompilable && !scriptEngine.GetFactory().LanguageName.Equals("ecmascript", StringComparison.OrdinalIgnoreCase) /*.EqualsIgnoreCase("ecmascript")*/)
            {
                ICompilable compilingEngine = (ICompilable)scriptEngine;

                try
                {
                    CompiledScript compiledScript = compilingEngine.Compile(src);

                    log.DebugCompiledScriptUsing(language);

                    return(compiledScript);
                }
                catch (ScriptException e)
                {
                    throw new ScriptCompilationException("Unable to compile script: " + e.Message, e);
                }
            }
            else
            {
                // engine does not support compilation
                return(null);
            }
        }
Пример #6
0
 public static void Compile(Software software)
 {
     if (software is IEngineeringServiceProvider engineeringServiceProvider)
     {
         ICompilable compilable = engineeringServiceProvider.GetService <ICompilable>();
         compilable?.Compile();
     }
 }
Пример #7
0
        public static string CompileHmiTarget(HmiTarget hmiTarget)
        {
            string         message    = null;
            ICompilable    compileHMI = hmiTarget.GetService <ICompilable>();
            CompilerResult result     = compileHMI.Compile();

            message = WriteCompilerResults(result);
            return(message);
        }
Пример #8
0
        public static string CompilePlcSoftware(PlcSoftware plcSoftware)
        {
            string         message    = null;
            ICompilable    compilePLC = plcSoftware.GetService <ICompilable>();
            CompilerResult result     = compilePLC.Compile();

            message = WriteCompilerResults(result);
            return(message);
        }
Пример #9
0
 /// <summary>
 /// Gets parts ready to compile
 /// </summary>
 /// <param name="data">Data</param>
 /// <param name="last">Last part with data given</param>
 void FinishBlock(ref List <Token> data, ICompilable last)
 {
     if (last == null)
     {
         return;
     }
     last.AddData(data);
     data = new List <Token>();
     com.Add(last);
 }
Пример #10
0
        public void MarkErrors(ICompilable item, bool sourceHeader)
        {
            RemoveMarks();
            MarkerStrategy markers  = editor.Document.MarkerStrategy;
            string         filename = Compiler.SourceFile(item).ToLower();

            errors.Rows.Clear();

            foreach (CompilerError err in Errors(item, sourceHeader))
            {
                if (filename == err.FileName.ToLower())
                {
                    TextMarker marker = ErrMarker(err);
                    if (marker != null)
                    {
                        markers.AddMarker(marker);
                    }

                    // update data grid
                    DataGridViewRow row = new DataGridViewRow();

                    DataGridViewImageCell img = new DataGridViewImageCell();
                    if (err.IsWarning)
                    {
                        img.Value = Properties.Resources.warningimg;
                    }
                    else
                    {
                        img.Value = Properties.Resources.errorimg;
                    }
                    img.Tag = item;
                    row.Cells.Add(img);

                    DataGridViewTextBoxCell pos = new DataGridViewTextBoxCell();
                    pos.Value = err.Line.ToString() + ":" + err.Column.ToString();
                    row.Cells.Add(pos);

                    DataGridViewTextBoxCell text = new DataGridViewTextBoxCell();
                    text.Value          = CompilerErrors.Message(err);
                    text.Style.WrapMode = DataGridViewTriState.True;
                    text.Tag            = err;
                    row.Cells.Add(text);

                    errors.Rows.Add(row);
                    row.Resizable = DataGridViewTriState.False;
                }
            }

            errors.AutoResizeRows();
            if (item.CompilerResults.Errors.Count > 0)
            {
                ShowErrors();
            }
            editor.Refresh();
        }
Пример #11
0
 public static int ErrorLine(ICompilable item, bool sourceHeader, int line)
 {
     if (line < 0)
     {
         if (sourceHeader)
         {
             return(Compiler.Options.Header.Lines + item.FirstSourceLine + line);
         }
     }
     return(line);
 }
Пример #12
0
        public static string CompileCodeBlock(PlcSoftware plcSoftware)
        {
            string    message = null;
            CodeBlock block   = plcSoftware.BlockGroup.Blocks.Find("MyCodeBlock") as CodeBlock;

            if (block != null)
            {
                ICompilable    compileService = block.GetService <ICompilable>();
                CompilerResult result         = compileService.Compile();
                message = WriteCompilerResults(result);
            }
            return(message);
        }
Пример #13
0
        private void Compile(object sender, EventArgs e)
        {
            btn_CompileHW.Enabled = false;

            string devname = txt_Device.Text;
            bool   found   = false;

            foreach (Device device in MyProject.Devices)
            {
                DeviceItemComposition deviceItemAggregation = device.DeviceItems;
                foreach (DeviceItem deviceItem in deviceItemAggregation)
                {
                    if (deviceItem.Name == devname || device.Name == devname)
                    {
                        SoftwareContainer softwareContainer = deviceItem.GetService <SoftwareContainer>();
                        if (softwareContainer != null)
                        {
                            if (softwareContainer.Software is PlcSoftware)
                            {
                                PlcSoftware controllerTarget = softwareContainer.Software as PlcSoftware;
                                if (controllerTarget != null)
                                {
                                    found = true;
                                    ICompilable compiler = controllerTarget.GetService <ICompilable>();

                                    CompilerResult result = compiler.Compile();
                                    txt_Status.Text = "Compiling of " + controllerTarget.Name + ": State: " + result.State + " / Warning Count: " + result.WarningCount + " / Error Count: " + result.ErrorCount;
                                }
                            }
                            if (softwareContainer.Software is HmiTarget)
                            {
                                HmiTarget hmitarget = softwareContainer.Software as HmiTarget;
                                if (hmitarget != null)
                                {
                                    found = true;
                                    ICompilable    compiler = hmitarget.GetService <ICompilable>();
                                    CompilerResult result   = compiler.Compile();
                                    txt_Status.Text = "Compiling of " + hmitarget.Name + ": State: " + result.State + " / Warning Count: " + result.WarningCount + " / Error Count: " + result.ErrorCount;
                                }
                            }
                        }
                    }
                }
            }
            if (found == false)
            {
                txt_Status.Text = "Found no device with name " + txt_Device.Text;
            }

            btn_CompileHW.Enabled = true;
        }
Пример #14
0
 public static void MarkErrors(ICompilable item, CompilerError err)
 {
     ShowForm();
     if (Form != null && !Form.IsDisposed)
     {
         Form.sourceHeader.MarkErrors(item, true);
         int line = err.Line;
         if (line < 0)
         {
             line = CodeControl.ErrorLine(item, true, line);
         }
         Form.sourceHeader.SetCaret(line, err.Column);
     }
 }
Пример #15
0
        public void Process(ISomContext somContext)
        {
            string configPath = config.GetSection("AppSettings:CompileConfig").Value ?? "~";
            string basePath   = config.GetSection("AppSettings:BasePath").Value;
            string configFile = somContext.Options.Path;

            if (!string.IsNullOrEmpty(configFile.ToString()))
            {
                configPath = configPath.Replace("~", basePath);
                if (!configFile.Contains(":"))
                {
                    configFile = $"{configPath}{configFile}";
                }
                configFile = configFile.Replace(@"\\", @"\");
                configFile = (configFile.Contains(".yaml")) ? configFile : $"{configFile}.yaml";
            }
            logger.Information("{o}", configFile);

            string raw   = File.ReadAllText(configFile);
            var    deser = new DeserializerBuilder().WithNamingConvention(PascalCaseNamingConvention.Instance).Build();
            var    def   = deser.Deserialize <CompileDefinition>(raw);

            def.ContentCompilers.ForEach(c =>
            {
                var typ         = AssmTypes().Where(t => t.Name == c.CompilerType && typeof(ICompilable).IsAssignableFrom(t)).FirstOrDefault();
                ICompilable obj = (ICompilable)Activator.CreateInstance(typ, c.Args.ToArray());
                compiler.ContentCompilers.Add(obj);
            });
            def.FilenameCompilers.ForEach(c =>
            {
                var typ         = AssmTypes().Where(t => t.Name == c.CompilerType && typeof(ICompilable).IsAssignableFrom(t)).FirstOrDefault();
                ICompilable obj = (ICompilable)Activator.CreateInstance(typ, c.Args.ToArray());
                compiler.FilenameCompilers.Add(obj);
            });
            def.Compilations.ForEach(c =>
            {
                compiler.FileFilter = c.FileFilter;
                compiler.Source     = (c.Source ?? "~").Replace("~", somContext.BasePath);
                compiler.Dest       = (c.Dest ?? "~").Replace("~", somContext.BasePath);
                compiler.Compile();
            });
            if (somContext.Options.Mode != SomMode.Commit)
            {
                somContext.Cache.Inspect();
            }
        }
Пример #16
0
        private void CompileProject()
        {
            if (software != null)
            {
                ICompilable    compileService = software.GetService <ICompilable>();
                CompilerResult result         = compileService.Compile();

                this.BringToFront();
                Application.DoEvents();

                // result messages is array
                MessageOK("Result : " + result.State.ToString() + "\n" +
                          "Errors: " + result.ErrorCount.ToString() + "\n" +
                          "Warnings: " + result.WarningCount.ToString() + "\n",
                          "Compiler");

                IterateThroughDevices(project);
            }
        }
Пример #17
0
 protected override void DoWork()
 {
     lock (portal)
     {
         try
         {
             ICompilable    compileService = plc.GetService <ICompilable>();
             CompilerResult res            = compileService.Compile();
             if (res.State != CompilerResultState.Success)
             {
                 LogCompilerMessages(res.Messages);
             }
         }
         catch (Exception ex)
         {
             LogMessage(MessageLog.Severity.Error, "Failed to compile:\n" + ex.Message);
             return;
         }
     }
 }
Пример #18
0
        protected internal virtual object EvaluateScriptExpression(string expressionLanguage,
                                                                   IVariableContext variableContext, string expressionText,
                                                                   ICachedCompiledScriptSupport cachedCompiledScriptSupport)
        {
            IScriptEngine scriptEngine = GetScriptEngineForName(expressionLanguage);
            // wrap script engine bindings + variable context and pass enhanced
            // bindings to the script engine.
            IBindings bindings = VariableContextScriptBindings.Wrap(scriptEngine.CreateBindings(), variableContext);

            bindings.Put("variableContext", variableContext);

            try
            {
                if (scriptEngine is ICompilable)
                {
                    CompiledScript compiledScript = cachedCompiledScriptSupport.GetCachedCompiledScript();
                    if (compiledScript == null)
                    {
                        lock (cachedCompiledScriptSupport)
                        {
                            compiledScript = cachedCompiledScriptSupport.GetCachedCompiledScript();

                            if (compiledScript == null)
                            {
                                ICompilable compilableScriptEngine = (ICompilable)scriptEngine;
                                compiledScript = compilableScriptEngine.Compile(expressionText);

                                cachedCompiledScriptSupport.CacheCompiledScript(compiledScript);
                            }
                        }
                    }

                    return(compiledScript.Eval(bindings));
                }
                return(scriptEngine.Eval(expressionText, bindings));
            }
            catch (ScriptException e)
            {
                throw Log.unableToEvaluateExpression(expressionText, scriptEngine.GetFactory().LanguageName, e);
            }
        }
Пример #19
0
        /// <summary>
        /// Splits data between parts
        /// </summary>
        /// <param name="cur">Data</param>
        public void AddData(List <Token> cur)
        {
            List <Token> data = new List <Token>();
            ICompilable  last = null;

            foreach (var x in cur)
            {
                switch (x.t)
                {
                case TType.ou:
                    FinishBlock(ref data, last);
                    last = new OutInit();
                    break;

                case TType.init:
                    FinishBlock(ref data, last);
                    last = new Init();
                    break;

                case TType.Beg:
                    FinishBlock(ref data, last);
                    last = new Body();
                    break;

                case TType.End:
                    FinishBlock(ref data, last);
                    break;

                default:
                    data.Add(x);
                    break;
                }
            }
            var v = new After();

            v.AddData(data);
            com.Add(v);
        }
Пример #20
0
        // Compile plc programs
        private void BtnCompile_Click(object sender, EventArgs e)
        {
            // Determine if there are any devices checked.
            if (devicesCheckList.CheckedItems.Count != 0)
            {
                statusBox.AppendText("Systems selected: " + devicesCheckList.CheckedItems.Count);
                statusBox.AppendText(Environment.NewLine);

                // If so loop through all devices checking if they have been selected
                foreach (var device in MyProject.Devices)
                {
                    if (devicesCheckList.CheckedItems.Contains(device.Name))
                    {
                        statusBox.AppendText("Compiling system " + device.Name);
                        statusBox.AppendText(Environment.NewLine);

                        foreach (var deviceItem in device.DeviceItems)
                        {
                            PlcSoftware software = BlockManagement.GetSoftwareFrom(deviceItem);
                            if (software != null)
                            {
                                ICompilable    compileService = software.GetService <ICompilable>();
                                CompilerResult result         = compileService.Compile();

                                statusBox.AppendText(
                                    result.State + ": Compiling finished for system " +
                                    device.Name + ", " +
                                    result.WarningCount + " warnings and " +
                                    result.ErrorCount + " errors"
                                    );
                                statusBox.AppendText(Environment.NewLine);
                            }
                        }
                    }
                }
            }
        }
Пример #21
0
        private CompilerErrorCollection Errors(ICompilable item, bool sourceHeader)
        {
            CompilerErrorCollection err = new CompilerErrorCollection();

            foreach (CompilerError e in item.CompilerResults.Errors)               // deep copy error collection
            {
                err.Add(new CompilerError(e.FileName, e.Line, e.Column, e.ErrorNumber, e.ErrorText));
            }
            for (int i = 0; i < err.Count; i++)               // adapt errors according to sourceHeader
            {
                if (err[i].Line < 0)
                {
                    if (sourceHeader)
                    {
                        err[i].Line = ErrorLine(item, sourceHeader, err[i].Line);
                    }
                }
                else if (sourceHeader)
                {
                    err.RemoveAt(i--);                                      // don't mark ordinary errors in SourceHeader.
                }
            }
            return(err);
        }
Пример #22
0
        public static bool Draw(ILoadable loadable, IUndoable undoable, ICopyable copyable, ICompilable compilable)
        {
            try
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("File", EditorStyles.toolbarButton, GUILayout.Width(35)))
                {
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(new GUIContent("New: Ctrl+Alt+N "), false, OnNew, loadable);
                    menu.AddItem(new GUIContent("Load: Ctrl+Alt+L"), false, OnLoad, loadable);
                    menu.AddItem(new GUIContent("Save: Ctrl+Alt+S"), false, OnSave, loadable);
                    menu.AddItem(new GUIContent("Export as constellation file"), false, OnExportAsCL, loadable);
                    menu.ShowAsContext();
                    return(true);
                }

                if (GUILayout.Button("Edit", EditorStyles.toolbarButton, GUILayout.Width(35)))
                {
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(new GUIContent("Undo: Ctrl+Alt+Z"), false, OnUndo, undoable);
                    menu.AddItem(new GUIContent("Redo: Ctrl+Alt+Y"), false, OnRedo, undoable);
                    menu.AddItem(new GUIContent("Copy: Ctrl+Alt+C"), false, Copy, copyable);
                    menu.AddItem(new GUIContent("Past: Ctrl+Alt+V"), false, Paste, copyable);
                    menu.ShowAsContext();
                    return(true);
                }

                if (GUILayout.Button("Refresh", EditorStyles.toolbarButton, GUILayout.Width(70)))
                {
                    compilable.ParseScript();
                    return(true);
                }

                GUILayout.Label("", EditorStyles.toolbarButton);
                EditorGUILayout.EndHorizontal();
            }catch
            {
            }
            return(false);
        }
Пример #23
0
 public void MarkErrors(ICompilable item)
 {
     MarkErrors(item, false);
 }
        /*** Given in input a C# code program-string, compile it producing the assembly in "compilationBlock" global variable ***/
        private bool compileCSharpCode(string cSharpCode)
        {
            CSharpCodeProvider codeProvider = new CSharpCodeProvider();
            CompilerParameters parameters = new CompilerParameters();
            parameters.GenerateInMemory = true;
            parameters.GenerateExecutable = false;

            // refers .dll that contain the definition of the interface "ICompilable"
            parameters.ReferencedAssemblies.Add("ICompilableProject.dll");

            // run compiler producing assembly
            CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, cSharpCode);

            // check compilation errors
            if (!results.Errors.HasErrors)
            {
                this.compilationBlock = results.CompiledAssembly;
                foreach (Type type in compilationBlock.GetTypes())
                {

                    if (!type.IsClass || type.IsNotPublic)
                        continue;

                    // getting interfaces
                    Type[] interfaces = type.GetInterfaces();

                    if (((IList)interfaces).Contains(typeof(ICompilable)))
                    {
                        object obj = Activator.CreateInstance(type);
                        compilationResult = (ICompilable)obj;
                    }
                }
            }
            else
            {
                // if has errors, enumerate its
                string allErrors = "";
                for (int i = 0; i < results.Errors.Count; i++)
                {
                    allErrors += results.Errors[i] + "\n";
                }

                throw new CompilationException(allErrors);
            }

            return this.compilationBlock != null;
        }
Пример #25
0
 public void Reset(ICompilable item)
 {
     text.Text = CompilerErrors.ToString(item.CompilerResults.Errors);
     text.Select(0, 0);
 }
Пример #26
0
 public ErrorsForm(ICompilable item) : this()
 {
     Reset(item);
 }
Пример #27
0
        /// <summary>
        /// Compile a class from source code
        /// </summary>
        /// <param name="automata">A Deterministic automata to convert into an automata class</param>
        /// <returns>true if compile success</returns>
        /// <exception cref="ShallowCompiler.CompilerError">Compiler errors occurs</exception>
        public string CompileCode(DAutomata automata)
        {
            // C# compiler helper class
            CSharpCodeProvider codeProvider = new CSharpCodeProvider();

            // Compiler parameters
            CompilerParameters parameters = new CompilerParameters();

            // generate in memory compilation (not an EXE/DLL file)
            parameters.GenerateInMemory = true;
            parameters.GenerateExecutable = false;

            // Add all the DLL reference to perform the compilation
            parameters.ReferencedAssemblies.Add("System.dll");
            parameters.ReferencedAssemblies.Add("System.Data.dll");
            parameters.ReferencedAssemblies.Add("System.Core.dll");
            parameters.ReferencedAssemblies.Add("MidTermAP.dll");

            // Generate the automata class source code!
            StringBuilder generateClass = new StringBuilder();

            DAutomata.DAutomataState[] allStates = automata.States;
            string[] inputSymbols = automata.Chars;

            generateClass.AppendLine("using System;");
            //generateClass.AppendLine("using System.Collections.Generic;");
            //generateClass.AppendLine("using System.ComponentModel;");
            generateClass.AppendLine("using System.Data;");
            //generateClass.AppendLine("using System.Drawing;");
            //generateClass.AppendLine("using System.Text;");
            generateClass.AppendLine("using Exercise1;");
            generateClass.AppendLine("");
            generateClass.AppendLine("namespace Exercise1");
            generateClass.AppendLine("{");
            generateClass.AppendLine("   public class MyRegExExecutor: Exercise1.ICompilable");
            generateClass.AppendLine("   {");
            generateClass.AppendLine("");
            generateClass.AppendLine("      public bool IsMatch(string str)");
            generateClass.AppendLine("      {");
            generateClass.AppendLine("         return IsMatch(ref str, " + automata.StartState.ID + ", 0);");
            generateClass.AppendLine("      }");
            generateClass.AppendLine("");
            generateClass.AppendLine("      private bool IsMatch(ref string str, int stState = 0, int stIndex = 0)");
            generateClass.AppendLine("      {");
            generateClass.AppendLine("         int curState = stState;");
            generateClass.AppendLine("         for(int i = stIndex; i<str.Length; i++)");
            generateClass.AppendLine("         {");
            generateClass.AppendLine("            switch(curState)");
            generateClass.AppendLine("            {");
            foreach (var st in allStates)
            {
                generateClass.AppendLine("               case " + st.ID + ":");
                generateClass.AppendLine("                  switch(str[i])");
                generateClass.AppendLine("                  {");
                foreach (string chr in inputSymbols)
                {
                    DAutomata.DAutomataState nextS = st.GetTransition(chr);
                    if (nextS == null || chr == RegularExpressionParser.MetaCharsTranslations.JollyCharTrans) continue;
                    generateClass.AppendLine("                     case '" + (chr[0] == '\\' ? "\\" : chr[0].ToString()) + "':");
                    var jollyTrans = st.GetTransition(RegularExpressionParser.MetaCharsTranslations.JollyCharTrans);
                    if (jollyTrans != null)
                    {

                        generateClass.AppendLine("                        if(IsMatch(ref str, " + jollyTrans.ID + ", i+1)) return true;");
                    }

                    if(st.ID!=nextS.ID) generateClass.AppendLine("                        curState = " + nextS.ID + ";");
                    generateClass.AppendLine("                        break;");
                }

                DAutomata.DAutomataState dotS = st.GetTransition(RegularExpressionParser.MetaCharsTranslations.JollyCharTrans);
                generateClass.AppendLine("                      default:");
                if (dotS == null)
                    generateClass.AppendLine("                        return false;");
                else
                {
                    generateClass.AppendLine("                        curState = " + dotS.ID + ";");
                    generateClass.AppendLine("                        break;");
                }
                generateClass.AppendLine("                  }");
                generateClass.AppendLine("                  break;");
            }
            generateClass.AppendLine("            }");
            generateClass.AppendLine("         }");
            string orStates = "";
            foreach (var st in automata.States)
            {
                if (st.IsFinal)
                {
                    if (orStates != "") orStates += " || ";
                    orStates += "curState == " + st.ID;
                }
            }
            generateClass.AppendLine("         return (" + orStates + ");");
            generateClass.AppendLine("      }");
            generateClass.AppendLine("   }");
            generateClass.AppendLine("}");

            // Compile the generated source code
            CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, generateClass.ToString());

            // Catch possible compiler errors
            if (!results.Errors.HasErrors)
            {
                // no errors => get the copiled class "MyRegExExecutor"
                this.assembly = results.CompiledAssembly;
                compiledClass = (ICompilable)Activator.CreateInstance(assembly.GetTypes()[0]);
                return generateClass.ToString();
            }
            else
            {
                // there are some compile errors. throws it!
                throw new CompilerException(results.Errors);
            }
        }