]> thyrsus.com Git - mad.git/commitdiff
Implemented debug option.
authorEric S. Raymond <esr@thyrsus,com>
Tue, 20 Jan 2004 18:37:37 +0000 (18:37 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Tue, 20 Jan 2004 18:37:37 +0000 (18:37 +0000)
mad

diff --git a/mad b/mad
index 2b12f6d24e94d7d6be1cbaffc1d63b5aaef31061..d3cce88ca766ed6db1937c7bab96db9fd0aa33e5 100755 (executable)
--- a/mad
+++ b/mad
@@ -489,11 +489,19 @@ def generate(out):
     out.write('}\n')
 
 if __name__ == '__main__':
+    import getopt
+    mad_debug = 0
+    (options, arguments) = getopt.getopt(sys.argv[1:], "d:")
+    print options
+    for (opt, val) in options:
+        if opt == '-d':
+            mad_debug = int(val)
+
     source = sys.stdin.read()
     # Grotty hack to add end-of-statement delimiters
     source = re.sub('\n([A-Z]|\t)', ' ;\n\\1', source).rstrip() + ' ;\n'
     # Parse
-    yacc.parse(source)
+    yacc.parse(source, debug=mad_debug)
     # Perform global analysis
     analyze(deck)
     # Generate code