Walks the merge fields of a document part and turns them into statements.
Fields are consumed one at a time; block statements consume everything up to
their end field, which is how nesting falls out naturally. Adjacent blocks of
an if/elsIf/else chain share their delimiting fields: the else field
ends one block and starts the next.
Summary
Functions
Consumes the next field and builds its statement.
Consumes fields until end_expression is reached and returns the enclosed block.
Like consume_block/2 but splits the region at every field matching one of
sub_expr_patterns, returning one block per clause.
Creates a construction state for fields.
Builds every statement the fields describe.
Types
Functions
Consumes the next field and builds its statement.
allow_insertion is false while collecting the body of a block: the fields
inside it are re-parsed for every copy, so building insertion statements for
the original nodes would render them twice.
@spec consume_block(t(), binary()) :: {Sablon.Processor.Document.Block.t(), t()}
Consumes fields until end_expression is reached and returns the enclosed block.
@spec consume_multi_block(t(), binary(), [Regex.t()]) :: {[Sablon.Processor.Document.Block.t()], t()}
Like consume_block/2 but splits the region at every field matching one of
sub_expr_patterns, returning one block per clause.
Creates a construction state for fields.
Builds every statement the fields describe.