From 2d89da4f774906eb9204924e6d354d7bde9f3f37 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 3 Sep 2023 18:47:38 +0300 Subject: [PATCH] grammar : add comments to new grammar file --- grammars/json_arr.gbnf | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/grammars/json_arr.gbnf b/grammars/json_arr.gbnf index 0106c2384..653119d88 100644 --- a/grammars/json_arr.gbnf +++ b/grammars/json_arr.gbnf @@ -1,6 +1,15 @@ +# This is the same as json.gbnf but we restrict whitespaces at the end of the root array +# Useful for generating JSON arrays + root ::= arr value ::= object | array | string | number | ("true" | "false" | "null") ws +arr ::= + "{\n\t[\n" ws ( + value + (",\n" ws value)* + )? "\t]\n}" + object ::= "{" ws ( string ":" ws value @@ -13,12 +22,6 @@ array ::= ("," ws value)* )? "]" ws -arr ::= - "[\n" ws ( - value - (",\n" ws value)* - )? "]" - string ::= "\"" ( [^"\\] |