<commit_before>import sys
from getch import getch

commands = '><+-.,[]'

class BrainfuckInterpreter:
    def __init__(self):
        self.i = 0
        self.p = 0
        self.cells = [0]

    @staticmethod
    def find_matching_paren(source, c):
        paren = 0
        d = {'[':']', ']':'['}
        for k in range(len(source)):
            if source[k]==c:
                paren += 1
            elif source[k]==d[c]:
                if paren == 0:
                    return k
                paren -= 1
        return -1

    def show_cells(self):
        print("Cell pointer is at", self.p)
        for i in range(len(self.cells)):
            print(i, self.cells[i],end=" ")
            if self.p == i:<commit_msg>Raise an error instead of return -1 in case of parenthesis mismatch<commit_after>import sys
from getch import getch

commands = '><+-.,[]'

class BrainfuckInterpreter:
    def __init__(self):
        self.i = 0
        self.p = 0
        self.cells = [0]

    @staticmethod
    def find_matching_paren(source, c):
        paren = 0
        d = {'[':']', ']':'['}
        for k in range(len(source)):
            if source[k]==c:
                paren += 1
            elif source[k]==d[c]:
                if paren == 0:
                    return k
                paren -= 1
        raise SyntaxError("Could not find the matching parenthesis")

    def show_cells(self):
        print("Cell pointer is at", self.p)
        for i in range(len(self.cells)):
            print(i, self.cells[i],end=" ")
            if self.p == i:
{'fraction_non_alphanumeric': 0.1365099806825499, 'fraction_numerical': 0.0103026400515132, 'mean_word_length': 1.5943238731218699, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '446846', 'n_tokens_mistral': 516, 'n_tokens_neox': 480, 'n_words': 133}