8000 Fixed json strings grammar by blacklisting character control set. Clo… · sunnykim1206/llama-cpp-python@d02a9cf · GitHub
[go: up one dir, main page]

Skip to content

Commit d02a9cf

Browse files
committed
Fixed json strings grammar by blacklisting character control set. Closes abetlen#1259
1 parent 1f3156d commit d02a9cf

File tree

1 file< 8000 !-- --> changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llama_cpp/llama_grammar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
13371337
13381338
string ::=
13391339
"\"" (
1340-
[^"\\] |
1340+
[^"\\\x7F\x00-\x1F] |
13411341
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
13421342
)* "\"" ws
13431343
@@ -1366,7 +1366,7 @@ def print_grammar(file: TextIO, state: parse_state) -> None:
13661366
13671367
string ::=
13681368
"\"" (
1369-
[^"\\] |
1369+
[^"\\\x7F\x00-\x1F] |
13701370
"\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
13711371
)* "\"" ws
13721372

0 commit comments

Comments
 (0)
0