private void highlightComment(
            FragmentHighlighter highlighter,
            String text,
            int relStart,
            int relEnd)
    {
        int relCommentStart = relStart;
        int relCommentEnd = relEnd;
        
        //Find the start position of a non-white space sequence.
        while (relCommentStart < relCommentEnd
                && Character.isWhitespace(text.charAt(relCommentStart)))
        {
            ++relCommentStart;
        }
        
        //Find the end position of a non-white space sequence.
        while (relCommentStart < relCommentEnd
                && Character.isWhitespace(text.charAt(relCommentEnd - 1)))
        {
            --relCommentEnd;
        }
        
        //If the sequence is not empty, highlight it as a comment.
        if (relCommentStart < relCommentEnd) {
            if (relStart < relCommentStart) {
                //Highlight the fragment before the sequence as a whitespace.
                highlighter.highlight(null, relCommentStart - relStart);
            }
            highlighter.highlight(commentAttributes, relCommentEnd - relCommentStart);
            if (relCommentEnd < relEnd) {
                //Highlight the fragment after the sequence as a whitespace.
                highlighter.highlight(commentAttributes, relEnd - relCommentEnd);
            }
        } else {
            //All characters in the specified range are white spaces. Do not highlight them.
            highlighter.highlight(null, relEnd - relStart);
        }
    }