Class ParserUtil
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.utils.ParserUtil
-
public final class ParserUtil extends Object
Contains utility methods for parser to use while creating ast.
-
-
Field Summary
Fields Modifier and Type Field Description private static String
BLOCK_MULTIPLE_COMMENT_BEGIN
Symbols with which multiple comment starts.private static String
BLOCK_MULTIPLE_COMMENT_END
Symbols with which multiple comment ends.private static String
JAVADOC_START
Symbols with which javadoc starts.
-
Constructor Summary
Constructors Modifier Constructor Description private
ParserUtil()
Stop instances being created.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static Map.Entry<Integer,Integer>
countLinesColumns(String text, int initialLinesCnt, int initialColumnsCnt)
Count lines and columns (in last line) in text.static DetailAST
createBlockCommentNode(String content)
Create block comment from string content.static DetailAST
createBlockCommentNode(org.antlr.v4.runtime.CommonToken token)
Create block comment from token.
-
-
-
Field Detail
-
JAVADOC_START
private static final String JAVADOC_START
Symbols with which javadoc starts.- See Also:
- Constant Field Values
-
BLOCK_MULTIPLE_COMMENT_BEGIN
private static final String BLOCK_MULTIPLE_COMMENT_BEGIN
Symbols with which multiple comment starts.- See Also:
- Constant Field Values
-
BLOCK_MULTIPLE_COMMENT_END
private static final String BLOCK_MULTIPLE_COMMENT_END
Symbols with which multiple comment ends.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ParserUtil
private ParserUtil()
Stop instances being created.
-
-
Method Detail
-
createBlockCommentNode
public static DetailAST createBlockCommentNode(String content)
Create block comment from string content.- Parameters:
content
- comment content.- Returns:
- DetailAST block comment
-
createBlockCommentNode
public static DetailAST createBlockCommentNode(org.antlr.v4.runtime.CommonToken token)
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.
-
-