Example #1
0
def main():
    make_warnings_comments()
    parser = ArgumentParser(
        prog="prog='python -m lark.tools.standalone'",
        description="Lark Stand-alone Generator Tool",
        parents=[lalr_argparser],
        epilog='Look at the Lark documentation for more info on the options')
    parser.add_argument("old_start", nargs='?', help=SUPPRESS)
    parser.add_argument('-c',
                        '--compress',
                        action='store_true',
                        default=0,
                        help="Enable compression")
    if len(sys.argv) == 1:
        parser.print_help(sys.stderr)
        sys.exit(1)
    ns = parser.parse_args()
    if ns.old_start is not None:
        warn(
            'The syntax `python -m lark.tools.standalone <grammar-file> <start>` is deprecated. Use the -s option'
        )
        ns.start.append(ns.old_start)

    lark_inst, out = build_lalr(ns)
    gen_standalone(lark_inst, out=out, compress=ns.compress)
Example #2
0
def main():
    make_warnings_comments()
    parser = ArgumentParser(prog="prog='python -m lark.tools.standalone'", description="Lark Stand-alone Generator Tool",
                            parents=[lalr_argparser], epilog='Look at the Lark documentation for more info on the options')
    parser.add_argument('-c', '--compress', action='store_true', default=0, help="Enable compression")
    if len(sys.argv)==1:
        parser.print_help(sys.stderr)
        sys.exit(1)
    ns = parser.parse_args()

    lark_inst, out = build_lalr(ns)
    gen_standalone(lark_inst, out=out, compress=ns.compress)