Package net.hydromatic.morel.compile
Class Pretty
- java.lang.Object
-
- net.hydromatic.morel.compile.Pretty
-
class Pretty extends Object
Prints values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPretty.NamedValWrapper that indicates that a value should be printed "name = value".(package private) static classPretty.TypedValWrapper that indicates that a value should be printed "val name = value : type".
-
Field Summary
Fields Modifier and Type Field Description private intlineWidthprivate intprintDepthprivate intprintLengthprivate intstringDepthprivate TypeSystemtypeSystem
-
Constructor Summary
Constructors Constructor Description Pretty(TypeSystem typeSystem, int lineWidth, int printLength, int printDepth, int stringDepth)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidindent(StringBuilder buf, int indent)(package private) StringBuilderpretty(StringBuilder buf, Type type, Object value)Prints a value to a buffer.private StringBuilderpretty1(StringBuilder buf, int indent, int[] lineEnd, int depth, Type type, Object value)Prints a value to a buffer.private StringBuilderpretty2(StringBuilder buf, int indent, int[] lineEnd, int depth, Type type, List<? extends Type> argTypes, Object value)private StringBuilderprintList(StringBuilder buf, int indent, int[] lineEnd, int depth, Type elementType, List<Object> list)private static Typeunqualified(Type type)
-
-
-
Field Detail
-
typeSystem
private final TypeSystem typeSystem
-
lineWidth
private final int lineWidth
-
printLength
private final int printLength
-
printDepth
private final int printDepth
-
stringDepth
private final int stringDepth
-
-
Constructor Detail
-
Pretty
Pretty(TypeSystem typeSystem, int lineWidth, int printLength, int printDepth, int stringDepth)
-
-
Method Detail
-
pretty
StringBuilder pretty(@Nonnull StringBuilder buf, @Nonnull Type type, @Nonnull Object value)
Prints a value to a buffer.
-
pretty1
private StringBuilder pretty1(@Nonnull StringBuilder buf, int indent, int[] lineEnd, int depth, @Nonnull Type type, @Nonnull Object value)
Prints a value to a buffer. If the first attempt goes beyondlineEnd, back-tracks, adds a newline and indent, and tries again one time.
-
indent
private static void indent(@Nonnull StringBuilder buf, int indent)
-
pretty2
private StringBuilder pretty2(@Nonnull StringBuilder buf, int indent, int[] lineEnd, int depth, @Nonnull Type type, List<? extends Type> argTypes, @Nonnull Object value)
-
printList
private StringBuilder printList(@Nonnull StringBuilder buf, int indent, int[] lineEnd, int depth, @Nonnull Type elementType, @Nonnull List<Object> list)
-
-