smallpond

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/smallpond
Log | Files | Refs

commit 4bbcaa698e4c87ad55f961718945965e3d0faf50
parent ff4ce86c7afb809fa4ca0c30a37290e4e29f57e9
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Wed, 28 Sep 2022 14:54:48 -0500

put parser in loop, two staffs render now

Diffstat:
Msmallpond.lua | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/smallpond.lua b/smallpond.lua @@ -100,6 +100,7 @@ local commands = { if i >= #text then return nil end local cmd = string.match(text, "^\\(%a+)", i) if cmd == "end" then + i = i + 4 break end if cmd then @@ -147,16 +148,21 @@ local commands = { end voices[#voices + 1] = voice + return i end } function parse(text) local i = 1 - i = i + #(string.match(text, "^%s*", i) or "") - local cmd = string.match(text, "^\\(%a+)", i) - if cmd then - i = i + #cmd + 1 - i = commands[string.match(text, "\\(%a+)", start)](text, i) + + while true do + i = i + #(string.match(text, "^%s*", i) or "") + if i >= #text then return nil end + local cmd = string.match(text, "^\\(%a+)", i) + if cmd then + i = i + #cmd + 1 + i = commands[string.match(text, "\\(%a+)", start)](text, i) + end end end