diff --git a/jedi/evaluate/compiled/fake.py b/jedi/evaluate/compiled/fake.py index 98ec049e..6084f573 100644 --- a/jedi/evaluate/compiled/fake.py +++ b/jedi/evaluate/compiled/fake.py @@ -9,8 +9,7 @@ import inspect import types from jedi._compatibility import is_py3, builtins, unicode, is_py34 -from jedi.parser import ParserWithRecovery -from jedi.parser.python import load_grammar +from jedi.parser.python import parse from jedi.parser import tree as pt modules = {} @@ -62,9 +61,7 @@ def _load_faked_module(module): except IOError: modules[module_name] = None return - grammar = load_grammar(version='3.4') - module = ParserWithRecovery(grammar, unicode(source), module_name).module - modules[module_name] = module + modules[module_name] = parse(unicode(source)) if module_name == 'builtins' and not is_py3: # There are two implementations of `open` for either python 2/3. diff --git a/jedi/evaluate/docstrings.py b/jedi/evaluate/docstrings.py index 68cec534..f2eb0457 100644 --- a/jedi/evaluate/docstrings.py +++ b/jedi/evaluate/docstrings.py @@ -22,8 +22,7 @@ from jedi._compatibility import u from jedi.common import unite from jedi.evaluate import context from jedi.evaluate.cache import memoize_default -from jedi.parser import ParserWithRecovery -from jedi.parser.python import load_grammar +from jedi.parser.python import parse from jedi.parser.tree import search_ancestor from jedi.common import indent_block from jedi.evaluate.iterable import SequenceLiteralContext, FakeSequence @@ -134,9 +133,9 @@ def _evaluate_for_statement_string(module_context, string): # Take the default grammar here, if we load the Python 2.7 grammar here, it # will be impossible to use `...` (Ellipsis) as a token. Docstring types # don't need to conform with the current grammar. - p = ParserWithRecovery(load_grammar(), code.format(indent_block(string))) + module = parse(code.format(indent_block(string))) try: - funcdef = p.module.subscopes[0] + funcdef = module.subscopes[0] # First pick suite, then simple_stmt and then the node, # which is also not the last item, because there's a newline. stmt = funcdef.children[-1].children[-1].children[-2]