Class SyntaxTreePrinter
- java.lang.Object
-
- ch.usi.si.seart.treesitter.printer.SyntaxTreePrinter
-
- All Implemented Interfaces:
TreePrinter
public class SyntaxTreePrinter extends Object
Printer used for generating human-readable representations of trees using an iterative approach. Each node of the subtree is represented as follows:
While indentation is used to represent the tree structure.optional_field_name: node_name [start_column:start_row] - [end_column:end_row]- Since:
- 1.2.0
- Author:
- Ozren Dabić
- See Also:
- Syntax Tree Playground
-
-
Constructor Summary
Constructors Constructor Description SyntaxTreePrinter(@NotNull TreeCursor cursor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Fileexport()Generates a file containing the string representation of an Abstract Syntax Tree (AST).Stringprint()Generates a human-readable representation of the tree, starting from the node currently pointed to by the cursor.
-
-
-
Constructor Detail
-
SyntaxTreePrinter
public SyntaxTreePrinter(@NotNull @NotNull TreeCursor cursor)
-
-
Method Detail
-
print
public String print()
Generates a human-readable representation of the tree, starting from the node currently pointed to by the cursor.- Returns:
- A human-readable print-out of the tree
-
export
public File export() throws IOException
Description copied from interface:TreePrinterGenerates a file containing the string representation of an Abstract Syntax Tree (AST). This method should be preferred overTreePrinter.print()when dealing with extremely wide, or deep trees.- Returns:
- A file containing human-readable print-out of the tree
- Throws:
IOException- if an I/O error occurs
-
-