commit 8fac6237279b5b44b5321a19fbef60fe8971c069
parent 58afb414d87359b7ae7a5d74c955e39baf6e7429
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Sat, 1 Oct 2022 11:11:52 -0500
accept any power of 2 as a count
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/smallpond.lua b/smallpond.lua
@@ -132,9 +132,11 @@ local commands = {
end
-- TODO: should we be more strict about accidentals and stem orientations on rests?
- local s, e, note, acc, flags, count = string.find(text, "^([abcdefgs])([fns]?)([v^]?)([1248])", i)
+ local s, e, note, acc, flags, count = string.find(text, "^([abcdefgs])([fns]?)([v^]?)(%d+)", i)
if note then
i = i + e - s + 1
+ -- make sure that count is a power of 2
+ assert(math.ceil(math.log(count)/math.log(2)) == math.floor(math.log(count)/math.log(2)), "note count is not a power of 2")
local out
if note == 's' then
out = {command='srest', count=tonumber(count)}