tools: umm: remove trailing whitespace

This commit is contained in:
Corey Richardson 2016-01-22 15:21:32 +11:00
parent 2e3e09ab92
commit e8665db6d8
No known key found for this signature in database
GPG key ID: 990278AD76243314

View file

@ -27,11 +27,11 @@ def parse_type(tps):
elif tp == 'Unit':
return ('Unit',) , rest
elif tp == 'Array':
tp2, rest = helper(rest)
# arrays are Array ... sz
return ('Array', tp2, rest[0]), rest[1:]
return ('Array', tp2, rest[0]), rest[1:]
else:
return ('Base', tp), rest
@ -53,7 +53,7 @@ def handle_one_struct(s):
def hdl_fld(f):
fl, tp = f.split(':')
return (fl.lstrip(), parse_type(tp.split(' ')))
name = s[0]
return (name, map(hdl_fld, s[1:]))
@ -61,7 +61,7 @@ def dict_from_list(ls):
a = {}
for k, v in ls:
a[k] = v
return a
def is_base(x):
@ -90,7 +90,7 @@ def paths_to_type(mp, f, start):
if f(start_tp):
return [([], start_tp)]
else:
res = map(handle_one, mp[start])
res = map(handle_one, mp[start])
return (reduce(lambda x, y: x + y, res))
def build_types(file):
@ -99,9 +99,9 @@ def build_types(file):
lines = map(lambda x: x.rstrip(), in_file.readlines())
in_file.close()
grps = splitBy(lambda x: x == '', lines)
# the order information will be important if we want _CL for all types
sts = dict_from_list(map(handle_one_struct, grps))
@ -117,8 +117,8 @@ def print_graph(filename, out_file):
#if is_base(tp):
print >> out_file, '\t "%s" -> "%s" [label="%s"]' % \
(k, base_name(tp), fld)
print >>out_file, '}'
print >>out_file, '}'
## Toplevel
if __name__ == '__main__':