Package edu.cornell.cs.cs4120.util
Interface SExpPrinter
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
CodeWriterSExpPrinter
A pretty-printer for S-expressions.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Flushes and closes both this printer and any underlying output stream to which it is attached.void
endList()
Prints the close parenthesis of an S-expression list.void
flush()
Flushes all formatted text to the underlying writer.void
Prints an atom.void
Prints the open parenthesis of an S-expression list.default void
Prints the open parenthesis of an S-expression list, and requires that if a line break is required to separate any two elements of this list, then all elements of this list must be separated by a line break (optional operation).
-
Method Details
-
printAtom
Prints an atom.- Parameters:
atom
- the atom to print
-
startList
void startList()Prints the open parenthesis of an S-expression list. -
startUnifiedList
default void startUnifiedList()Prints the open parenthesis of an S-expression list, and requires that if a line break is required to separate any two elements of this list, then all elements of this list must be separated by a line break (optional operation). -
endList
void endList()Prints the close parenthesis of an S-expression list. -
flush
void flush()Flushes all formatted text to the underlying writer. This method should be called when printing is complete. -
close
void close()Flushes and closes both this printer and any underlying output stream to which it is attached. It is an error to perform any subsequent operations on the same printer.- Specified by:
close
in interfaceAutoCloseable
-