summaryrefslogtreecommitdiffstats
path: root/test/YACC/YACC-fixture/myyacc.py
blob: 77f80eac9f42e912a08ec9d19e3b3722c64db655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import getopt
import sys

cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:', [])
opt_string = ''
for opt, arg in cmd_opts:
    if opt == '-o':
        out = arg
    else:
        opt_string = opt_string + ' ' + opt

with open(out, 'w') as ofp:
    for a in args:
        with open(a, 'r') as ifp:
            contents = ifp.read()
        contents = contents.replace('YACC', 'myyacc.py')
        ofp.write(contents)

sys.exit(0)