Empty replacements for patterns now work.

This commit is contained in:
Devine Lu Linvega 2024-04-02 21:28:09 -07:00
parent 1655160113
commit 107f295d7e
1 changed files with 1 additions and 3 deletions

View File

@ -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