From dad5ec8cd88cd4b71c0f1b8b95eb276e6711c0dd Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 8 May 2014 14:58:27 +0200 Subject: Use immutable values in queue --- prolog/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prolog/util.py b/prolog/util.py index f5d1865..4826f86 100644 --- a/prolog/util.py +++ b/prolog/util.py @@ -41,14 +41,14 @@ def decompose(code): for t in tokens: if t[0] == 'SEMI': if line != []: - lines.append(line[:]) + lines.append(tuple(line)) line = [] - lines.append([t]) + lines.append((t,)) continue if not parens: if t[0] in ('PERIOD', 'FROM', 'COMMA', 'EOF'): if line != []: - lines.append(line[:]) + lines.append(tuple(line)) line = [] if t[0] in ('PERIOD', 'EOF') and rule_start < len(lines): rules.append((rule_start, len(lines))) @@ -64,7 +64,7 @@ def decompose(code): elif t[0] == 'RBRACE' and parens[-1] == 'LBRACE': parens.pop() line.append(t) - return lines, rules + return tuple(lines), tuple(rules) # pretty-print a list of rules def compose(lines, rules): -- cgit v1.2.1