Skip to content

Commit 8451cdb

Browse files
committed
json: fix explosive integral grammar rules
1 parent 575b6dc commit 8451cdb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/json_schema_to_grammar.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212

1313
PRIMITIVE_RULES = {
1414
'boolean': '("true" | "false") space',
15-
'integral-part': '[0-9] | [1-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?',
16-
'decimal-part': '[0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?',
15+
'decimal-part': '[0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] [0-9]?)?)?)?)?)?)?)?)?)?',
16+
'integral-part': '[0-9] | [1-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] [0-9]?)?)?)?)?)?)?)?)?)?',
17+
1718
# 'number': '("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? space',
1819
# 'integer': '("-"? ([0-9] | [1-9] [0-9]*)) space',
1920
'number': '("-"? integral-part) ("." decimal-part)? ([eE] [-+]? integral-part)? space',

0 commit comments

Comments
 (0)