Changed ctags-write to use set-file-lines as suggested
parent
5ba6a0c56d
commit
dd8e465186
|
@ -32,6 +32,18 @@ HELP: ctags-write ( seq path -- )
|
||||||
{ $notes
|
{ $notes
|
||||||
{ $snippet "tags" } " file will contain a single line: if\\t/path/to/factor/extra/unix/unix.factor\\t91" } ;
|
{ $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 )
|
HELP: ctag ( seq -- str )
|
||||||
{ $values { "seq" sequence }
|
{ $values { "seq" sequence }
|
||||||
{ "str" string } }
|
{ "str" string } }
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
USING: kernel ctags tools.test io.backend sequences ;
|
USING: kernel ctags tools.test io.backend sequences arrays prettyprint ;
|
||||||
IN: columns.tests
|
IN: ctags.tests
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append
|
"if\t" "resource:extra/unix/unix.factor" normalize-path "\t91" 3append
|
||||||
{ if { "resource:extra/unix/unix.factor" 91 } } ctag =
|
{ 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
|
] unit-test
|
|
@ -18,8 +18,11 @@ IN: ctags
|
||||||
second number>string %
|
second number>string %
|
||||||
] "" make ;
|
] "" make ;
|
||||||
|
|
||||||
|
: ctag-strings ( seq1 -- seq2 )
|
||||||
|
{ } swap [ ctag suffix ] each ;
|
||||||
|
|
||||||
: ctags-write ( seq path -- )
|
: ctags-write ( seq path -- )
|
||||||
ascii [ [ ctag print ] each ] with-file-writer ;
|
>r ctag-strings r> ascii set-file-lines ;
|
||||||
|
|
||||||
: (ctags) ( -- seq )
|
: (ctags) ( -- seq )
|
||||||
{ } all-words [
|
{ } all-words [
|
||||||
|
|
Loading…
Reference in New Issue