Exemplo n.º 1
0
        /// <summary>
        /// スクリプトの処理をします.
        /// </summary>
        /// <param name="reader"></param>
        public string Execute(TextReader reader)
        {
            this.SequenceController.SuspendAllocationChanged();
            try {
                _suspendHistoryChanged = true;
                try {
                    ScriptParser p = new ScriptParser();
                    return(p.Execute(reader, new ScriptExecutionEnvironment(this, new VariableStorage(this))));

#if DEBUG
                } catch (ParseException ex) {
                    if (_lastSubroutineOnError == null)
                    {
                        _lastSubroutineOnError = "Script Body";
                    }
                    if (_lastSyntaxOnError == null)
                    {
                        _lastSyntaxOnError = new NullSyntaxElement(new LexicalElement("", LexType.Null, 0, 0, 0, 0));
                    }
                    return(string.Format("{0}\r\nIn {1}, Column {2} at Line {3}", ex.Message, _lastSubroutineOnError, _lastSyntaxOnError.LexAtStart.Column, _lastSyntaxOnError.LexAtStart.Line));
#else
                } catch (Exception ex) {
                    if (_lastSubroutineOnError == null)
                    {
                        _lastSubroutineOnError = "Script Body";
                    }
                    if (_lastSyntaxOnError == null)
                    {
                        _lastSyntaxOnError = new NullSyntaxElement(new LexicalElement("", LexType.Null, 0, 0, 0, 0));
                    }
                    return(string.Format("{0}\r\nIn {1}, Column {2} at Line {3}", ex.Message, _lastSubroutineOnError, _lastSyntaxOnError.LexAtStart.Column, _lastSyntaxOnError.LexAtStart.Line));
#endif
                } finally {
                    _suspendHistoryChanged = false;
                    this.DoHistoryChanged();
                }
            } finally {
                this.SequenceController.ResumeAllocationChanged();
            }
        }