]> gitweb.factorcode.org Git - factor.git/blob - extra/peg/search/search-docs.factor
Update project-euler.010 timings
[factor.git] / extra / peg / search / search-docs.factor
1 ! Copyright (C) 2006 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.syntax help.markup peg peg.search ;
4
5 HELP: tree-write
6 { $values 
7   { "object" "an object" } }
8 { $description 
9     "Write the object to the standard output stream, unless "
10     "it is an array, in which case recurse through the array "
11     "writing each object to the stream." }
12 { $example "{ 65 \"bc\" { 68 \"ef\" } } tree-write" "AbcDef" } ;
13
14 HELP: search
15 { $values 
16   { "string" "a string" } 
17   { "parser" "a peg based parser" } 
18   { "seq"    "a sequence" } 
19 }
20 { $description 
21     "Returns a sequence containing the parse results of all substrings "
22     "from the input string that successfully parse using the "
23     "parser."
24 }
25     
26 { $example "\"one 123 two 456\" 'integer' search" "V{ 123 456 }" }
27 { $example "\"one 123 \\\"hello\\\" two 456\" 'integer' 'string' 2array choice search" "V{ 123 \"hello\" 456 }" }
28 { $see-also replace } ;
29     
30 HELP: replace
31 { $values 
32   { "string" "a string" } 
33   { "parser" "a peg based parser" } 
34   { "result"    "a string" } 
35 }
36 { $description 
37     "Returns a copy of the original string but with all substrings that "
38     "successfully parse with the given parser replaced with "
39     "the result of that parser."
40 }   
41 { $example "\"one 123 two 456\" 'integer' [ 2 * number>string ] action replace" "\"one 246 two 912\"" }
42 { $see-also search } ;
43