summaryrefslogtreecommitdiffstats
path: root/printing_templates
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-12-12 17:20:00 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-17 13:03:56 -0800
commit0310eb31da6f58741189d43f0397c083752caab3 (patch)
treedcffbaa3112fa2275b5c41f4d67c7089fe40b2e2 /printing_templates
parentf42a70586be15fcbb0f82260bd6774572cd375d2 (diff)
downloadsubsurface-0310eb31da6f58741189d43f0397c083752caab3.tar.gz
printing: refactor if and loop code
The loop code was buggy: the current position was only increased inside when executing the loop once. This would obviously fail for empty lists. Moreover, the whole thing was quite difficult to reason about, since a reference to the current position was passed down in the call hierarchy. Instead, pass from and to values to the parse function and create a generic function that can search for the end of loop and if blocks. This function handles nested if and for loops. The if-code now formats the block only if the condition is true. The old code would format the block and throw it away if not needed. This should now provide better diagnostics for mismatched tags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'printing_templates')
0 files changed, 0 insertions, 0 deletions