summaryrefslogtreecommitdiffstats
path: root/test/YACC/YACCFLAGS-fixture/myyacc.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/YACC/YACCFLAGS-fixture/myyacc.py')
-rw-r--r--test/YACC/YACCFLAGS-fixture/myyacc.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/YACC/YACCFLAGS-fixture/myyacc.py b/test/YACC/YACCFLAGS-fixture/myyacc.py
new file mode 100644
index 0000000..ffd9031
--- /dev/null
+++ b/test/YACC/YACCFLAGS-fixture/myyacc.py
@@ -0,0 +1,17 @@
+import getopt
+import sys
+cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:I:x', [])
+output = None
+opt_string = ''
+i_arguments = ''
+for opt, arg in cmd_opts:
+ if opt == '-o': output = open(arg, 'wb')
+ elif opt == '-I': i_arguments = i_arguments + ' ' + arg
+ else: opt_string = opt_string + ' ' + opt
+for a in args:
+ contents = open(a, 'rb').read()
+ contents = contents.replace(b'YACCFLAGS', opt_string.encode())
+ contents = contents.replace(b'I_ARGS', i_arguments.encode())
+ output.write(contents)
+output.close()
+sys.exit(0)