| SMLFormat |
signature PRETTYPRINTER =
sig
type environmentEntry =
{
requiredColumns : int,
newline : bool ref,
priority : FormatExpression.priority
}
type environment = environmentEntry list
datatype symbol =
Term of int * string
| List of { symbols : symbol list, environment : environment}
| Indicator of { space : bool, newline : bool ref}
| DeferredIndicator of { space : bool, requiredColumns : int ref}
| StartOfIndent of int
| EndOfIndent
exception Fail of string
val format : PrinterParameter.parameter list -> symbol -> string
end
Type detail |
---|
type environmentEntry =
{
(* the number of columns required to print the text without inserting
newlines at the indicators of the priority.*)
requiredColumns : int,
(* indicates whether to begin a newline at the all indicators of
the priority
*)
newline : bool ref,
(* the priority *) priority : FormatExpression.priority
}
type environment = environmentEntry list
Datatype detail |
---|
datatype symbol =
Term of int * string
| List of
{
(* the list of symbols *) symbols : symbol list,
(* the environment consisting of entries for preferred indicators.*)
environment : environment
}
| Indicator of
{
(* true if the space indicator is specified.*) space : bool,
(* become true if a newline should begin at this indicator.*)
newline : bool ref
}
| DeferredIndicator of
{
(* true if the space indicator is specified.*) space : bool,
(* the number of columns required to print the text without
inserting newlines at this indicator.*)
requiredColumns : int ref
}
| StartOfIndent of int
| EndOfIndent
DataConstructor detail |
---|
constructor Term : int * string -> symbol
constructor List
: {
(* the list of symbols *) symbols : symbol list,
(* the environment consisting of entries for preferred indicators.*)
environment : environment
} ->
symbol
constructor Indicator
: {
(* true if the space indicator is specified.*) space : bool,
(* become true if a newline should begin at this indicator.*)
newline : bool ref
} ->
symbol
constructor DeferredIndicator
: {
(* true if the space indicator is specified.*) space : bool,
(* the number of columns required to print the text without
inserting newlines at this indicator.*)
requiredColumns : int ref
} ->
symbol
constructor StartOfIndent : int -> symbol
constructor EndOfIndent : symbol
Value detail |
---|
fun format parameter symbol
: PrinterParameter.parameter list -> symbol -> string
This function tries to insert newline characters so that the text can fit within the specified column width, but it may exceed the specified column width if the column width is too small.
parameter
symbol
Exception detail |
---|
exception Fail of string
message
| SMLFormat: Pretty-Printer library for SML |