Class SymbolicExpressionPrinter

  • All Implemented Interfaces:
    TreePrinter

    public class SymbolicExpressionPrinter
    extends Object
    Printer used for generating Symbolic Expression (S-expression) representations of trees using an iterative approach. Note that unlike the CLI counterpart, the resulting symbolic expression does not contain the positional information of the node.
    Since:
    1.4.0
    Author:
    Ozren Dabić
    See Also:
    Rust implementation
    • Constructor Detail

      • SymbolicExpressionPrinter

        public SymbolicExpressionPrinter​(@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:
        print in interface TreePrinter
        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:
        export in interface TreePrinter
        Returns:
        A file containing the string of the tree
        Throws:
        IOException - if an I/O error occurs