Rename ast_mapping to node_map.

This commit is contained in:
Dave Halter
2017-03-20 08:55:18 +01:00
parent 2d7fd30111
commit c6811675b6
2 changed files with 4 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ class ParserSyntaxError(Exception):
class BaseParser(object):
ast_mapping = {}
node_map = {}
default_node = tree.Node
def __init__(self, grammar, start_symbol='file_input', error_recovery=False):
@@ -66,7 +66,7 @@ class BaseParser(object):
# TODO REMOVE symbol, we don't want type here.
symbol = grammar.number2symbol[type]
try:
return self.ast_mapping[symbol](children)
return self.node_map[symbol](children)
except KeyError:
return self.default_node(symbol, children)

View File

@@ -8,7 +8,7 @@ from jedi.parser.parser import BaseParser
class Parser(BaseParser):
ast_mapping = {
node_map = {
'expr_stmt': tree.ExprStmt,
'classdef': tree.Class,
'funcdef': tree.Function,
@@ -86,7 +86,7 @@ class Parser(BaseParser):
# TODO REMOVE symbol, we don't want type here.
symbol = grammar.number2symbol[type]
try:
return self.ast_mapping[symbol](children)
return self.node_map[symbol](children)
except KeyError:
if symbol == 'suite':
# We don't want the INDENT/DEDENT in our parser tree. Those