Identify direct children of yield expressions
[hiphop-php.git] / hphp / compiler / expression / fix.py
blob75e6e1dc8f8a5b3eacb9f70aa2e1a2582dd7dfc1
1 #!/usr/bin/python
3 import re
4 import sys
6 regex = re.compile(r'(\w+)::\1(\s*)\((.*)\)(\s*):(\s*)Expression\(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES\)', re.M | re.S)
8 def fix_file(file):
9 global regex
10 fp = open(file, 'r')
11 contents = fp.read()
12 rep = regex.sub(r'\1::\1\2(\3)\4:\5Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES(\1))',
13 contents)
14 fp.close()
15 fp = open(file, 'w')
16 fp.write(rep)
17 fp.close()
19 for fname in sys.argv[1:]:
20 fix_file(fname)