예제 #1
0
        /// <summary>
        /// Executes the DEL command.
        /// </summary>
        public void Execute()
        {
            int?start = _runEnvironment.CurrentLine.GetLineNumber();
            int?end   = null;

            if (start.HasValue)
            {
                var token = _runEnvironment.CurrentLine.NextToken();
                if (token.Seperator == TokenType.Comma)
                {
                    end = _runEnvironment.CurrentLine.GetLineNumber();
                }
            }

            if (!start.HasValue || !end.HasValue)
            {
                throw new Exceptions.SyntaxErrorException();
            }

            _programRepository.DeleteProgramLines(start.Value, end.Value);

            // If we're in a program end us and don't allow continue.
            if (_runEnvironment.CurrentLine.LineNumber.HasValue)
            {
                _runEnvironment.ContinueLineNumber = null;
                throw new Exceptions.EndException();
            }
        }