allow spans to be bounded by floats
This commit is contained in:
parent
31c9c0b5d5
commit
860088078d
|
@ -45,6 +45,14 @@ def beautify_lisp_string(in_string):
|
|||
return out_string
|
||||
|
||||
|
||||
# floating point ranges
|
||||
def frange(start, stop, step=1):
|
||||
i = start
|
||||
while i < stop:
|
||||
yield i
|
||||
i += step
|
||||
|
||||
|
||||
class HogDevice():
|
||||
# button state constants
|
||||
buttonDOWN = 1
|
||||
|
@ -115,15 +123,10 @@ class OscCommentMacroListener(CommentMacroListener):
|
|||
ctx.parentCtx.targets.append(ctx.value)
|
||||
|
||||
def exitSpan(self, ctx: CommentMacroParser.SpanContext):
|
||||
n1 = ctx.n1.value
|
||||
n2 = ctx.n2.value
|
||||
if (isinstance(n1, int) and isinstance(n2, int)):
|
||||
minimum = min(n1, n2)
|
||||
maximum = max(n1, n2)
|
||||
for i in (range(minimum, maximum + 1)):
|
||||
ctx.parentCtx.targets.append(i)
|
||||
else:
|
||||
logger.error("ERROR: Spans must be ranged with intigers.")
|
||||
minimum = min(ctx.n1.value, ctx.n2.value)
|
||||
maximum = max(ctx.n1.value, ctx.n2.value)
|
||||
for i in (frange(minimum, maximum + 1)):
|
||||
ctx.parentCtx.targets.append(i)
|
||||
|
||||
def exitMasterGo(self, ctx: CommentMacroParser.MasterGoContext):
|
||||
if ctx.target() is None:
|
||||
|
|
|
@ -61,7 +61,7 @@ that are implimented in python.
|
|||
| ----------------|-----|-----------|
|
||||
| fade times | t5 | no |
|
||||
| multiple targets | 1,2 | Yes |
|
||||
| ranges | 1>4 | Yes, integers only |
|
||||
| ranges | 1>4 | Yes, intervals of 1 |
|
||||
| multiple macros | GM1:GL3 | Yes |
|
||||
| network devices | h4 | Yes, H devices only |
|
||||
| wait times | WAIT1 | BaconScript only; Continue script after n seconds.
|
||||
|
|
Loading…
Reference in New Issue