Statifier.Document.If (Statifier v2.0.0)

Copy Markdown View Source

An <if> executable-content element (spec 4.3): the partitioned form of <if>/<elseif>/<else>, quoting spec 4.3.2 exactly:

The behavior of <if> is defined in terms of partitions of executable content. The first partition consists of the executable content between the <if> and the first <elseif>, <else> or </if> tag. Each <elseif> tag defines a partition that extends from it to the next <elseif>, <else> or </if> tag. The <else> tag defines a partition that extends from it to the closing </if> tag.

Statifier.Lowering.Builders.build_if/2 has already done this partitioning by the time a %Statifier.Document.If{} exists: branches is never the raw, unpartitioned child list <if> wrote in the source, it is the ordered [Statifier.Document.If.Branch.t()] list the fold over <elseif>/<else> boundaries produced. location is the <if> element's own span - the whole element, <if> through </if>.

Summary

Types

t()

@type t() :: %Statifier.Document.If{
  branches: [Statifier.Document.If.Branch.t()],
  location: Statifier.Parser.Location.t()
}