2 # -*- coding: utf-8 -*-
3 # MakeTranslateTable.py
7 import os, sys, re, codecs
9 #fo_in = codecs.lookup("utf_16")[-1](sys.stdin)
13 re_comment = re.compile( r"^/\* (.*) \*/" )
14 re_string = re.compile( r"\"(.*)([^\\])\" = \"(.*)([^\\])\";" )
15 re_blank = re.compile( r"^\s*$" )
24 if re_blank.search( line ):
25 if (comment) and (key):
26 # print "/* %s */" % (comment)
27 # print "\"%s\" = \"%s\";\n" % (key, value)
28 if comment == "No comment provided by engineer.":
31 print "%s\t%s\t%s" % (key, value, comment)
36 # print "/* %s */" % (comment)
40 elif re_comment.search( line ):
41 comment = re_comment.search( line ).group(1)
43 elif re_string.search( line ):
44 mt = re_string.search( line )
45 key = mt.group(1) + mt.group(2)
46 value = mt.group(3) + mt.group(4)
49 # print ">", comment, key, value