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 string representation of the Abstract Syntax Tree (AST), starting from the node currently pointed to by the cursor, while writing outputs directly to a file.Stringprint()Generates a string representation of the Abstract Syntax Tree (AST), starting from the node currently pointed to by the cursor.
-
-
-
Constructor Detail
-
SyntaxTreePrinter
public SyntaxTreePrinter(@NotNull @NotNull TreeCursor cursor)
-
-
Method Detail
-
print
public final String print()
Generates a string representation of the Abstract Syntax Tree (AST), starting from the node currently pointed to by the cursor.- Specified by:
printin interfaceTreePrinter- Returns:
- A string representation of the tree
-
export
public final File export() throws IOException
Generates a string representation of the Abstract Syntax Tree (AST), starting from the node currently pointed to by the cursor, while writing outputs directly to a file.- Specified by:
exportin interfaceTreePrinter- Returns:
- A file containing the string of the tree
- Throws:
IOException- if an I/O error occurs
-
-