From dd85fc6ffda1d91407a7b6499790f02e63fb35d5 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 5 Jun 2016 14:49:57 +0200 Subject: [PATCH] Add error token in a normal way to the syntax tree as ErrorLeaf. --- jedi/parser/__init__.py | 3 --- jedi/parser/tree.py | 2 +- test/test_parser/test_fast_parser.py | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jedi/parser/__init__.py b/jedi/parser/__init__.py index f9fbd03c..f5a49b0e 100644 --- a/jedi/parser/__init__.py +++ b/jedi/parser/__init__.py @@ -499,9 +499,6 @@ class ParserWithRecovery(Parser): self._indent_counter -= 1 elif typ == INDENT: self._indent_counter += 1 - elif typ == ERRORTOKEN: - self._add_syntax_error('Strange token', start_pos) - continue yield typ, value, prefix, start_pos diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index d6f18ec1..08a845eb 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -650,7 +650,7 @@ class ErrorNode(BaseNode): type = 'error_node' -class ErrorLeaf(Leaf): +class ErrorLeaf(LeafWithNewLines): """ TODO doc """ diff --git a/test/test_parser/test_fast_parser.py b/test/test_parser/test_fast_parser.py index 56a783f8..173c3d8e 100644 --- a/test/test_parser/test_fast_parser.py +++ b/test/test_parser/test_fast_parser.py @@ -440,6 +440,7 @@ def test_string_literals(): """) script = jedi.Script(dedent(source)) + script._parser.module().end_pos == (6, 0) assert script.completions()