| SMLFormat |
signature FORMAT_EXPRESSION =
sig
type assoc = { cut : bool, strength : int, direction : assocDirection}
datatype priority = Preferred of int | Deferred
datatype assocDirection = Left | Right | Neutral
datatype expression =
Term of int * string
| Guard of assoc option * expression list
| Indicator of
{ space : bool, newline : { priority : priority} option}
| StartOfIndent of int
| EndOfIndent
val isHigherThan : priority * priority -> bool
val assocToString : assoc -> string
val priorityToString : priority -> string
val toString : expression -> string
val parse
: (char, 'a) StringCvt.reader -> (expression list, 'a) StringCvt.reader
end
Type detail |
---|
type assoc =
{
(* true if the inheritance of associativity from the upper guard
is cut.*)
cut : bool,
(* the strength of the association.*) strength : int,
(* the direction of the association.*) direction : assocDirection
}
Datatype detail |
---|
datatype priority = Preferred of int | Deferred
datatype assocDirection = Left | Right | Neutral
datatype expression =
Term of int * string
| Guard of assoc option * expression list
| Indicator of
{
(* true if a whitespace should be inserted here.*) space : bool,
(* NONE if newline indicator is not specified.*)
newline : {(* priority to insert a newline *) priority : priority} option
}
| StartOfIndent of int
| EndOfIndent
DataConstructor detail |
---|
constructor Preferred : int -> priority
constructor Deferred : priority
constructor Left : assocDirection
constructor Right : assocDirection
constructor Neutral : assocDirection
constructor Term (columns, text) : int * string -> expression
columns
text
constructor Guard (assoc, expressions)
: assoc option * expression list -> expression
assoc
expressions
constructor Indicator
: {
(* true if a whitespace should be inserted here.*) space : bool,
(* NONE if newline indicator is not specified.*)
newline :
{(* priority to insert a newline *) priority : priority} option
} ->
expression
constructor StartOfIndent width : int -> expression
width
constructor EndOfIndent : expression
Value detail |
---|
fun isHigherThan (left, right) : priority * priority -> bool
left
right
left
is higher priority than
the right
fun assocToString assoc : assoc -> string
assoc
assoc
fun priorityToString priority : priority -> string
priority
priority
fun toString expression : expression -> string
expression
expression
val parse
: (char, 'a) StringCvt.reader -> (expression list, 'a) StringCvt.reader
Any character follows a back slash is interpreted as is. Especially, a sequence of ['\', '"'] is interpreted as a character '"'.
| SMLFormat: Pretty-Printer library for SML |