diff --git a/examples/regex-to-grammar.py b/examples/regex-to-grammar.py new file mode 100644 index 000000000..cec4fe01e --- /dev/null +++ b/examples/regex-to-grammar.py @@ -0,0 +1,18 @@ +import json, subprocess, sys, os + +assert len(sys.argv) == 2 +[_, pattern] = sys.argv + +print(subprocess.check_output( + [ + "python", + os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "json-schema-to-grammar.py"), + "-", + ], + text=True, + input=json.dumps({ + "type": "string", + "pattern": pattern, + }, indent=2))) \ No newline at end of file