001/////////////////////////////////////////////////////////////////////////////////////////////// 002// checkstyle: Checks Java source code and other text files for adherence to a set of rules. 003// Copyright (C) 2001-2024 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 * @noinspectionreason ClassOnlyUsedInOnePackage - we restrict all parsing to a single package 028 */ 029public interface CommentListener { 030 031 /** 032 * Report the location of a single-line comment that extends from the 033 * given point to the end of the line. The type of comment is identified 034 * by a String whose value depends on the language being parsed, but would 035 * typically be the delimiter for the comment. 036 * 037 * @param type an identifier for what type of comment it is. 038 * @param startLineNo the starting line number 039 * @param startColNo the starting column number 040 */ 041 void reportSingleLineComment(String type, 042 int startLineNo, int startColNo); 043 044 /** 045 * Report the location of a block comment that can span multiple lines. 046 * The type of comment is identified by a String whose value depends on 047 * the language being parsed, but would typically be the delimiter for the 048 * comment. 049 * 050 * @param type an identifier for what type of comment it is. 051 * @param startLineNo the starting line number 052 * @param startColNo the starting column number 053 * @param endLineNo the ending line number 054 * @param endColNo the ending column number 055 */ 056 void reportBlockComment(String type, 057 int startLineNo, int startColNo, 058 int endLineNo, int endColNo); 059 060}