Continuation representation of documents.
The operations provided by a pretty-printable document that don't depend on the document's representation type.
Indentation is expressed as integer space units.
Indentation is expressed as integer space units.
The final layout of a document
The final layout of a document
A parameterised item of abstract state machine state holding values
of type U
, associated with parameters of type T
.
An update of a parameterised item of state s
to have the value u
at parameter t
.
Utility class for updaters for values of parameterised state.
Interface for pretty-printable values.
An update of a scalar item of state s
to have the value t
.
A scalar item of abstract state machine state holding a value of
type T
and called sname
.
An update of an item of state s
to have the value t
.
Output medium width
Output medium width
An ampersand document.
An ampersand document.
Return a document that encloses a given document between left and right angle brackets.
Return a document that encloses a given document between left and right angle brackets.
Generic pretty-printer document for any type of value.
Generic pretty-printer document for any type of value. If a
is a
Vector
, Map
, List
or Product
, print it in a prefix list style,
with the exception that Nil
prints as Nil
. Tuples are pretty-printed
using arrow notation. Strings are pretty-printed surrounded by double
quotes. If none of these cases apply, use the toDoc
method on a
.
null
prints as null
.
Convert any value into a pretty-printable value.
Convert any value into a pretty-printable value. The value will
be pretty-printed using the value
combinator.
An asterisk document.
An asterisk document.
An at-sign document.
An at-sign document.
A backquote document.
A backquote document.
A backslash document.
A backslash document.
Return a document that encloses a given document between left and right braces.
Return a document that encloses a given document between left and right braces.
Return a document that encloses a given document between left and right square brackets.
Return a document that encloses a given document between left and right square brackets.
A caret document.
A caret document.
Return a document that concatenates the documents in the given sequence
either horizontally with <>
if they fit in the output medium width,
or if not, vertically with <@@>
.
Return a document that concatenates the documents in the given sequence
either horizontally with <>
if they fit in the output medium width,
or if not, vertically with <@@>
.
Convert a character to a document.
Convert a character to a document. The character can be a newline.
A colon document.
A colon document.
A comma document.
A comma document.
Debug flag.
Debug flag. Set this to true in sub-classes or objects to obtain tracing information during execution of the machine.
Default indentation is four spaces.
Default indentation is four spaces.
Default layout width is 75 characters.
Default layout width is 75 characters.
A dollar sign document.
A dollar sign document.
A dot (period) document.
A dot (period) document.
A double quote document.
A double quote document.
Return a document that encloses a given document between double quotes.
Return a document that encloses a given document between double quotes.
An empty document.
An empty document. This is a left and right unit for the concatenation
method. Called nil
in the paper.
Return a document that encloses a given document between left and right documents.
Return a document that encloses a given document between left and right documents.
An equal sign document.
An equal sign document.
An exclamation mark document.
An exclamation mark document.
Return a document that concatenates the documents in the given sequence
horizontally with <>
as long as they fit the output width, then
inserts a linebreak
and continues to the end of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <>
as long as they fit the output width, then
inserts a linebreak
and continues to the end of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence. Separates
documents with the given separator before the <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence.
Clean up after this machine.
Clean up after this machine. This routine is called after the machine terminates. Default: do nothing.
A forward slash document.
A forward slash document.
A document representing a choice among different ways to print a structure.
A document representing a choice among different ways to print a structure.
A hash mark document.
A hash mark document.
Return a document that concatenates the documents in the given sequence
horizontally with <>
.
Return a document that concatenates the documents in the given sequence
horizontally with <>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
. Separates documents with the given separator
before the <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
.
Initialise the state of this machine.
Initialise the state of this machine. This routine is called before the first step of the machine is attempted. Any pending state updates will be performed after this routine returns. Default: do nothing.
A left angle bracket document.
A left angle bracket document.
A left brace document.
A left brace document.
A left square bracket document.
A left square bracket document.
A document representing a potential line break.
A document representing a potential line break. Behaves like space
if the break is omitted by a group.
A document representing a potential line break.
A document representing a potential line break. Behaves like empty
if the break is omitted by a group.
Return a document that pretty-prints a list in Scala notation, inserting line breaks between elements as necessary.
Return a document that pretty-prints a list in Scala notation,
inserting line breaks between elements as necessary.
The prefix
string can be changed from the default "List"
.
The elemToDoc
argument can be used to alter the way each element
is converted to a document (default: use the value
combinator).
sep
defaults to comma
.
A left parenthesis document.
A left parenthesis document.
Return a pretty-printer document for a separated sequence.
Return a pretty-printer document for a separated sequence.
sep
is the separator. Line breaks are allowed before the sequence
and after the separators between the elements of the sequence. The
before line break turns into nothing if omitted. The internal line
breaks turn into space
if omitted.
Return a pretty-printer document for a separated sequence.
Return a pretty-printer document for a separated sequence.
sep
is the separator. Line breaks are allowed before the separators
between the elements of the sequence and at the end. A space
is
inserted after each separator. The internal line breaks turn into
space
if omitted. The end line break turns into nothing if omitted.
Return a pretty-printer document for a sequence where each element
is terminated by term
.
Return a pretty-printer document for a sequence where each element
is terminated by term
. Line breaks are allowed before the sequence
and after the terminator between the elements of the sequence. The
before line break turns into nothing if omitted. The internal line
breaks turn into space
if omitted.
An minus sign document.
An minus sign document.
Nest a document by an indentation increment on top of the current nesting.
Nest a document by an indentation increment on top of the current nesting. In the paper version, the indentation parameter comes first, but we put it second here so that it can be given a default value.
Allow an updater to be used to access a parameterised state value.
Return a document that encloses a given document between left and right parentheses.
Return a document that encloses a given document between left and right parentheses.
A percent sign document.
A percent sign document.
Perform any pending updates, returning true if updates were performed and false otherwise.
Perform any pending updates, returning true if updates were performed and false otherwise. The updates are first checked for consistency. If the same piece of state is updated more than once, it must be updated to the same value by all updates. If updates are not consistent, the machine is aborted.
Return a document that pretty-prints a list of pretty-printables in Scala notation, inserting line breaks between elements as necessary.
Return a document that pretty-prints a list of pretty-printables
in Scala notation, inserting line breaks between elements as necessary.
The prefix
string can be changed from the default "List"
.
The elemToDoc
argument can be used to alter the way each element
is converted to a document (default: call the element's toDoc
method).
sep
defaults to a comma
.
An plus sign document.
An plus sign document.
Pretty print a document assuming a given output medium width.
Pretty print a document assuming a given output medium width. In the paper the width is the first parameter, but here we put it second so we can provide a default value.
Pretty-print a pretty-printable value.
Pretty-print a pretty-printable value. If the value passed is not a
pretty-printable document, it will be converted to one using the implicit
conversion anyToPrettyPrintable
.
Pretty-print any value using the any
method.
Pretty-print any value using the any
method.
A question mark document.
A question mark document.
A right angle bracket document.
A right angle bracket document.
A right brace document.
A right brace document.
A right square bracket document.
A right square bracket document.
Reset the machine to begin a step.
A right parenthesis document.
A right parenthesis document.
Run this machine by initialising its state and then executing its steps.
A semicolon document.
A semicolon document.
Return a document that concatenates the documents in the given sequence
either horizontally with <+>
if they fit in the output medium width,
or if not, vertically with <@>
.
Return a document that concatenates the documents in the given sequence
either horizontally with <+>
if they fit in the output medium width,
or if not, vertically with <@>
.
Return a document that behaves like empty
if the resulting output
fits the page, otherwise it behaves like line
.
Return a document that behaves like empty
if the resulting output
fits the page, otherwise it behaves like line
.
Return a document that behaves like space
if the resulting output
fits the page, otherwise it behaves like line
.
Return a document that behaves like space
if the resulting output
fits the page, otherwise it behaves like line
.
A space document.
A space document.
Return a document representing n
spaces if n
s greater than zero,
otherwise return an empty document.
Return a document representing n
spaces if n
s greater than zero,
otherwise return an empty document.
A single quote document.
A single quote document.
Return a document that encloses a given document between single quotes.
Return a document that encloses a given document between single quotes.
Return a document that concatenates the documents in the given sequence
and separates adjacent documents with sep
with no space around the
separator.
Return a document that concatenates the documents in the given sequence
and separates adjacent documents with sep
with no space around the
separator.
Implicitly allow a scalar state value of type T
to be used as a value
of type U
where U
is a supertype of T
.
Perform a step of this machine.
Perform a step of this machine. Return true if some updates were made or false if none.
Execute the steps of this machine.
Execute the steps of this machine. Halt when a step makes no
updates. init
should be called before this method.
Return a document that concatenates the documents in the given sequence
and terminates each document with term
.
Return a document that concatenates the documents in the given sequence
and terminates each document with term
.
Convert a string to a document.
Convert a string to a document. The string is allowed to contain
newline characters. If no newlines are included, it is best to
use text
directly instead.
Return a document that encloses a given document d
between two
occurrences of another document b
.
Return a document that encloses a given document d
between two
occurrences of another document b
.
Convert a string to a document.
Convert a string to a document. The string should not contain any
newline characters. Use line
instead.
A tilde document.
A tilde document.
An underscore document.
An underscore document.
Return a document representing a value formatted using toString
and
the string
combinator.
Return a document representing a value formatted using toString
and
the string
combinator. As a special case, if the value is a null
reference it is formatted as null
.
Return a document that concatenates the documents in the given sequence
vertically with <@@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@@>
.
A vertical bar document.
A vertical bar document.
Return a document that concatenates the documents in the given sequence
vertically with <@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@>
. Separates documents with the given separator
before the <@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@>
.
(Since version 1.2.1) Use PrettyPrinter.any instead.
A deterministic abstract state machine defined by its main rule and called
name
. Tracing messages are output to the given emitter, which defaults to standard output.