<commit_before>import sys
import functions
import interpreter
import preprocessor
from errors import *;


def main(args):
    print("Running Jazzy!")

    intrp = interpreter.Interpreter()
    RegisterFunctions(intrp)

    if(len(args) > 0):
        #run the file
        RunFile(intrp, args[0])
    else:
        #read from std in
        RunSdtIn(intrp)

def RegisterFunctions(intrp):
    #Register the Funcitons
    for mod in functions.__all__:
        __import__("functions."+mod)
        mofFunc = getattr(functions, mod)
        for func in mofFunc.Functions:
            try:
                funcClass = getattr(mofFunc, func)
                jazFunc = funcClass()
                intrp.RegisterFunction(jazFunc.command, jazFunc)
            except Exception as err:
                print(err.message)

def RunSdtIn(intrp):
    action = input(">>")
    try:
        output  =intrp.Exec(action)
        print(output)
    except CommandNotFoundError as err:
        print(err.message)

def RunFile(intrp, filename):
    try:
        processor = preprocessor.Preprocessor()
        code = processor.parseFile(filename)
        labels = processor.GetLabels()
        intrp.SetLabels(labels)
        for line in code:
            try:
                output = intrp.Exec(line)
                print(output)
            except CommandNotFoundError as error:
                print(error.message)
    except Exception as err:
        print(err)


if __name__ == "__main__":
    # execute only if run as a script
    main(sys.argv[1:])<commit_msg>Program now loops when running in intrp mode<commit_after>import sys
import functions
import interpreter
import preprocessor
from errors import *;


def main(args):
    print("Running Jazzy!")

    intrp = interpreter.Interpreter()
    RegisterFunctions(intrp)

    if(len(args) > 0):
        #run the file
        RunFile(intrp, args[0])
    else:
        #read from std in
        RunSdtIn(intrp)

def RegisterFunctions(intrp):
    #Register the Funcitons
    for mod in functions.__all__:
        __import__("functions."+mod)
        mofFunc = getattr(functions, mod)
        for func in mofFunc.Functions:
            try:
                funcClass = getattr(mofFunc, func)
                jazFunc = funcClass()
                intrp.RegisterFunction(jazFunc.command, jazFunc)
            except Exception as err:
                print(err.message)

def RunSdtIn(intrp):
    while not intrp.isFinished():
        print("")
        action = input(">>")
        try:
            output = intrp.Exec(action)
            if output is not None:
                print(output)
        except CommandNotFoundError as err:
            print(err.message)

def RunFile(intrp, filename):
    try:
        processor = preprocessor.Preprocessor()
        code = processor.parseFile(filename)
        labels = processor.GetLabels()
        intrp.SetLabels(labels)
        for line in code:
            try:
                output = intrp.Exec(line)
                print(output)
            except CommandNotFoundError as error:
                print(error.message)
    except Exception as err:
        print(err)


if __name__ == "__main__":
    # execute only if run as a script
    main(sys.argv[1:])
{'fraction_non_alphanumeric': 0.08801729462631254, 'fraction_numerical': 0.0018529956763434219, 'mean_word_length': 2.0499058380414312, 'pattern_counts': {'":': 2, '<': 3, '<?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': '574870', 'n_tokens_mistral': 933, 'n_tokens_neox': 909, 'n_words': 243}