bepeephole: Inline be_peephole_new_node() into its only caller.
[libfirm] / scripts / filters.py
1 # This file is part of libFirm.
2 # Copyright (C) 2012 Karlsruhe Institute of Technology.
3 import re
4
5 def format_arguments(string, voidwhenempty = False):
6         args = re.split('\s*\n\s*', string)
7         if args[0] == '':
8                 args = args[1:]
9         if len(args) > 0 and args[-1] == '':
10                 args = args[:-1]
11         if len(args) == 0 and voidwhenempty:
12                 return "void"
13         return ", ".join(args)
14
15 def filter_isnot(list, flag):
16         return filter(lambda x: not hasattr(x, flag), list)
17
18 def filter_hasnot(list, flag):
19         return filter(lambda x: flag not in x, list)
20
21 def filter_notset(list, flag):
22         return filter(lambda x: not getattr(x,flag), list)