Ejemplo n.º 1
0
def runcmd():
    while 1:
        try:
            s = input('mql > ')
        except EOFError:
            break
        if not s:
            continue
        translator = MQLToPython()
        pprint(translator.translate_string(s))
Ejemplo n.º 2
0
        params = ""
        if args.run:
            if isinstance(args.run, list):
                filename = args.run[0]
                params = " ".join( args.run[1:])
            else:
                filename = args.run
                params = args.run

        preprocessor_out = filename + 'p'
        py_program = filename.replace('mql', 'py')

        with open(preprocessor_out, 'w') as pmql:
            preprocessor.start(filename, pmql)
            preprocessor.prepare_runtime(py_program)
        translator = MQLToPython()
        translator.translate_file(preprocessor_out, py_program)
        if args.run is not None:
            print("\n\nStart MQL Program (%s)..." % py_program)
            os.system('%s "%s" %s' % (PYTHON_PATH, py_program, params))
    elif args.lex is not None:
        import lang.mqllex as lex

        data = open(args.lex, 'r').read()
        lex.test_lex(data)
    elif args.preprocessor is not None:
        with open(args.preprocessor + 'p', 'w') as pmql:
            preprocessor.start(args.preprocessor, pmql)
    else:
        import lang.mqlcmd as cmd