/// <summary>
        /// Measures the number of lines taken up by comments after the start item before the first word.
        /// </summary>
        /// <param name="start">The start item.</param>
        /// <returns>Returns the number of lines takes up by comments.</returns>
        private static int MeasureCommentLinesAfter(CodeUnit start)
        {
            Param.AssertNotNull(start, "start");

            int lineSpan = 0;

            int previousLineSpan = -1;
            int previousEndLineNumber = -1;
            for (CodeUnit next = start.FindNext(); next != null; next = next.FindNext())
            {
                if (next.Is(LexicalElementType.Comment) || next.Is(CodeUnitType.Attribute))
                {
                    int itemLineSpan = ParameterPrewordOffset(next);

                    if (previousEndLineNumber > 0 && next.LineNumber == previousEndLineNumber && previousLineSpan > 0)
                    {
                        --itemLineSpan;
                    }

                    lineSpan += itemLineSpan;
                    previousLineSpan = itemLineSpan;
                    previousEndLineNumber = next.Location.EndPoint.LineNumber;
                    next = next.FindLast();
                }
                else if (!next.Is(LexicalElementType.WhiteSpace) && 
                    !next.Is(LexicalElementType.EndOfLine) &&
                    !next.Is(CodeUnitType.ParameterList) &&
                    !next.Is(CodeUnitType.ArgumentList) &&
                    !next.Is(CodeUnitType.Parameter) &&
                    !next.Is(CodeUnitType.Argument))
                {
                    break;
                }
            }

            return lineSpan;
        }
        /// <summary>
        /// Measures the number of lines taken up by comments between two tokens.
        /// </summary>
        /// <param name="start">The start token.</param>
        /// <param name="end">The end token.</param>
        /// <param name="includeAttributes">Indicates whether to also count attributes.</param>
        /// <returns>Returns the number of lines takes up by comments.</returns>
        private static int MeasureCommentLinesBetween(CodeUnit start, CodeUnit end, bool includeAttributes)
        {
            Param.AssertNotNull(start, "start");
            Param.AssertNotNull(end, "end");
            Param.Ignore(includeAttributes);

            int lineSpan = 0;

            int previousLineSpan = -1;
            int previousEndLineNumber = -1;
            for (CodeUnit next = start.FindNext(); next != null && next != end; next = next.FindNext())
            {
                if (next.Is(LexicalElementType.Comment) || (next.Is(CodeUnitType.Attribute) && includeAttributes))
                {
                    int itemLineSpan = ParameterPrewordOffset(next);

                    if (previousEndLineNumber > 0 && next.LineNumber == previousEndLineNumber && previousLineSpan > 0)
                    {
                        --itemLineSpan;
                    }

                    lineSpan += itemLineSpan;
                    previousLineSpan = itemLineSpan;
                    previousEndLineNumber = next.Location.EndPoint.LineNumber;
                }
            }

            return lineSpan;
        }