From 4b2a4e4f6df9ff6acbf3810f35adcc90d648e33d Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 18 Jun 2013 07:34:58 +0200 Subject: [PATCH] Some changes in klammerkomma.py --- klammerkomma.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/klammerkomma.py b/klammerkomma.py index 9c02038..ab3f4b2 100755 --- a/klammerkomma.py +++ b/klammerkomma.py @@ -7,7 +7,7 @@ import re import shutil re_komma = re.compile(r',(\s*[\)\]\}])') -re_cpp_comment = re.compile(r'//(.*)$') +re_cpp_comment = re.compile(r'//(.*)([\n\r]*)$') i = 0 for fname in sys.argv: @@ -24,7 +24,9 @@ for fname in sys.argv: ifile = open(fname) lines = ifile.read() nlines = re_komma.sub(r'\1', lines) - os.write(ofd, nlines) + for single_line in nlines.splitlines(True): + sline = re_cpp_comment.sub(r'/*\1*/\2', single_line) + os.write(ofd, sline) finally: os.close(ofd) ifile.close() -- 2.39.5