Exemplo n.º 1
0
def test_tokens_as_string(testsdir):
    t_dir = os.path.join(testsdir, 'valid')
    verbose = False
    from fable.tokenization import tokens_as_string
    for file_name in sorted(os.listdir(t_dir)):
        if (not file_name.endswith(".f")): continue
        print(file_name)
        all_fprocs = fable.read.process(
            file_names=[os.path.join(t_dir, file_name)])
        for fproc in all_fprocs.all_in_input_order:
            for ei in fproc.executable:
                if (ei.key == "write"):
                    s = tokens_as_string(tokens=ei.iolist)
                    if (verbose):
                        print(s)
            for tokens in fproc.format.values():
                s = tokens_as_string(tokens=tokens)
                if (verbose):
                    print(s)
            if (verbose):
                print()
Exemplo n.º 2
0
def exercise_tokens_as_string(verbose):
    t_dir = libtbx.env.under_dist(module_name="fable",
                                  path="test/valid",
                                  test=op.isdir)
    from fable.tokenization import tokens_as_string
    for file_name in sorted(os.listdir(t_dir)):
        if (not file_name.endswith(".f")): continue
        if (verbose):
            print("exercise_tokens_as_string:", file_name)
        all_fprocs = read.process(file_names=[op.join(t_dir, file_name)])
        for fproc in all_fprocs.all_in_input_order:
            for ei in fproc.executable:
                if (ei.key == "write"):
                    s = tokens_as_string(tokens=ei.iolist)
                    if (verbose):
                        print(s)
            for tokens in fproc.format.values():
                s = tokens_as_string(tokens=tokens)
                if (verbose):
                    print(s)
            if (verbose):
                print()