2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Copyright (C) 2006 Chris Double.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! See http://factorcode.org/license.txt for BSD license.
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 23:20:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								USING: help.markup help.syntax kernel peg sequences strings ;
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-16 17:08:13 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								IN: peg.search
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: tree-write
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $values
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 23:20:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  { "object" object } }
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "Write the object to the standard output stream, unless "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "it is an array, in which case recurse through the array "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "writing each object to the stream." }
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-11 22:01:39 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $example "USE: peg.search" "{ 65 \"bc\" { 68 \"ef\" } } tree-write" "AbcDef" } ;
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: search
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $values
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 23:20:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  { "string" string }
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  { "parser" "a peg based parser" }
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 23:20:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  { "seq"    sequence }
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "Returns a sequence containing the parse results of all substrings "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "from the input string that successfully parse using the "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "parser."
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-11 22:01:39 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $example "USING: peg.parsers peg.search prettyprint ;" "\"one 123 two 456\" 'integer' search ." "V{ 123 456 }" }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $example "USING: peg peg.parsers peg.search prettyprint ;" "\"one 123 \\\"hello\\\" two 456\" 'integer' 'string' 2choice search ." "V{ 123 \"hello\" 456 }" }
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $see-also replace } ;
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								HELP: replace
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $values
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 23:20:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  { "string" string }
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  { "parser" "a peg based parser" }
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 23:20:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  { "result" string }
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $description
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "Returns a copy of the original string but with all substrings that "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "successfully parse with the given parser replaced with "
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    "the result of that parser."
							 | 
						
					
						
							
								
									
										
										
										
											2008-01-06 12:30:23 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2008-03-11 22:01:39 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $example "USING: math math.parser peg peg.parsers peg.search prettyprint ;" "\"one 123 two 456\" 'integer' [ 2 * number>string ] action replace ." "\"one 246 two 912\"" }
							 | 
						
					
						
							
								
									
										
										
										
											2007-12-19 23:06:21 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{ $see-also search } ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 |