Determines the white space between two adjacent tokens.
Shared by Tptp.Printer.Canonical and Tptp.Printer.Pretty, so that both apply
the same rules and the pretty printer's token sequence remains that of the
canonical printer.
The rules are positional rather than syntactic, since a token pair is all that is available: no space precedes a closing delimiter or a separator, none follows an opening delimiter, and none precedes an opening delimiter that follows a word or a prefix operator. A single space is emitted elsewhere.
A space is never omitted where its absence would combine two tokens into a third under the lexer's longest-match rule.
Summary
Functions
Join tokens into iodata, spacing them.
Whether two adjacent tokens need a space between them.
Functions
Join tokens into iodata, spacing them.
iex> Tptp.Printer.Spacing.join(["p", "(", "a", ",", "b", ")"]) |> IO.iodata_to_binary()
"p(a, b)"
iex> Tptp.Printer.Spacing.join(["~", "p", "|", "q"]) |> IO.iodata_to_binary()
"~p | q"
Whether two adjacent tokens need a space between them.
iex> Tptp.Printer.Spacing.space?("~", "|")
true
iex> Tptp.Printer.Spacing.space?("~", "p")
false