1 # Copyright 2012 DWARF Debugging Information Format Committee
2 # This reads the input tokens and then
3 # writes them out in new files.
4 # Used to verify that the output matches the input byte-for-byte
10 #"address":"chap:address",
11 #"block":"chap:block",
12 #"constant":"chap:constant",
13 "exprloc":"chap:exprloc",
15 "lineptr":"chap:lineptr",
16 "loclistptr":"chap:loclistptr",
17 "macptr":"chap:macptr",
18 "rangelistptr":"chap:rangelistptr" }
19 #"reference":"chap:reference",
20 #"string":"chap:string" }
23 if tok._class != "ind":
25 if len(tok._tex) != 1:
31 def transformone(tok, string):
32 label = refclass[string]
33 # output is \livelink{label}{string}
35 t1.insertid("\livelink")
46 return [t1,t2,t3,t4,t5,t6,t7]
48 def append_to_out(out,addthese):
52 def transfunc(linetoks,myfile,linenum):
57 lasttoknum = len(linetoks) -1
60 rawtok = ''.join(t._tex)
61 if refclass.has_key(rawtok) == 1:
62 if tnumin == 0 or tnumin == lasttoknum:
63 tmp = transformone(t, rawtok);
65 append_to_out(outtoks,tmp)
67 if ischar(linetoks[tnumin - 1],"{") == "n" and ischar(linetoks[tnumin+1],"}") == "n":
68 tmp = transformone(t, rawtok);
69 append_to_out(outtoks,tmp)
82 while len(sys.argv) > cur:
87 dwf = fileio.readFilelist(filelist)
88 dwf.dwtransformline(transfunc)
91 if __name__ == '__main__':