summaryrefslogtreecommitdiff
path: root/prolog/util.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2014-05-08 14:58:27 +0200
committerAleš Smodiš <aless@guru.si>2015-08-11 14:26:00 +0200
commitdad5ec8cd88cd4b71c0f1b8b95eb276e6711c0dd (patch)
treeb4e6283ead8e513e7abf6a3efe40f17904516bd3 /prolog/util.py
parent9028da620a2c059548300c3071f61511d4b63943 (diff)
Use immutable values in queue
Diffstat (limited to 'prolog/util.py')
-rw-r--r--prolog/util.py8
1 files 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):