/// <summary>
        /// Reads the source code within the given span.
        /// </summary>
        /// <param name="span"> The start and end positions within the source code. </param>
        /// <returns> The source code within the given span. </returns>
        internal string ReadSpan(Compiler.SourceCodeSpan span)
        {
            if (span == null)
            {
                throw new ArgumentNullException("span");
            }

            int  line = 1, column = 1;
            var  reader     = this.GetReader();
            var  spanText   = new System.Text.StringBuilder();
            bool insideSpan = false;

            while (true)
            {
                // Detect the start and end of the span.
                if (insideSpan == false)
                {
                    // Check for the start of the span.
                    if (line == span.StartLine && column == span.StartColumn)
                    {
                        insideSpan = true;
                    }
                }
                if (insideSpan)
                {
                    // Check for the end of the span.
                    if (line == span.EndLine && column == span.EndColumn)
                    {
                        break;
                    }
                }

                // Read the next character.
                int c = reader.Read();
                if (c == -1)
                {
                    break;
                }

                // Collect text
                if (insideSpan)
                {
                    spanText.Append((char)c);
                }

                // Update the line and column count.
                if (c == '\r' || c == '\n')
                {
                    if (c == '\r' && reader.Peek() == '\n')
                    {
                        reader.Read();
                    }
                    line++;
                    column = 1;
                }
                else
                {
                    column++;
                }
            }

            return(spanText.ToString());
        }