()
| 14 | |
| 15 | |
| 16 | def main(): |
| 17 | p = argparse.ArgumentParser() |
| 18 | p.add_argument('ucd', metavar='DIR', nargs=1) |
| 19 | args = p.parse_args() |
| 20 | ucd = args.ucd[0] |
| 21 | |
| 22 | def generate(subcmd, *args, **kwargs): |
| 23 | subprocess.run(("ucd-generate", subcmd, ucd) + args, check=True, **kwargs) |
| 24 | |
| 25 | def generate_file(path, subcmd, *args, filename=None, **kwargs): |
| 26 | if filename is None: |
| 27 | filename = subcmd.replace('-', '_') + ".rs" |
| 28 | eprint('-', filename) |
| 29 | with open(os.path.join(path, filename), "w") as f: |
| 30 | generate(subcmd, *args, stdout=f, **kwargs) |
| 31 | |
| 32 | eprint('generating regex-syntax tables') |
| 33 | path = os.path.join("regex-syntax", "src", "unicode_tables") |
| 34 | generate_file(path, "age", "--chars") |
| 35 | generate_file(path, "case-folding-simple", "--chars", "--all-pairs") |
| 36 | generate_file(path, "general-category", "--chars", "--exclude", "surrogate") |
| 37 | generate_file(path, "perl-word", "--chars") |
| 38 | generate_file(path, "property-bool", "--chars") |
| 39 | generate_file(path, "property-names") |
| 40 | generate_file(path, "property-values", "--include", "gc,script,scx,age") |
| 41 | generate_file(path, "script", "--chars") |
| 42 | generate_file(path, "script-extension", "--chars") |
| 43 | |
| 44 | if __name__ == '__main__': |
| 45 | main() |
no test coverage detected