public final class AstTreeStringPrinter extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
LINE_SEPARATOR
OS specific line separator.
|
private static java.util.regex.Pattern |
NEWLINE
Newline pattern.
|
private static java.util.regex.Pattern |
RETURN
Return pattern.
|
private static java.util.regex.Pattern |
TAB
Tab pattern.
|
| Modifier | Constructor and Description |
|---|---|
private |
AstTreeStringPrinter()
Prevent instances.
|
| Modifier and Type | Method and Description |
|---|---|
private static java.lang.String |
escapeAllControlChars(java.lang.String text)
Replace all control chars with escaped symbols.
|
private static java.lang.String |
getIndentation(DetailAST ast)
Get indentation for an AST node.
|
private static java.lang.String |
getNodeInfo(DetailAST node)
Get string representation of the node as token name,
node text, line number and column number.
|
private static java.lang.String |
parseAndPrintJavadocTree(DetailAST node)
Parses block comment as javadoc and prints its tree.
|
static java.lang.String |
printAst(FileText text,
JavaParser.Options options)
Parse a file and print the parse tree.
|
static java.lang.String |
printBranch(DetailAST node)
Print branch info from root down to given
node. |
static java.lang.String |
printFileAst(java.io.File file,
JavaParser.Options options)
Parse a file and print the parse tree.
|
private static java.lang.String |
printJavaAndJavadocTree(DetailAST ast)
Prints full tree (java + comments + javadoc) of the DetailAST.
|
static java.lang.String |
printJavaAndJavadocTree(java.io.File file)
Prints full AST (java + comments + javadoc) of the java file.
|
private static java.lang.String |
printTree(DetailAST ast)
Print AST.
|
private static final java.util.regex.Pattern NEWLINE
private static final java.util.regex.Pattern RETURN
private static final java.util.regex.Pattern TAB
private static final java.lang.String LINE_SEPARATOR
private AstTreeStringPrinter()
public static java.lang.String printFileAst(java.io.File file, JavaParser.Options options) throws java.io.IOException, CheckstyleException
file - the file to print.options - JavaParser.Options to control the inclusion of comment nodes.java.io.IOException - if the file could not be read.CheckstyleException - if the file is not a Java source.public static java.lang.String printJavaAndJavadocTree(java.io.File file) throws java.io.IOException, CheckstyleException
file - java filejava.io.IOException - Failed to open a fileCheckstyleException - error while parsing the fileprivate static java.lang.String printJavaAndJavadocTree(DetailAST ast)
ast - root DetailASTprivate static java.lang.String parseAndPrintJavadocTree(DetailAST node)
node - block comment beginpublic static java.lang.String printAst(FileText text, JavaParser.Options options) throws CheckstyleException
text - the text to parse.options - JavaParser.Options to control the inclusion of comment nodes.CheckstyleException - if the file is not a Java source.public static java.lang.String printBranch(DetailAST node)
node.node - last item of the branchprivate static java.lang.String printTree(DetailAST ast)
ast - the root AST node.private static java.lang.String getNodeInfo(DetailAST node)
node - DetailASTprivate static java.lang.String getIndentation(DetailAST ast)
ast - the AST to get the indentation for.private static java.lang.String escapeAllControlChars(java.lang.String text)
text - the String to process.Copyright © 2001-2022. All Rights Reserved.