Skip to content

Commit

Permalink
grammars : don't allow to output unescaped new line in string (#5885)
Browse files Browse the repository at this point in the history
* Don't allow grammar json array to output unescaped new line in string

* Don't allow new line in json object string
  • Loading branch information
ExtReMLapin authored Mar 5, 2024
1 parent 61d1c88 commit b1a4e99
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grammars/json.gbnf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ array ::=

string ::=
"\"" (
[^"\\] |
[^"\\\n] |
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
)* "\"" ws

Expand Down
2 changes: 1 addition & 1 deletion grammars/json_arr.gbnf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ array ::=

string ::=
"\"" (
[^"\\] |
[^"\\\n] |
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
)* "\"" ws

Expand Down

0 comments on commit b1a4e99

Please sign in to comment.