<commit_before>#!/usr/bin/env python

# Programme to convert all single-line or multi-line "/* ... */"
# comments to "//" form in C or C++ code.  Input source code file is
# stdin, output file is stdout.
import sys
import re
ifsingleline = True

for line in sys.stdin.readlines():
    end_comment = line.find("*/")
    # len(line) includes new line character at end.
    if end_comment >=0 and end_comment !=  len(line) - 3:
        sys.stderr.write(line)
        raise RuntimeError, "Trailing garbage after */"

    if ifsingleline :
        start_comment = line.find("/*")
        if start_comment <0 and end_comment >=0:
            sys.stderr.write(line)
            raise RuntimeError, "Trailing */ for a line which is not a comment"

        # convert single-line comment.
        line = re.sub(r'^(.*)(/\*)(.*)(\*/)$', "\\1//\\3", line)

        start_comment = line.find("/*")
	if start_comment >= 0:
            # Convert first line of multiline comment.
            line = line.replace("/*", "//")
            ifsingleline = False
    else:
        end_comment = line.find("*/")<commit_msg>When transforming one-line "/*...*/" comments by the "//" form, make sure there is no trailing blank characters in the result.<commit_after>#!/usr/bin/env python

# Programme to convert all single-line or multi-line "/* ... */"
# comments to "//" form in C or C++ code.  Input source code file is
# stdin, output file is stdout.
import sys
import re
ifsingleline = True

for line in sys.stdin.readlines():
    end_comment = line.find("*/")
    # len(line) includes new line character at end.
    if end_comment >=0 and end_comment !=  len(line) - 3:
        sys.stderr.write(line)
        raise RuntimeError, "Trailing garbage after */"

    if ifsingleline :
        start_comment = line.find("/*")
        if start_comment <0 and end_comment >=0:
            sys.stderr.write(line)
            raise RuntimeError, "Trailing */ for a line which is not a comment"

        # convert single-line comment.
        line = re.sub(r'^(.*)(/\*)(.*) *\*/$', "\\1//\\3", line)

        start_comment = line.find("/*")
	if start_comment >= 0:
            # Convert first line of multiline comment.
            line = line.replace("/*", "//")
            ifsingleline = False
    else:
        end_comment = line.find("*/")
{'fraction_non_alphanumeric': 0.1474275832252486, 'fraction_numerical': 0.0060527453523562475, 'mean_word_length': 2.315186246418338, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2457797', 'n_tokens_mistral': 717, 'n_tokens_neox': 692, 'n_words': 228}