[llvm-commits] [hlvm] r38112 - /hlvm/trunk/build/filterbuilders.py
Reid Spencer
reid at x10sys.com
Sat Jul 7 16:59:56 PDT 2007
Author: reid
Date: Sat Jul 7 18:59:56 2007
New Revision: 38112
URL: http://llvm.org/viewvc/llvm-project?rev=38112&view=rev
Log:
Strip comments, annotations, and blank lines out of the included schema. This
just helps keep program size down a bit since the text of the schema is
included in the code.
Modified:
hlvm/trunk/build/filterbuilders.py
Modified: hlvm/trunk/build/filterbuilders.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/filterbuilders.py?rev=38112&r1=38111&r2=38112&view=diff
==============================================================================
--- hlvm/trunk/build/filterbuilders.py (original)
+++ hlvm/trunk/build/filterbuilders.py Sat Jul 7 18:59:56 2007
@@ -7,17 +7,27 @@
res = []
f=open(output[0].path,'w')
for subst in substs:
- res.append(re.compile(subst[0]))
+ res.append(re.compile(subst[0],re.MULTILINE|re.DOTALL))
+ lines =""
for line in fileinput.input(input[0].path):
- count = 0
- for r in res:
- line = res[count].sub(substs[count][1],line,0)
- count += 1
- f.write(line)
+ lines+= line
+ count = 0
+ for r in res:
+ lines = res[count].sub(substs[count][1],lines,0)
+ count += 1
+ lines += '\n'
+ f.write(lines)
f.close()
def QuoteSourceAction(target,source,env):
- substs = [['[\\\\]','\\\\\\\\'],['"','\\"'],['^(.*)$','"\\1"']]
+ substs = [
+ ['<!--.*?-->',''],
+ ['<annotation>.*?</annotation>',''],
+ ['[\\\\]','\\\\\\\\'],
+ ['"','\\"'],
+ ['^([^\\n]*)$','"\\1"'],
+ ['^"[ \\t]*?"$\\n','']
+ ]
_sedit(source,target,substs)
return 0
More information about the llvm-commits
mailing list