diff options
Diffstat (limited to 'prolog')
-rw-r--r-- | prolog/util.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/prolog/util.py b/prolog/util.py index 7fb81e3..c762f23 100644 --- a/prolog/util.py +++ b/prolog/util.py @@ -66,13 +66,15 @@ def decompose(code): rule_start = 0 for t in tokens: if t.type == 'SEMI': - if line != []: + if line: lines.append(tuple(line)) line = [] lines.append((t,)) continue if not parens: if t.type in ('PERIOD', 'FROM', 'COMMA', 'EOF'): + if t.type == 'FROM': + line.append(t) if line != []: lines.append(tuple(line)) line = [] @@ -104,7 +106,7 @@ def compose(lines, rules): if i == end-1: code += '.\n' elif i == start: - code += ' :-\n' + code += '\n' else: if line and line[-1].type != 'SEMI' and lines[i+1][-1].type != 'SEMI': code += ',' |