Bug #365 ยป 0001-generate_packets.py-Mark-regexes-as-raw-strings-to-f.patch
common/generate_packets.py | ||
---|---|---|
break
|
||
typeinfo={}
|
||
mo=re.search("^(.*)\((.*)\)$",type)
|
||
mo = re.search(r"^(.*)\((.*)\)$", type)
|
||
assert mo,repr(type)
|
||
typeinfo["dataio_type"],typeinfo["struct_type"]=mo.groups()
|
||
if typeinfo["struct_type"]=="float":
|
||
mo=re.search("^(\D+)(\d+)$",typeinfo["dataio_type"])
|
||
mo = re.search(r"^(\D+)(\d+)$", typeinfo["dataio_type"])
|
||
assert mo
|
||
typeinfo["dataio_type"]=mo.group(1)
|
||
typeinfo["float_factor"]=int(mo.group(2))
|
||
... | ... | |
removes=[]
|
||
remaining=[]
|
||
for i in arr:
|
||
mo=re.search("^add-cap\((.*)\)$",i)
|
||
mo = re.search(r"^add-cap\((.*)\)$", i)
|
||
if mo:
|
||
adds.append(mo.group(1))
|
||
continue
|
||
mo=re.search("^remove-cap\((.*)\)$",i)
|
||
mo = re.search(r"^remove-cap\((.*)\)$", i)
|
||
if mo:
|
||
removes.append(mo.group(1))
|
||
continue
|
||
... | ... | |
str=str.strip()
|
||
lines=str.split("\n")
|
||
|
||
mo=re.search("^\s*(\S+)\s*=\s*(\d+)\s*;\s*(.*?)\s*$",lines[0])
|
||
mo = re.search(r"^\s*(\S+)\s*=\s*(\d+)\s*;\s*(.*?)\s*$", lines[0])
|
||
assert mo,repr(lines[0])
|
||
self.type=mo.group(1)
|
||
... | ... | |
removes=[]
|
||
remaining=[]
|
||
for i in arr:
|
||
mo=re.search("^cancel\((.*)\)$",i)
|
||
mo = re.search(r"^cancel\((.*)\)$", i)
|
||
if mo:
|
||
self.cancel.append(mo.group(1))
|
||
continue
|
||
... | ... | |
content=open(input_name).read()
|
||
content=strip_c_comment(content)
|
||
lines=content.split("\n")
|
||
lines=map(lambda x: re.sub("\s*#.*$","",x),lines)
|
||
lines=map(lambda x: re.sub("\s*//.*$","",x),lines)
|
||
lines=filter(lambda x:not re.search("^\s*$",x),lines)
|
||
lines = map(lambda x: re.sub(r"\s*#.*$", "", x), lines)
|
||
lines = map(lambda x: re.sub(r"\s*//.*$", "", x), lines)
|
||
lines = filter(lambda x: not re.search(r"^\s*$", x), lines)
|
||
lines2=[]
|
||
types=[]
|
||
for i in lines:
|
||
mo=re.search("^type\s+(\S+)\s*=\s*(.+)\s*$",i)
|
||
mo = re.search(r"^type\s+(\S+)\s*=\s*(.+)\s*$", i)
|
||
if mo:
|
||
types.append(Type(mo.group(1),mo.group(2)))
|
||
else:
|