From 17122ed518036876d0ea72b3129b677f9d24e752 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 8 Dec 2007 21:48:28 -0500 Subject: [PATCH] Fix bug in include_adjacent=True handling when next to non-symbol --- lib/reinteract/tokenized_statement.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/reinteract/tokenized_statement.py b/lib/reinteract/tokenized_statement.py index dff1579..80b594b 100644 --- a/lib/reinteract/tokenized_statement.py +++ b/lib/reinteract/tokenized_statement.py @@ -447,15 +447,21 @@ class TokenizedStatement(object): # that list of names against the scope iter = self._get_iter(line, index) + if iter != None and not (iter.token_type == TOKEN_KEYWORD or + iter.token_type == TOKEN_NAME or + iter.token_type == TOKEN_BUILTIN_CONSTANT): + iter = None + if iter == None and include_adjacent and index > 0: iter = self._get_iter(line, index - 1) + + if iter != None and not (iter.token_type == TOKEN_KEYWORD or + iter.token_type == TOKEN_NAME or + iter.token_type == TOKEN_BUILTIN_CONSTANT): + iter = None + if iter == None: return NO_RESULT - - if not (iter.token_type == TOKEN_KEYWORD or - iter.token_type == TOKEN_NAME or - iter.token_type == TOKEN_BUILTIN_CONSTANT): - return NO_RESULT start_index = iter.start end_index = iter.end -- 2.11.4.GIT