diff options
Diffstat (limited to 'rebuilder.py')
-rw-r--r-- | rebuilder.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/rebuilder.py b/rebuilder.py index 71276f2d..eb6495ad 100644 --- a/rebuilder.py +++ b/rebuilder.py @@ -22,9 +22,45 @@ order to get a single ASTNG representation from logilab.astng import ASTNGBuildingException, InferenceError from logilab.astng import nodes -from logilab.astng.utils import REDIRECT from logilab.astng.bases import YES, Instance +REDIRECT = {'arguments': 'Arguments', + 'Attribute': 'Getattr', + 'comprehension': 'Comprehension', + 'Call': 'CallFunc', + 'ClassDef': 'Class', + "ListCompFor": 'Comprehension', + "GenExprFor": 'Comprehension', + 'excepthandler': 'ExceptHandler', + 'Expr': 'Discard', + 'FunctionDef': 'Function', + 'GeneratorExp': 'GenExpr', + 'ImportFrom': 'From', + 'keyword': 'Keyword', + 'Repr': 'Backquote', + + 'Add': 'BinOp', + 'Bitand': 'BinOp', + 'Bitor': 'BinOp', + 'Bitxor': 'BinOp', + 'Div': 'BinOp', + 'FloorDiv': 'BinOp', + 'LeftShift': 'BinOp', + 'Mod': 'BinOp', + 'Mul': 'BinOp', + 'Power': 'BinOp', + 'RightShift': 'BinOp', + 'Sub': 'BinOp', + + 'And': 'BoolOp', + 'Or': 'BoolOp', + + 'UnaryAdd': 'UnaryOp', + 'UnarySub': 'UnaryOp', + 'Not': 'UnaryOp', + 'Invert': 'UnaryOp' + } + class RebuildVisitor(object): """Visitor to transform an AST to an ASTNG |