Added support for cycles in new repeat syntax
This commit is contained in:
@ -345,6 +345,8 @@ class Sequence(Meta):
|
|||||||
yield from _normal_repeat(item.evaluated_values, repeats, options)
|
yield from _normal_repeat(item.evaluated_values, repeats, options)
|
||||||
elif isinstance(item, RepeatedListSequence):
|
elif isinstance(item, RepeatedListSequence):
|
||||||
repeats = item.repeats.get_value(options)
|
repeats = item.repeats.get_value(options)
|
||||||
|
if isinstance(repeats, Pitch):
|
||||||
|
repeats = repeats.get_value(options)
|
||||||
yield from _generative_repeat(item, repeats, options)
|
yield from _generative_repeat(item, repeats, options)
|
||||||
elif isinstance(item, Subdivision):
|
elif isinstance(item, Subdivision):
|
||||||
item.evaluate_values(options)
|
item.evaluate_values(options)
|
||||||
@ -737,7 +739,7 @@ class Cyclic(Item):
|
|||||||
text = text + self.wrap_end
|
text = text + self.wrap_end
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def get_value(self):
|
def get_value(self, options=None):
|
||||||
"""Get the value for the current cycle"""
|
"""Get the value for the current cycle"""
|
||||||
value = self.values[self.cycle % len(self.values)]
|
value = self.values[self.cycle % len(self.values)]
|
||||||
self.cycle += 1
|
self.cycle += 1
|
||||||
|
|||||||
@ -382,4 +382,4 @@ class ZiffersTransformer(Transformer):
|
|||||||
return RepeatedSequence(values=items[0], repeats=Integer(value=2, text="2"))
|
return RepeatedSequence(values=items[0], repeats=Integer(value=2, text="2"))
|
||||||
|
|
||||||
def repeat_item(self, items):
|
def repeat_item(self, items):
|
||||||
return RepeatedListSequence(values=[items[0]],repeats=items[1])
|
return RepeatedListSequence(values=[items[0]],repeats=items[1], wrap_start="", wrap_end=":"+items[1].text)
|
||||||
Reference in New Issue
Block a user