mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
on import completion preparations.
This commit is contained in:
@@ -104,6 +104,7 @@ class Parser(object):
|
|||||||
# and only if the refactor method's write parameter was True.
|
# and only if the refactor method's write parameter was True.
|
||||||
self.used_names = {}
|
self.used_names = {}
|
||||||
self.scope_names_stack = [{}]
|
self.scope_names_stack = [{}]
|
||||||
|
self.failed_statement_stacks = []
|
||||||
logger = logging.getLogger("Jedi-Parser")
|
logger = logging.getLogger("Jedi-Parser")
|
||||||
d = pgen2.Driver(grammar, self.convert_node,
|
d = pgen2.Driver(grammar, self.convert_node,
|
||||||
self.convert_leaf, self.error_recovery, logger=logger)
|
self.convert_leaf, self.error_recovery, logger=logger)
|
||||||
@@ -189,11 +190,10 @@ class Parser(object):
|
|||||||
if symbol in ('file_input', 'suite'):
|
if symbol in ('file_input', 'suite'):
|
||||||
index = i
|
index = i
|
||||||
break
|
break
|
||||||
self._stack_removal(stack, index + 1)
|
|
||||||
# No success finding a transition
|
# No success finding a transition
|
||||||
#raise ParseError("bad input", type, value, context)
|
self._stack_removal(grammar, stack, index + 1)
|
||||||
|
|
||||||
def _stack_removal(self, stack, start_index):
|
def _stack_removal(self, grammar, stack, start_index):
|
||||||
def clear_names(children):
|
def clear_names(children):
|
||||||
for c in children:
|
for c in children:
|
||||||
try:
|
try:
|
||||||
@@ -206,6 +206,16 @@ class Parser(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass # This may happen with CompFor.
|
pass # This may happen with CompFor.
|
||||||
|
|
||||||
|
failed_stack = []
|
||||||
|
found = False
|
||||||
|
for dfa, state, (typ, nodes) in stack[start_index:]:
|
||||||
|
if nodes:
|
||||||
|
found = True
|
||||||
|
if found:
|
||||||
|
symbol = grammar.number2symbol[typ]
|
||||||
|
failed_stack.append((symbol, nodes))
|
||||||
|
self.failed_statement_stacks.append(failed_stack)
|
||||||
|
|
||||||
for dfa, state, node in stack[start_index:]:
|
for dfa, state, node in stack[start_index:]:
|
||||||
clear_names(children=node[1])
|
clear_names(children=node[1])
|
||||||
|
|
||||||
|
|||||||
@@ -228,8 +228,7 @@ from import_tree import recurse_class1
|
|||||||
#? ['a']
|
#? ['a']
|
||||||
recurse_class1.C.a
|
recurse_class1.C.a
|
||||||
# github #239 RecursionError
|
# github #239 RecursionError
|
||||||
# TODO UNCOMMENT!!!!!!
|
#? ['a']
|
||||||
##? ['a']
|
|
||||||
recurse_class1.C().a
|
recurse_class1.C().a
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ def from_names():
|
|||||||
#? ['path']
|
#? ['path']
|
||||||
from os.
|
from os.
|
||||||
|
|
||||||
|
def from_names_goto():
|
||||||
|
from import_tree import pkg
|
||||||
|
#? pkg
|
||||||
|
from import_tree.pkg
|
||||||
|
|
||||||
def builtin_test():
|
def builtin_test():
|
||||||
#? ['math']
|
#? ['math']
|
||||||
import math
|
import math
|
||||||
|
|||||||
Reference in New Issue
Block a user