001////////////////////////////////////////////////////////////////////////////////
002// checkstyle: Checks Java source code for adherence to a set of rules.
003// Copyright (C) 2001-2014  Oliver Burn
004//
005// This library is free software; you can redistribute it and/or
006// modify it under the terms of the GNU Lesser General Public
007// License as published by the Free Software Foundation; either
008// version 2.1 of the License, or (at your option) any later version.
009//
010// This library is distributed in the hope that it will be useful,
011// but WITHOUT ANY WARRANTY; without even the implied warranty of
012// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013// Lesser General Public License for more details.
014//
015// You should have received a copy of the GNU Lesser General Public
016// License along with this library; if not, write to the Free Software
017// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018////////////////////////////////////////////////////////////////////////////////
019package com.puppycrawl.tools.checkstyle.grammars;
020
021/**
022 * This interface is used to be notified by parser about comments
023 * in the parsed code.
024 *
025 * @author o_sukhodolsky
026 */
027public interface CommentListener
028{
029    /**
030     * Report the location of a single line comment that extends from the
031     * given point to the end of the line. The type of comment is identified
032     * by a String whose value depends on the language being parsed, but would
033     * typically be the delimiter for the comment.
034     *
035     * @param type an identifier for what type of comment it is.
036     * @param startLineNo the starting line number
037     * @param startColNo the starting column number
038     */
039    void reportSingleLineComment(String type,
040                                 int startLineNo, int startColNo);
041
042    /**
043     * Report the location of a block comment that can span multiple lines.
044     * The type of comment is identified by a String whose value depends on
045     * the language being parsed, but would typically be the delimiter for the
046     * comment.
047     *
048     * @param type an identifier for what type of comment it is.
049     * @param startLineNo the starting line number
050     * @param startColNo the starting column number
051     * @param endLineNo the ending line number
052     * @param endColNo the ending column number
053     */
054    void reportBlockComment(String type,
055                            int startLineNo, int startColNo,
056                            int endLineNo, int endColNo);
057}