# `Tptp.Printer.Spacing`
[🔗](https://github.com/jcschuster/tptp/blob/v0.1.3/lib/tptp/printer/spacing.ex#L1)

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.

# `join`

```elixir
@spec join([binary()]) :: iodata()
```

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"

# `space?`

```elixir
@spec space?(binary(), binary()) :: boolean()
```

Whether two adjacent tokens need a space between them.

    iex> Tptp.Printer.Spacing.space?("~", "|")
    true
    iex> Tptp.Printer.Spacing.space?("~", "p")
    false

---

*Consult [api-reference.md](api-reference.md) for complete listing*
