1
0
forked from VimPlug/jedi

Name in statement definition implementation.

This commit is contained in:
Dave Halter
2014-10-13 13:33:49 +02:00
parent 0def3afaaa
commit 6458047bac
2 changed files with 29 additions and 15 deletions

View File

@@ -45,19 +45,6 @@ python_grammar_no_print_statement = python_grammar.copy()
del python_grammar_no_print_statement.keywords["print"]
from jedi.parser import representation as pr
_ast_mapping = {
'simple_stmt': pr.ExprStmt,
'classdef': pr.Class,
'funcdef': pr.Function,
'file_input': pr.SubModule,
'import_name': pr.Import,
'import_from': pr.Import,
}
ast_mapping = dict((getattr(python_symbols, k), v) for k, v in _ast_mapping.items())
def type_repr(type_num):
global _type_reprs
if not _type_reprs:
@@ -147,6 +134,20 @@ def convert(grammar, raw_node):
grammar rule produces a new complete node, so that the tree is build
strictly bottom-up.
"""
from jedi.parser import representation as pr
_ast_mapping = {
'simple_stmt': pr.ExprStmt,
'classdef': pr.Class,
'funcdef': pr.Function,
'file_input': pr.SubModule,
'import_name': pr.Import,
'import_from': pr.Import,
}
ast_mapping = dict((getattr(python_symbols, k), v) for k, v in _ast_mapping.items())
#import pdb; pdb.set_trace()
type, value, context, children = raw_node
if type in grammar.number2symbol: