Changed ctags-write to use set-file-lines as suggested

db4
Alfredo Beaumont 2008-07-07 23:21:23 +02:00
parent 5ba6a0c56d
commit dd8e465186
3 changed files with 23 additions and 3 deletions

View File

@ -32,6 +32,18 @@ HELP: ctags-write ( seq path -- )
{ $notes
{ $snippet "tags" } " file will contain a single line: if\\t/path/to/factor/extra/unix/unix.factor\\t91" } ;
HELP: ctag-strings ( alist -- seq )
{ $values { "alist" alist }
{ "seq" sequence } }
{ $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." }
{ $examples
{ $example
"USING: kernel ctags ;"
"{ { if { \"resource:extra/unix/unix.factor\" 91 } } } ctag-strings"
"{ \"if\\t/path/to/factor/extra/unix/unix.factor\\t91\" }"
}
} ;
HELP: ctag ( seq -- str )
{ $values { "seq" sequence }
{ "str" string } }

View File

@ -1,7 +1,12 @@
USING: kernel ctags tools.test io.backend sequences ;
IN: columns.tests
USING: kernel ctags tools.test io.backend sequences arrays prettyprint ;
IN: ctags.tests
[ t ] [
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append
{ if { "resource:extra/unix/unix.factor" 91 } } ctag =
] unit-test
[ t ] [
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append 1array
{ { if { "resource:extra/unix/unix.factor" 91 } } } ctag-strings =
] unit-test

View File

@ -18,8 +18,11 @@ IN: ctags
second number>string %
] "" make ;
: ctag-strings ( seq1 -- seq2 )
{ } swap [ ctag suffix ] each ;
: ctags-write ( seq path -- )
ascii [ [ ctag print ] each ] with-file-writer ;
>r ctag-strings r> ascii set-file-lines ;
: (ctags) ( -- seq )
{ } all-words [