예제 #1
0
파일: main.py 프로젝트: KLab/IDLite
def main():
    argparser = build_argparser()
    args = argparser.parse_args()

    spec = Spec()
    for fn in args.files:
        with io.open(fn, 'r') as f:
            for t in parser.parse(f.read()):
                spec.add(t)
            parser.restart()

    spec.check_undefined()

    if args.output_type == 'unity':
        unitygen.generate(spec, sys.stdout, args.namespace)
    elif args.output_type == 'idlite':
        idlitegen.generate(spec, sys.stdout)
    else:
        sys.exit("""
Unknown output type: %r
Available types are: unity, idlite""" % args.output_type)
예제 #2
0
파일: main.py 프로젝트: hasipon/IDLite
def main():
    argparser = build_argparser()
    args = argparser.parse_args()

    spec = []
    for fn in args.files:
        with open(fn) as f:
            spec += parser.parse(f.read())
            parser.restart()

    type_order = {types.Enum: 0, types.Class: 1}
    spec.sort(key=lambda s: (type_order[type(s)], s.name))

    check_undefined(spec)

    if args.output_type == 'unity':
        unitygen.generate(spec, sys.stdout, args.namespace)
    elif args.output_type == 'idlite':
        idlitegen.generate(spec, sys.stdout)
    else:
        sys.exit("""
Unknown output type: %r
Available types are: unity, idlite""" % args.output_type)