Create regex-to-grammar.py
This commit is contained in:
parent
660e8321f5
commit
add8fee04a
1 changed files with 18 additions and 0 deletions
18
examples/regex-to-grammar.py
Normal file
18
examples/regex-to-grammar.py
Normal file
|
@ -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)))
|
Loading…
Add table
Add a link
Reference in a new issue