Compile() public abstract method

public abstract Compile ( string source, string input ) : ExecutionEnvironment
source string
input string
return ExecutionEnvironment
Exemplo n.º 1
0
        private bool compile(ExecutionState state)
        {
            removeRunToCursorBreakpoint();
            _currentPosition = null;

            if (_env != null)
            {
                _env.State = state;
                return(true);
            }

            if (_saveWhenRun)
            {
                save();
            }

            try
            {
                _env = _currentLanguage.Compile(txtSource.Text, _input ?? "");
                _env.OriginalSource     = txtSource.Text;
                _env.State              = state;
                _env.DebuggerBreak     += p => { this.BeginInvoke(new Action(() => debuggerBreak(p))); };
                _env.ExecutionFinished += (c, e) => { this.BeginInvoke(new Action(() => executionFinished(c, e))); };
                foreach (int bp in lstBreakpoints.Items)
                {
                    _env.AddBreakpoint(bp);
                }
                _env.BreakpointsChanged += () => { this.BeginInvoke(new Action(() => breakpointsChanged())); };
                tabWatch.Controls.Clear();
                tabWatch.Controls.Add(_env.InitializeWatchWindow());
                if (EsotericIDEProgram.Settings.WatchFont != null)
                {
                    _env.SetWatchWindowFont(EsotericIDEProgram.Settings.WatchFont);
                }
                return(true);
            }
            catch (CompileException e)
            {
                if (e.Index != null)
                {
                    txtSource.Focus();
                    txtSource.SelectionStart  = e.Index.Value;
                    txtSource.SelectionLength = e.Length ?? 0;
                    txtSource.ScrollToCaret();
                }
                DlgMessage.Show("Compilation failed:" + Environment.NewLine + e.Message, "Esoteric IDE", DlgType.Error, "&OK");
                return(false);
            }
            catch (Exception e)
            {
                DlgMessage.Show("Compilation failed:" + Environment.NewLine + e.Message + " (" + e.GetType().FullName + ")", "Esoteric IDE", DlgType.Error, "&OK");
                return(false);
            }
        }