diff options
author | Martin Možina <martin.mozina@fri.uni-lj.si> | 2016-09-27 16:36:15 +0200 |
---|---|---|
committer | Martin Možina <martin.mozina@fri.uni-lj.si> | 2016-09-27 16:36:15 +0200 |
commit | 3f7538d784b24aa5305a228491efa4b68537a80f (patch) | |
tree | abbe0968308d48857570f74718d839f003fc402b /prolog | |
parent | 2013b5b59f2400ac3d4bf218a7ec5b1174f812d7 (diff) | |
parent | 28116fd8278bb3b8832f4f5b22c68bd7978c8efd (diff) |
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-server
Diffstat (limited to 'prolog')
-rw-r--r-- | prolog/util.py | 6 |
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): |