mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-03 09:22:01 +00:00 
			
		
		
		
	grammars : add json_arr.gbnf
This commit is contained in:
		
							
								
								
									
										31
									
								
								grammars/json_arr.gbnf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								grammars/json_arr.gbnf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					root   ::= arr
 | 
				
			||||||
 | 
					value  ::= object | array | string | number | ("true" | "false" | "null") ws
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					object ::=
 | 
				
			||||||
 | 
					  "{" ws (
 | 
				
			||||||
 | 
					            string ":" ws value
 | 
				
			||||||
 | 
					    ("," ws string ":" ws value)*
 | 
				
			||||||
 | 
					  )? "}" ws
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					array  ::=
 | 
				
			||||||
 | 
					  "[" ws (
 | 
				
			||||||
 | 
					            value
 | 
				
			||||||
 | 
					    ("," ws value)*
 | 
				
			||||||
 | 
					  )? "]" ws
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					arr  ::=
 | 
				
			||||||
 | 
					  "[\n" ws (
 | 
				
			||||||
 | 
					            value
 | 
				
			||||||
 | 
					    (",\n" ws value)*
 | 
				
			||||||
 | 
					  )? "]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					string ::=
 | 
				
			||||||
 | 
					  "\"" (
 | 
				
			||||||
 | 
					    [^"\\] |
 | 
				
			||||||
 | 
					    "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
 | 
				
			||||||
 | 
					  )* "\"" ws
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					number ::= ("-"? ([0-9] | [1-9] [0-9]*)) ("." [0-9]+)? ([eE] [-+]? [0-9]+)? ws
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Optional space: by convention, applied in this grammar after literal chars when allowed
 | 
				
			||||||
 | 
					ws ::= ([ \t\n] ws)?
 | 
				
			||||||
		Reference in New Issue
	
	Block a user