summaryrefslogtreecommitdiffstats
path: root/test/YACC/YACC-fixture/myyacc.py
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2022-07-19 18:28:59 (GMT)
committerGitHub <noreply@github.com>2022-07-19 18:28:59 (GMT)
commit4e70c9f1dec398e509d6463b77b890351f3a7a92 (patch)
treee5d923229ffd749eaa31a95db3eb8ea2b2366129 /test/YACC/YACC-fixture/myyacc.py
parent9bc75d285f813282fd285bc834118925fc4e2ae1 (diff)
parentb16ae6440ad87e47592a2ffb06bd50be3d6a84e5 (diff)
downloadSCons-4e70c9f1dec398e509d6463b77b890351f3a7a92.zip
SCons-4e70c9f1dec398e509d6463b77b890351f3a7a92.tar.gz
SCons-4e70c9f1dec398e509d6463b77b890351f3a7a92.tar.bz2
Merge pull request #4183 from mwichmann/maint/lex_yacc
Improvements to lex and yacc tools
Diffstat (limited to 'test/YACC/YACC-fixture/myyacc.py')
-rw-r--r--test/YACC/YACC-fixture/myyacc.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/YACC/YACC-fixture/myyacc.py b/test/YACC/YACC-fixture/myyacc.py
index d0ab95e..77f80ea 100644
--- a/test/YACC/YACC-fixture/myyacc.py
+++ b/test/YACC/YACC-fixture/myyacc.py
@@ -1,13 +1,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
+ 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()
- ofp.write(contents.replace('YACC', 'myyacc.py'))
+ contents = contents.replace('YACC', 'myyacc.py')
+ ofp.write(contents)
+
sys.exit(0)