Exemplo n.º 1
0
        public void Compile()
        {
            _compiledDoc = null;

            if (_pureScriptController.Apply())
            {
                _tempDoc.ScriptText = _pureScriptController.Model.ScriptText;

                if (null != _view)
                {
                    _view.ClearCompilerErrors();
                }

                IScriptText compiledDoc = _tempDoc.CloneForModification();
                bool        result      = compiledDoc.Compile();

                string[] errors = compiledDoc.Errors;
                if (result == false)
                {
                    _compiledDoc = null;

                    foreach (string s in errors)
                    {
                        System.Text.RegularExpressions.Match match = _compilerErrorRegex.Match(s);
                        if (match.Success)
                        {
                            string news = match.Result("(${line},${column}) : ${msg}");

                            _view.AddCompilerError(news);
                        }
                        else
                        {
                            _view.AddCompilerError(s);
                        }
                    }


                    Current.Gui.ErrorMessageBox("There were compilation errors");
                    return;
                }
                else
                {
                    _compiledDoc = compiledDoc;

                    _view.AddCompilerError(DateTime.Now.ToLongTimeString() + " : Compilation successful.");
                }
            }
        }