1
0
forked from VimPlug/jedi

Add a latest grammar to the evaluator and use it to avoid importing from parso import parse.

This commit is contained in:
Dave Halter
2017-05-24 00:37:36 -04:00
parent b90589b62e
commit cd8932fbfc
10 changed files with 31 additions and 26 deletions

View File

@@ -117,10 +117,11 @@ from ast import literal_eval
from io import StringIO
from functools import reduce
import parso
import jedi
from jedi import debug
from jedi._compatibility import unicode, is_py3
from parso.python import parse
from jedi.api.classes import Definition
from jedi.api.completion import get_user_scope
from jedi import parser_utils
@@ -132,6 +133,9 @@ TEST_ASSIGNMENTS = 2
TEST_USAGES = 3
grammar36 = parso.load_python_grammar('3.6')
class IntegrationTestCase(object):
def __init__(self, test_type, correct, line_nr, column, start, line,
path=None, skip=None):
@@ -188,7 +192,7 @@ class IntegrationTestCase(object):
should_be = set()
for match in re.finditer('(?:[^ ]+)', correct):
string = match.group(0)
parser = parse(string, start_symbol='eval_input', error_recovery=False)
parser = grammar36.parse(string, start_symbol='eval_input', error_recovery=False)
parser_utils.move(parser.get_root_node(), self.line_nr)
element = parser.get_root_node()
module_context = script._get_module()