Skip to content

Commit

Permalink
json: fix explosive integral grammar rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ochafik committed Mar 31, 2024
1 parent 575b6dc commit 8451cdb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/json_schema_to_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

PRIMITIVE_RULES = {
'boolean': '("true" | "false") space',
'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]?',
'decimal-part': '[0-9] [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]? [0-9]?',
'decimal-part': '[0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] ([0-9] [0-9]?)?)?)?)?)?)?)?)?)?',
'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]?)?)?)?)?)?)?)?)?)?',

# 'number': '("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? space',
# 'integer': '("-"? ([0-9] | [1-9] [0-9]*)) space',
'number': '("-"? integral-part) ("." decimal-part)? ([eE] [-+]? integral-part)? space',
Expand Down

0 comments on commit 8451cdb

Please sign in to comment.