This PR stores tags encountered during parsing so we can use it during serialization. A block body has many (zero or more) tags and each tags also recursively has zero or one block body.
For example, consider this liquid code:
{% assign test = true %}
{% if test %}
Hello
{% else %}
Goodbye
{% endif %}
It would generate a structure that looks like the following:
Block body (body: "")
|-> Tag markup (tag_name: "assign", markup: "test = true")
|-> Tag markup (tag_name: "if", markup: "test")
|-> Block body (body: "Hello")
|-> Tag markup (tag_name: "else", markup: "")
|-> Block body (body: "Goodbye")
This PR also changes how tag objects (not to be confused with the tag markup) are stored. They are no longer pushed into the array of constants (since we don't want to serialize it) and instead written to a separate buffer that doesn't get serialized. Then during serialization, we serialize the tag markup, and upon deserialization we re-parse the tag markup into a tag object.
Based on #135 and Shopify/liquid#1380.
This PR stores tags encountered during parsing so we can use it during serialization. A block body has many (zero or more) tags and each tags also recursively has zero or one block body.
For example, consider this liquid code:
It would generate a structure that looks like the following:
This PR also changes how tag objects (not to be confused with the tag markup) are stored. They are no longer pushed into the array of constants (since we don't want to serialize it) and instead written to a separate buffer that doesn't get serialized. Then during serialization, we serialize the tag markup, and upon deserialization we re-parse the tag markup into a tag object.