#!/usr/bin/env python3 # dictionary che raccoglie tutti i tipi che vengono parserati da ast e ne restituisce le funzioni che quel tipo deve eseguire # tuple, contengono funzioni: cercare in prondita' o caricando valori foglia dell'albero, chiare le funzioni di traduttore musicale class function_node(): typeOfNode = { 'ast.Num' : ('node.n',), 'ast.Str' : ('node.s',), 'ast.FormattedValues' : ('node.value',), 'ast.JoinedStr' : ('node.values',), 'ast.Bytes' : ('node.s',), 'ast.List' : ('node.elts',), 'ast.Tuple' : ('node.elts',), 'ast.Set' : ('node.elts',), 'ast.Dict' : ('node.keys',), 'ast.NameConstant' : ('node.value',), 'ast.Name' : ('node.id',), 'ast.Starred' : ('node.value',), 'ast.Expr' : ('node.value',), 'ast.UnaryOP' : ('node.operand',), 'ast.BinOp' : ('[node.left, node.right]',), 'ast.BoolOP' : ('[node.op, node.values]',), 'ast.Compare' : ('[node.left, node.ops, node.comparators]',), 'ast.Call' : ('[node.func, node.args, node.keywords]',), 'ast.keyword' : ('[node.arg, node.value]',), 'ast.ifExp' : ('[node.test, node.body, node.orelse]',), 'ast.Attribute' : ('[node.attr, node.value]',), 'ast.Subscript' : ('[node.slice, node.value]',), 'ast.Index' : ('node.value',), 'ast.Slice' : ('[node.lower, node.upper, node.step]',), 'ast.ExtSlice' : ('node.dims',), 'ast.ListCompe' : ('[node.generators, node.elt]',), 'ast.SetCompe' : ('[node.generators, node.elt]',), 'ast.GeneratorExp' : ('[node.generators, node.elt]',), 'ast.DictComp' : ('[node.key, node.value, node.generator]',), 'ast.comprehension' : ('[node.target, node.iter, node.ifs]',), 'ast.Assign' : ('[node.targets, node.value]',), 'ast.AnnAssign' : ('[node.targets, node.target, node.value, node.simple]',), 'ast.AugAssign' : ('[node.targets, node.op, node.value]',), 'ast.Print' : ('[node.dest, node.values]',), 'ast.Raise' : ('[node.exc, node.cause]',), 'ast.Assert' : ('[node.test, node.msg]',), 'ast.Delete' : ('node.targets',), 'ast.Import' : ('node.names',), 'ast.ImportFrom' : ('[node.module, node.names, node.level]',), 'ast.Alias' : ('node.name',), 'ast.If' : ('[node.test, node.body, node.orelse]',), 'ast.For' : ('[node.target, node.iter, node.body, node.orelse]',), 'ast.While' : ('[node.test, node.body, node.orelse]',), 'ast.Try' : ('[node.handlers, node.body, node.orelse, node.finalbody]',), 'ast.TryFinally' : ('[node.body, node.finalbody]',), 'ast.TryExcept' : ('[node.handlers, node.body, node.orelse]',), 'ast.ExceptHandler' : ('[node.type, node.name, node.body]',), 'ast.With' : ('[node.items, node.body]',), 'ast.withitem' : ('[node.context_expr]',), 'ast.FunctionDef' : ('[node.name, node.args, node.body, node.decorator_list]',), 'ast.Lambda' : ('[node.args, node.body]',), 'ast.arguments' : ('[node.args, node.default]',), 'ast.arg' : ('[node.arg, node.annotation]',), 'ast.Return' : ('node.value',), 'ast.Yield' : ('node.value',), 'ast.YieldFrom' : ('node.value',), 'ast.Global' : ('node.names',), 'ast.Nonlocal' : ('node.names',), 'ast.ClassDef' : ('[node.name, node.bases, node.keywords, node.starargs, node.body, , node.kwargs, node.decorator_list]','armonia(store.get_nota())'), 'ast.Await' : ('node.value',), 'ast.AsyncFunctionDef' : ('[node.name, node.args, node.body, node.decorator_list, node.returns]',), 'ast.AsyncFor' : ('[node.target, node.iter, node.body, node.orelse]',), 'ast.AsyncWith' : ('[node.items, node.body]',), 'ast.Module' : ('node.body', 'nota()'), }