From b6ebb2f8bfdab3d04185b7f4458a940e6ae426ab Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 27 Apr 2015 21:42:40 +0200 Subject: [PATCH] Fixed issues with last positions in the tokenizer, which was messed up a little bit a few commits ago. --- jedi/parser/tokenize.py | 8 +++++--- test/test_parser/test_fast_parser.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/jedi/parser/tokenize.py b/jedi/parser/tokenize.py index dc6aa3b4..762f630c 100644 --- a/jedi/parser/tokenize.py +++ b/jedi/parser/tokenize.py @@ -282,7 +282,9 @@ def generate_tokens(readline): paren_level -= 1 yield OP, token, spos, prefix + end_pos = (lnum, max - 1) + # As the last position we just take the maximally possible position. We + # remove -1 for the last new line. for indent in indents[1:]: - yield DEDENT, '', (lnum, max), '' - # As the last position we just take the max possible. - yield ENDMARKER, '', (lnum, max), prefix + yield DEDENT, '', end_pos, '' + yield ENDMARKER, '', end_pos, prefix diff --git a/test/test_parser/test_fast_parser.py b/test/test_parser/test_fast_parser.py index ef00189b..4d1f5f22 100644 --- a/test/test_parser/test_fast_parser.py +++ b/test/test_parser/test_fast_parser.py @@ -430,11 +430,11 @@ def test_incomplete_function(): def test_string_literals(): """Simplified case of jedi-vim#377.""" source = dedent(""" - x = ur''' ''' + x = ur''' def foo(): pass - x""") + """) script = jedi.Script(dedent(source)) assert script.completions()