]> gitweb.factorcode.org Git - factor.git/blob - extra/ctags/ctags-docs.factor
Solution to Project Euler problem 65
[factor.git] / extra / ctags / ctags-docs.factor
1 USING: help.syntax help.markup kernel prettyprint sequences strings words math ;
2 IN: ctags
3
4 ARTICLE: "ctags" "Ctags file"
5 { $emphasis "ctags" } " generates a index file of every factor word in ctags format as supported by vi and other editors. More information can be found at " { $url "http://en.wikipedia.org/wiki/Ctags" } "."
6 { $subsection ctags }
7 { $subsection ctags-write }
8 { $subsection ctag-strings }
9 { $subsection ctag }
10 { $subsection ctag-word }
11 { $subsection ctag-path }
12 { $subsection ctag-lineno } ;
13
14 HELP: ctags ( path -- )
15 { $values { "path" "a pathname string" } }
16 { $description "Generates a index file in ctags format and stores in " { $snippet "path" } "." }
17 { $examples
18   { $unchecked-example
19     "USING: ctags ;"
20     "\"tags\" ctags"
21     ""
22   }
23 } ;
24
25 HELP: ctags-write ( seq path -- )
26 { $values { "seq" sequence }
27           { "path" "a pathname string" } }
28 { $description "Stores a " { $snippet "alist" } " in " { $snippet "path" } ". " { $snippet "alist" } " must be an association list with ctags format: key must be a valid word and value a sequence whose first element is a resource name and second element is a line number" }
29 { $examples
30   { $unchecked-example
31     "USING: kernel ctags ;"
32     "{ { if  { \"resource:extra/unix/unix.factor\" 91 } } } \"tags\" ctags-write"
33     ""
34   }
35 }
36 { $notes
37   { $snippet "tags" } " file will contain a single line: if\\t/path/to/factor/extra/unix/unix.factor\\t91" } ;
38
39 HELP: ctag-strings
40 { $values { "alist" "an association list" }
41           { "seq" sequence } }
42 { $description "Converts an " { $snippet "alist" } " with ctag format (a word as key and a sequence whose first element is a resource name and a second element is a line number as value) in a " { $snippet "seq" } " of ctag strings." }
43 { $examples
44   { $unchecked-example
45     "USING: kernel ctags prettyprint ;"
46     "{ { if  { \"resource:extra/unix/unix.factor\" 91 } } } ctag-strings ."
47     "{ \"if\\t/path/to/factor/extra/unix/unix.factor\\t91\" }"
48   }
49 } ;
50
51 HELP: ctag ( seq -- str )
52 { $values { "seq" sequence }
53           { "str" string } }
54 { $description "Outputs a string " { $snippet "str" } " in ctag format for sequence with two elements, first one must be a valid word and second one a sequence whose first element is a resource name and second element is a line number" }
55 { $examples
56   { $unchecked-example
57     "USING: kernel ctags prettyprint ;"
58     "{ if  { \"resource:extra/unix/unix.factor\" 91 } } ctag ."
59     "\"if\\t/path/to/factor/extra/unix/unix.factor\\t91\""
60   }
61 } ;
62
63 HELP: ctag-lineno ( ctag -- n )
64 { $values { "ctag" sequence }
65           { "n" integer } }
66 { $description "Provides de line number " { $snippet "n" } " from a sequence in ctag format " }
67 { $examples
68   { $example
69     "USING: kernel ctags prettyprint ;"
70     "{ if  { \"resource:extra/unix/unix.factor\" 91 } } ctag-lineno ."
71     "91"
72   }
73 } ;
74
75 HELP: ctag-path ( ctag -- path )
76 { $values { "ctag" sequence }
77           { "path" string } }
78 { $description "Provides a path string " { $snippet "path" } " from a sequence in ctag format" }
79 { $examples
80   { $example
81     "USING: kernel ctags prettyprint ;"
82     "{ if  { \"resource:extra/unix/unix.factor\" 91 } } ctag-path ."
83     "\"resource:extra/unix/unix.factor\""
84   }
85 } ;
86
87 HELP: ctag-word ( ctag -- word )
88 { $values { "ctag" sequence }
89           { "word" word } }
90 { $description "Provides the " { $snippet "word" } " from a sequence in ctag format " }
91 { $examples
92   { $example
93     "USING: kernel ctags prettyprint ;"
94     "{ if  { \"resource:extra/unix/unix.factor\" 91 } } ctag-word ."
95     "if"
96   }
97 } ;
98
99
100 ABOUT: "ctags"