Empty replacements for patterns now work.
This commit is contained in:
parent
1655160113
commit
107f295d7e
4
modal.py
4
modal.py
|
@ -125,8 +125,6 @@ def apply(queue, rules, pattern, replacement):
|
||||||
if not pattern:
|
if not pattern:
|
||||||
return (False, roll(queue))
|
return (False, roll(queue))
|
||||||
replacement = construct(replacement, context)
|
replacement = construct(replacement, context)
|
||||||
if not replacement:
|
|
||||||
return (False, roll(queue))
|
|
||||||
return (True, enqueue(dequeue(queue, len(pattern)), replacement))
|
return (True, enqueue(dequeue(queue, len(pattern)), replacement))
|
||||||
|
|
||||||
def define(queue, rules, pattern):
|
def define(queue, rules, pattern):
|
||||||
|
@ -305,7 +303,7 @@ def run(rules, queue, limit=pow(2, 32)):
|
||||||
result, queue = operation(queue, rules, pattern, *parameters)
|
result, queue = operation(queue, rules, pattern, *parameters)
|
||||||
if result == True:
|
if result == True:
|
||||||
failures = 0
|
failures = 0
|
||||||
print("<>: ", inspect(seek(queue, ["SRT"])))
|
#print("<>: ", inspect(seek(queue, ["SRT"])))
|
||||||
#print("<>: ", inspect(queue))
|
#print("<>: ", inspect(queue))
|
||||||
#input()
|
#input()
|
||||||
steps = steps + 1
|
steps = steps + 1
|
||||||
|
|
Loading…
Reference in New Issue