Add variable repetition count support
This patch makes it possible to do this:
{meow = 23}
aa <lbl> bb (cc dd) * {9 * meow + lbl} ff
The repetition count expression cannot refer to a "future" label name,
to an inner label name, or to any variable of which the value was
computed using, directly or indirectly, one of those labels.
For example, this is invalid:
aa
{meow = mix}
{zoom = meow}
bb * {zoom}
<mix>
However this is valid:
aa
{meow = mix}
{zoom = meow}
{meow = 23}
bb * {meow}
<mix>
An interesting side effect of this feature is to make Normand support
conditional sections by using zero vs. one repetition:
(
<beg>
aa bb cc dd
<end>
{include = int(beg >= 4 * (end - beg))}
(11 22 33 44) * {include}
) * 10
Result:
aa bb cc dd aa bb cc dd aa bb cc dd aa bb cc dd ┆ ••••••••••••••••
aa bb cc dd 11 22 33 44 aa bb cc dd 11 22 33 44 ┆ •••••"3D•••••"3D
aa bb cc dd 11 22 33 44 aa bb cc dd 11 22 33 44 ┆ •••••"3D•••••"3D
aa bb cc dd 11 22 33 44 aa bb cc dd 11 22 33 44 ┆ •••••"3D•••••"3D
This becomes interesting with externally-provided variables, for
example:
aa bb cc dd
(beef) * {has_beef}
"salut"
You may include or exclude the `be ef` bytes with `--var=has_beef=1` and
`--var=has_beef=0` (or the equivalent API way).
Also update the `README.adoc` usage and examples.
Change-Id: I8cd8aa7078cbe48038b00c541aa40a067c9f79bf
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.02404 seconds and 4 git commands to generate.