<commit_before>#!/usr/bin/python

class FileTransform(object):
    """
    Do some transformation of file,
    like replacing words or similar
    """

    def run(self, inputfile, outputfile):
        pass

class InlineRemove(FileTransform):
    """
    Remove __inline due to a bug in clang
    """
    def __init__(self):
        from re import compile
        self._tdre = compile('^\s*(__inline|inline)\s+(.*)$')

    def run(self, inputfile, outputfile):
        infile = open(inputfile, 'r')
        outfile = open(outputfile, 'w')

        for l in infile:
            res = self._tdre.match(l)
            if res:
                outfile.write('/*{0} */ {1}\n'.format(res.group(1), res.group(2)))
            else:
                outfile.write(l)

class ReplaceNamedNondet(FileTransform):
    """
    Replace all nondet() calls to nondet_named(#__LINE__) calls
    """
    def __init__(self):
        from re import compile
        # XXX: this replaces also declarations -- and we do not have a namy anyway
        #self._re = compile('(.*)__VERIFIER_nondet_(.*)\(\s*\)(.*)')
        self._re2 = compile('(.*\s(.+)\s*=\s*)__VERIFIER_nondet_(.*)\(\s*\)(.*)')

    def run(self, inputfile, outputfile):
        infile = open(inputfile, 'r')
        outfile = open(outputfile, 'w')

        n = 1
        for l in infile:
            res = self._re2.match(l)
            if res:
                prefix = res.group(1)
                name = res.group(2).rstrip()
                ctype = res.group(3)
                suffix = res.group(4)
           #else:
           #    # no luck, try without name
           #    res = self._re.match(l)
           #    if res:
           #        prefix = res.group(1)
           #        name = '--'
           #        ctype = res.group(2)
           #        suffix = res.group(3)

            if res:
                outfile.write('{0}__VERIFIER_nondet_{1}_named("{2}.{3}"){4}\n'.\
                            format(prefix, ctype, name, n, suffix))
            else:
                outfile.write(l)

            n += 1
<commit_msg>use : instead of . in symbolic objects names<commit_after>#!/usr/bin/python

class FileTransform(object):
    """
    Do some transformation of file,
    like replacing words or similar
    """

    def run(self, inputfile, outputfile):
        pass

class InlineRemove(FileTransform):
    """
    Remove __inline due to a bug in clang
    """
    def __init__(self):
        from re import compile
        self._tdre = compile('^\s*(__inline|inline)\s+(.*)$')

    def run(self, inputfile, outputfile):
        infile = open(inputfile, 'r')
        outfile = open(outputfile, 'w')

        for l in infile:
            res = self._tdre.match(l)
            if res:
                outfile.write('/*{0} */ {1}\n'.format(res.group(1), res.group(2)))
            else:
                outfile.write(l)

class ReplaceNamedNondet(FileTransform):
    """
    Replace all nondet() calls to nondet_named(#__LINE__) calls
    """
    def __init__(self):
        from re import compile
        # XXX: this replaces also declarations -- and we do not have a namy anyway
        #self._re = compile('(.*)__VERIFIER_nondet_(.*)\(\s*\)(.*)')
        self._re2 = compile('(.*\s(.+)\s*=\s*)__VERIFIER_nondet_(.*)\(\s*\)(.*)')

    def run(self, inputfile, outputfile):
        infile = open(inputfile, 'r')
        outfile = open(outputfile, 'w')

        n = 1
        for l in infile:
            res = self._re2.match(l)
            if res:
                prefix = res.group(1)
                name = res.group(2).rstrip()
                ctype = res.group(3)
                suffix = res.group(4)
           #else:
           #    # no luck, try without name
           #    res = self._re.match(l)
           #    if res:
           #        prefix = res.group(1)
           #        name = '--'
           #        ctype = res.group(2)
           #        suffix = res.group(3)

            if res:
                outfile.write('{0}__VERIFIER_nondet_{1}_named("{2}:{3}"){4}\n'.\
                            format(prefix, ctype, name, n, suffix))
            else:
                outfile.write(l)

            n += 1

{'fraction_non_alphanumeric': 0.14364113576712, 'fraction_numerical': 0.00954426151276545, 'mean_word_length': 1.5988840669559827, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6333771', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1288, 'n_words': 302}