Beispiel #1
0
def test_var_use_failing(file_path):
    parser = parse_file(file_path)
    program = parser.program()
    listener = VarUseListener()
    program.enterRule(listener)
    with pytest.raises(LatteVariableNamesError):
        listener.summarize()
Beispiel #2
0
def test_var_use_failing(file_path):
    parser = parse_file(file_path)
    program = parser.program()
    listener = ReturnListener()
    program.enterRule(listener)
    with pytest.raises(LatteReturnError):
        listener.summarize()
Beispiel #3
0
def test_file(file_path):
    parser = parse_file(file_path)
    if 'syntax' in file_path:
        with pytest.raises(LatteSyntaxError):
            parser.program()
    else:
        parser.program()
Beispiel #4
0
def main_f():
    args = cli()

    if args.verbose:
        print(args)

    parser = parse_file(args.path.name)
    program_ctx = parser.program()

    validate(program_ctx)
    if args.validation_only:
        print('Finished validation with success')
        return

    if args.optimize == 1:
        program_ctx = optimize(program_ctx)

        if args.verbose:
            print(program_ctx.getText())

    compile_latte(program_ctx)
Beispiel #5
0
def test_good_self_files(file_path):
    parser = parse_file(file_path)
    propgram = parser.program()
    listener = VarUseListener()
    propgram.enterRule(listener)
    listener.summarize()
Beispiel #6
0
def test_good_extensions_files(file_path):
    parser = parse_file(file_path)
    propgram = parser.program()
    listener = ReturnListener()
    propgram.enterRule(listener)
    listener.summarize()