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