Package edu.cornell.cs.cs4120.util
Interface SExpPrinter
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
CodeWriterSExpPrinter
public interface SExpPrinter
extends java.lang.AutoCloseable
A pretty-printer for S-expressions.
-
Method Summary
Modifier and Type Method Description voidclose()Flushes and closes both this printer and any underlying output stream to which it is attached.voidendList()Prints the close parenthesis of an S-expression list.voidflush()Flushes all formatted text to the underlying writer.voidprintAtom(java.lang.String atom)Prints an atom.voidstartList()Prints the open parenthesis of an S-expression list.default voidstartUnifiedList()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
void printAtom(java.lang.String atom)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:
closein interfacejava.lang.AutoCloseable
-