Class ParserUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.utils.ParserUtil
Contains utility methods for parser to use while creating ast.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountLinesColumns(String text, int initialLinesCnt, int initialColumnsCnt) Count lines and columns (in last line) in text.static DetailASTcreateBlockCommentNode(String content) Create block comment from string content.static DetailASTcreateBlockCommentNode(org.antlr.v4.runtime.CommonToken token) Create block comment from token.
-
Field Details
-
JAVADOC_START
Symbols with which javadoc starts.- See Also:
-
BLOCK_MULTIPLE_COMMENT_BEGIN
Symbols with which multiple comment starts.- See Also:
-
BLOCK_MULTIPLE_COMMENT_END
Symbols with which multiple comment ends.- See Also:
-
-
Constructor Details
-
ParserUtil
private ParserUtil()Stop instances being created.
-
-
Method Details
-
createBlockCommentNode
Create block comment from string content.- Parameters:
content- comment content.- Returns:
- DetailAST block comment
-
createBlockCommentNode
Create block comment from token.- Parameters:
token- Token object.- Returns:
- DetailAST with BLOCK_COMMENT type.
-
countLinesColumns
private static Map.Entry<Integer,Integer> countLinesColumns(String text, int initialLinesCnt, int initialColumnsCnt) Count lines and columns (in last line) in text.- Parameters:
text- String.initialLinesCnt- initial value of lines counter.initialColumnsCnt- initial value of columns counter.- Returns:
- entry(pair), key is line counter, value is column counter.
-