1import json, subprocess, sys, os
2
3assert len(sys.argv) >= 2
4[_, pattern, *rest] = sys.argv
5
6print(subprocess.check_output(
7 [
8 "python",
9 os.path.join(
10 os.path.dirname(os.path.realpath(__file__)),
11 "json_schema_to_grammar.py"),
12 *rest,
13 "-",
14 "--raw-pattern",
15 ],
16 text=True,
17 input=json.dumps({
18 "type": "string",
19 "pattern": pattern,
20 }, indent=2)))