]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/ctags/etags/etags.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / extra / ctags / etags / etags.factor
index b3ad87948193ec69b1415145835f7b61904737bf..615b38daf6d94ea1ca57f4349405707432e2f141 100644 (file)
@@ -4,8 +4,8 @@
 ! Emacs Etags generator
 ! Alfredo Beaumont <alfredo.beaumont@gmail.com>
 USING: kernel sequences sorting assocs words prettyprint ctags
-io.encodings.ascii io.files math math.parser namespaces strings locals
-shuffle io.backend arrays ;
+io.encodings.ascii io.files math math.parser namespaces make
+strings shuffle io.backend arrays present ;
 IN: ctags.etags
 
 : etag-at ( key hash -- vector )
@@ -29,24 +29,24 @@ IN: ctags.etags
   H{ } clone swap [ swap [ etag-add ] keep ] each ;
 
 : lines>bytes ( seq n -- bytes )
-  head 0 [ length 1+ + ] reduce ;
+  head 0 [ length 1 + + ] reduce ;
 
-: file>lines ( resource -- lines )
+: file>lines ( path -- lines )
   ascii file-lines ;
 
 : etag ( lines seq -- str )
   [
-    dup first ?word-name %
+    dup first present %
     1 HEX: 7f <string> %
     second dup number>string %
     1 CHAR: , <string> %
-    1- lines>bytes number>string %
+    1 - lines>bytes number>string %
   ] "" make ;
 
 : etag-length ( vector -- n )
   0 [ length + ] reduce ;
 
-: <header> ( n path -- str )
+: (etag-header) ( n path -- str )
   [
     %
     1 CHAR: , <string> %
@@ -54,7 +54,7 @@ IN: ctags.etags
   ] "" make ;
 
 : etag-header ( vec1 n resource -- vec2 )
-  normalize-path <header> prefix
+  normalize-path (etag-header) prefix
   1 HEX: 0c <string> prefix ;
 
 : etag-strings ( alist -- seq )
@@ -72,4 +72,4 @@ IN: ctags.etags
   [ etag-strings ] dip ascii set-file-lines ; 
 
 : etags ( path -- )
-  [ (ctags) sort-values etag-hash >alist ] dip etags-write ;
\ No newline at end of file
+  [ (ctags) sort-values etag-hash >alist ] dip etags-write ;