diff options
-rw-r--r-- | monkey/edits.py | 2 | ||||
-rw-r--r-- | prolog/util.py | 11 |
2 files changed, 1 insertions, 12 deletions
diff --git a/monkey/edits.py b/monkey/edits.py index 56bf773..0f3a3e4 100644 --- a/monkey/edits.py +++ b/monkey/edits.py @@ -18,7 +18,7 @@ import collections import math from .action import expand, parse -from prolog.util import normalized, parse as prolog_parse, rename_vars_ast, rename_vars_list, interesting_ranges, stringify, tokenize +from prolog.util import parse as prolog_parse, rename_vars_ast, rename_vars_list, interesting_ranges, stringify, tokenize from .util import avg, logistic def get_edits_from_trace(trace, test, id): diff --git a/prolog/util.py b/prolog/util.py index 644080d..e682edb 100644 --- a/prolog/util.py +++ b/prolog/util.py @@ -155,17 +155,6 @@ def interesting_ranges(ast, path=()): if isinstance(subtree, Tree): yield from interesting_ranges(subtree, path + (ast.label(),)) -# Helper function to remove trailing punctuation from lines and rename -# variables to A1,A2,A3,… (potentially using [var_names]). Return a tuple. -def normalized(line, var_names=None): - # Remove trailing punctuation. - i = len(line) - while i > 0: - if line[i-1].type not in ('COMMA', 'PERIOD', 'SEMI'): - break - i -= 1 - return tuple(rename_vars(line[:i], var_names)) - # Map "formal" variable names in the edit a→b to actual names in code [tokens]. # The set [variables] contains all variable names in the current scope. These # are used in cases such as [A]→[A,B], where the edit introduces new variables. |