/// <summary>
        /// Determines if the current character is an end comment delimiter,
        /// and consumes it if so.
        /// </summary>
        /// <param name="nextChar"></param>
        /// <param name="lineNumber"></param>
        /// <param name="posInLine"></param>
        /// <returns></returns>
        private bool IsEndCommentDelimiter(char?nextChar, CommentDelimiters currentCommentDelimiter, ref int lineNumber, ref int posInLine)
        {
            if (currentCommentDelimiter.EndCommentDelimiter == EndCommentDelimiter.EndOfLine &&
                nextChar.HasValue && nextChar.Value == '\n')
            {
                return(true);
            }
            else if (!String.IsNullOrEmpty(currentCommentDelimiter.EndCommentDelimiter) &&
                     currentCommentDelimiter.EndCommentDelimiter.Delimiter.StartsWith(nextChar.Value.ToString()))
            {
                int    count      = 0;
                string endComment = "" + nextChar.Value + this.scanner.Peek(++count);
                while (currentCommentDelimiter.EndCommentDelimiter.Delimiter.StartsWith(endComment) &&
                       currentCommentDelimiter.EndCommentDelimiter != endComment)
                {
                    endComment = "" + nextChar.Value + this.scanner.Peek(++count);
                }

                if (endComment == currentCommentDelimiter.EndCommentDelimiter)
                {
                    // consume end comment delimiter
                    for (int i = 0; i < count; ++i)
                    {
                        this.scanner.GetNextCharacter(out lineNumber, out posInLine);
                    }
                }

                return(endComment == currentCommentDelimiter.EndCommentDelimiter);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Determines if the current character is the beginning of a comment,
        /// and consumes the entire comment delimiter if so.
        /// </summary>
        /// <param name="nextChar"></param>
        /// <param name="lineNumber"></param>
        /// <param name="posInLine"></param>
        /// <returns></returns>
        private bool IsBeginCommentDelimiter(char?nextChar, ref int lineNumber, ref int posInLine, out CommentDelimiters currentCommentDelimiter)
        {
            currentCommentDelimiter = null;

            if (this.CommentDelimiters != null)
            {
                foreach (var commentDelimiter in this.CommentDelimiters)
                {
                    if (!string.IsNullOrEmpty(commentDelimiter.BeginCommentDelimiter))
                    {
                        int    count        = 0;
                        string peekValue    = this.scanner.Peek(++count);
                        string beginComment = nextChar.Value.ToString() + peekValue;
                        while (commentDelimiter.BeginCommentDelimiter.Delimiter.StartsWith(beginComment) &&
                               commentDelimiter.BeginCommentDelimiter != beginComment &&
                               !String.IsNullOrEmpty(peekValue) && peekValue.Length == count)
                        {
                            peekValue    = this.scanner.Peek(++count);
                            beginComment = nextChar.Value.ToString() + peekValue;
                        }

                        if (beginComment == commentDelimiter.BeginCommentDelimiter)
                        {
                            // consume begin comment delimiter
                            for (int i = 0; i < count; ++i)
                            {
                                this.scanner.GetNextCharacter(out lineNumber, out posInLine);
                            }

                            currentCommentDelimiter = commentDelimiter;

                            return(true);
                        }
                    }
                }
            }

            return(false);
        }