summaryrefslogtreecommitdiff
path: root/prolog
diff options
context:
space:
mode:
authorMartin Možina <martin.mozina@fri.uni-lj.si>2016-09-27 16:36:15 +0200
committerMartin Možina <martin.mozina@fri.uni-lj.si>2016-09-27 16:36:15 +0200
commit3f7538d784b24aa5305a228491efa4b68537a80f (patch)
treeabbe0968308d48857570f74718d839f003fc402b /prolog
parent2013b5b59f2400ac3d4bf218a7ec5b1174f812d7 (diff)
parent28116fd8278bb3b8832f4f5b22c68bd7978c8efd (diff)
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-server
Diffstat (limited to 'prolog')
-rw-r--r--prolog/util.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/prolog/util.py b/prolog/util.py
index e1ce36b..402b920 100644
--- a/prolog/util.py
+++ b/prolog/util.py
@@ -144,6 +144,12 @@ def rename_vars_ast(root, fixed_names=None):
# Yield "interesting" parts of a Prolog AST as lists of tokens.
def interesting_ranges(ast, path=()):
if ast.label() in {'clause', 'head', 'or', 'if', 'and'}:
+ if ast.label() == 'clause':
+ # Special case for clause with one goal.
+ if len(ast) == 4 and ast[2].label() == 'term':
+ terminals = ast[2].leaves()
+ yield terminals, path + (ast.label(), 'and')
+
if ast.label() == 'and':
for i in range(0, len(ast), 2):
for j in range(i, len(ast), 2):