def resolve(self, list): if len(list) == 2 and 'funcdef' in list and 'assign' in list: return 'funcdef' if 'grammar' in list and 'expr' in list: return 'expr' #print >> sys.stderr, 'resolve', str(list) return GenericASTBuilder.resolve(self, list)
def resolve(self, list): if len(list) == 2 and "funcdef" in list and "assign" in list: return "funcdef" if "grammar" in list and "expr" in list: return "expr" # print >> sys.stderr, 'resolve', str(list) return GenericASTBuilder.resolve(self, list)
def nonterminal(self, type, args): # # Flatten AST a bit by not making nodes if there's only # one child. # if len(args) == 1: return args[0] return GenericASTBuilder.nonterminal(self, type, args)
def nonterminal(self, nt, args): collect = ('stmts', 'exprlist', 'kvlist') if nt in collect and len(args) > 1: rv = args[0] rv.append(args[1]) else: rv = GenericASTBuilder.nonterminal(self, nt, args) return rv
def nonterminal(self, nt, args): collect = ('stmts', 'exprlist', 'kvlist', '_stmts', 'print_items') if nt in collect and len(args) > 1: # # Collect iterated thingies together. # rv = args[0] rv.append(args[1]) else: rv = GenericASTBuilder.nonterminal(self, nt, args) return rv
def nonterminal(self, nt, args): collect = ("stmts", "exprlist", "kvlist", "_stmts", "print_items") if nt in collect and len(args) > 1: # # Collect iterated thingies together. # rv = args[0] rv.append(args[1]) else: rv = GenericASTBuilder.nonterminal(self, nt, args) return rv
def nonterminal(self, nt, args): collect = ('stmts', 'exprlist', 'kvlist') if nt in collect and len(args) > 1: # # Collect iterated thingies together. # rv = args[0] rv.append(args[1]) else: rv = GenericASTBuilder.nonterminal(self, nt, args) return rv
def nonterminal(self, type, args): if len(args) == 1: return args[0] return GenericASTBuilder.nonterminal(self, type, args)
def __init__(self): GenericASTBuilder.__init__(self, AST, 'stmts') self.customized = {}
def __init__(self): GenericASTBuilder.__init__(self, AST, 'code') self.customized = {}
def __init__(self, AST, start='expr'): GenericASTBuilder.__init__(self, AST, start)
def resolve(self, list): if len(list) == 2 and 'funcdef' in list and 'assign' in list: return 'funcdef' #sys.stderr.writelines( ['resolve ', str(list), '\n'] ) return GenericASTBuilder.resolve(self, list)
def __ambiguity(self, children): # only for debugging! to be removed hG/2000-10-15 print children return GenericASTBuilder.ambiguity(self, children)
def __init__(self): GenericASTBuilder.__init__(self, AST, "file")
def __init__(self, ASTclass, start='top'): GenericASTBuilder.__init__(self, ASTclass, start)
def __ambiguity(self, children): print children return GenericASTBuilder.ambiguity(self, children)
def resolve(self, list): if len(list) == 2 and 'funcdef' in list and 'assign' in list: return 'funcdef' return GenericASTBuilder.resolve(self, list)
def __init__(self, AST, start='func_list'): GenericASTBuilder.__init__(self, AST, start)
def __init__(self): GenericASTBuilder.__init__(self, AST, "stmts") self.customized = {}