From 1a3cca6edbf55e850f01a8d830067458f8410f69 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 26 Feb 2014 11:23:45 +0100 Subject: [PATCH] fixed a problem with the fast parser and its strange end positions --- jedi/parser/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jedi/parser/__init__.py b/jedi/parser/__init__.py index 31800a3f..346bd0dc 100644 --- a/jedi/parser/__init__.py +++ b/jedi/parser/__init__.py @@ -75,7 +75,7 @@ class Parser(object): # This case is only relevant with the FastTokenizer, because # otherwise there's always an EndMarker. # we added a newline before, so we need to "remove" it again. - self.module.end_pos = self._gen.previous.end_pos + self.module.end_pos = self._gen.tokenizer_previous.end_pos del self._gen @@ -619,3 +619,11 @@ class PushBackTokenizer(object): def __iter__(self): return self + + @property + def tokenizer_previous(self): + """ + Temporary hack, basically returns the last previous if the fast parser + sees an EndMarker. The fast parser positions have to be changed anyway. + """ + return self._tokenizer.previous