Ejemplo n.º 1
0
def print_tree():
    parser = ArgumentParser(
        description="""Generate DOT file with parse tree of given script""")
    parser.add_argument(
        'script',
        help='Path to script written in DB language'
    )
    parser.add_argument(
        'dot_file',
        help='Path to save generated DOT file'
    )

    args = parser.parse_args()
    AntlrDBGrammarParser(args.script).generate_dot_tree(args.dot_file)
Ejemplo n.º 2
0
def test_script_2():
    test_path = os.path.join(os.getcwd(), 'tests/data/scripts/script2.txt')
    assert AntlrDBGrammarParser(test_path).check()
Ejemplo n.º 3
0
def test_wrong_script_1():
    test_path = os.path.join(os.getcwd(),
                             'tests/data/scripts/wrong_script1.txt')
    assert not AntlrDBGrammarParser(test_path).check()