Browse Source

Revert "grammars : don't allow to output unescaped new line in string (#5885)"

This reverts commit b1a4e994fde929300d4aeb1deb8320c59cb6edec.
Georgi Gerganov 1 year ago
parent
commit
82cb31eb93
2 changed files with 2 additions and 2 deletions
  1. 1 1
      grammars/json.gbnf
  2. 1 1
      grammars/json_arr.gbnf

+ 1 - 1
grammars/json.gbnf

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

+ 1 - 1
grammars/json_arr.gbnf

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