001//////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code for adherence to a set of rules. 003// Copyright (C) 2001-2022 the original author or authors. 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//////////////////////////////////////////////////////////////////////////////// 019 020package com.puppycrawl.tools.checkstyle.grammar; 021 022/** 023 * This interface is used to be notified by parser about comments 024 * in the parsed code. 025 * 026 * @noinspection ClassOnlyUsedInOnePackage 027 */ 028public interface CommentListener { 029 030 /** 031 * Report the location of a single line comment that extends from the 032 * given point to the end of the line. The type of comment is identified 033 * by a String whose value depends on the language being parsed, but would 034 * typically be the delimiter for the comment. 035 * 036 * @param type an identifier for what type of comment it is. 037 * @param startLineNo the starting line number 038 * @param startColNo the starting column number 039 */ 040 void reportSingleLineComment(String type, 041 int startLineNo, int startColNo); 042 043 /** 044 * Report the location of a block comment that can span multiple lines. 045 * The type of comment is identified by a String whose value depends on 046 * the language being parsed, but would typically be the delimiter for the 047 * comment. 048 * 049 * @param type an identifier for what type of comment it is. 050 * @param startLineNo the starting line number 051 * @param startColNo the starting column number 052 * @param endLineNo the ending line number 053 * @param endColNo the ending column number 054 */ 055 void reportBlockComment(String type, 056 int startLineNo, int startColNo, 057 int endLineNo, int endColNo); 058 059}