1
0
Fork 0

cleanup span calculation

This commit is contained in:
Kevin Matz 2018-10-29 17:19:18 -10:00
parent 860088078d
commit bc1e5920db
1 changed files with 5 additions and 12 deletions

View File

@ -45,14 +45,6 @@ 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
@ -123,10 +115,11 @@ class OscCommentMacroListener(CommentMacroListener):
ctx.parentCtx.targets.append(ctx.value)
def exitSpan(self, ctx: CommentMacroParser.SpanContext):
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)
lower = min(ctx.n1.value, ctx.n2.value)
upper = max(ctx.n1.value, ctx.n2.value)
while lower <= upper:
ctx.parentCtx.targets.append(lower)
lower += 1
def exitMasterGo(self, ctx: CommentMacroParser.MasterGoContext):
if ctx.target() is None: