]> thyrsus.com Git - mad.git/commitdiff
Rely on continuation punches being present.
authorEric S. Raymond <esr@thyrsus,com>
Fri, 6 Feb 2004 05:44:38 +0000 (05:44 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Fri, 6 Feb 2004 05:44:38 +0000 (05:44 +0000)
mad

diff --git a/mad b/mad
index fd0879295c248b945faddfc2e328ee4b9303ae9d..506fd6f5451ab7d48df33286a45cc46cd45e7e94 100755 (executable)
--- a/mad
+++ b/mad
@@ -787,13 +787,16 @@ if __name__ == '__main__':
             fp = open(file)
             source = fp.read()
             fp.close()
-        # Grotty hack to remove continuation digits
-        source = re.sub("\n       [0-9] ", "\n        ", source)
         # A grotty hack to transform remarks
         source = re.sub(r'\tR\n', '\tCOMMENT\n', source)
         source = re.sub(r'\tR (.*)', '\tCOMMENT $\\1$', source)
-        # Equally grotty hack to add end-of-statement delimiters
-        source = re.sub('\n([A-Z]|\t)', ' ;\n\\1', source).rstrip() + ' ;\n'
+        # Equally grotty hack to add end-of-statement delimiters.
+        # Put them after every newline, then remove if they're followed
+        # by whitespace and a continuation digit
+        source = source.replace("\n", " ;\n")
+        source = re.sub(';\n(\s*)[0-9]+', '\n\\1', source)
+        sys.stdout.write(source)
+        sys.exit(1)
         # Parse
         yacc.parse(source, debug=mad_debug)