]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 4 Jul 2008 23:23:24 +0000 (18:23 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 4 Jul 2008 23:23:24 +0000 (18:23 -0500)
extra/html/parser/parser.factor
extra/html/parser/utils/utils.factor
extra/sequences/lib/lib.factor

index 1ae5768f9858c7f61ff40bb3f73e62f783518f62..c8aa9aa9e6c38b3c68ba9bf88c4fcf71f219804a 100644 (file)
@@ -122,7 +122,7 @@ SYMBOL: tagstack
 : parse-attributes ( -- hashtable )
     [ (parse-attributes) ] { } make >hashtable ;
 
-: (parse-tag)
+: (parse-tag) ( string -- string' hashtable )
     [
         read-token >lower
         parse-attributes
index 592503e3dd02aca2fcf8ecd9888f3646179aad45..c3372d750a82e3ada070f9bb9b24fc4a07386b56 100644 (file)
@@ -4,7 +4,7 @@ namespaces prettyprint quotations sequences splitting
 state-parser strings sequences.lib ;
 IN: html.parser.utils
 
-: string-parse-end?
+: string-parse-end? ( -- ? )
     get-next not ;
 
 : take-string* ( match -- string )
index 1debe3f91b7d163a8f424bb8573cec88ce06882c..5591844fdec713ec045658221e511945796f4c7e 100755 (executable)
@@ -98,17 +98,21 @@ MACRO: firstn ( n -- )
 : v, ( -- ) V{ } clone , ;
 : ,v ( -- ) building get dup peek empty? [ dup pop* ] when drop ;
 
-: monotonic-split ( seq quot -- newseq )
+: (monotonic-split) ( seq quot -- newseq )
     [
         >r dup unclip suffix r>
         v, [ pick ,, call [ v, ] unless ] curry 2each ,v
     ] { } make ;
 
+: monotonic-split ( seq quot -- newseq )
+    over empty? [ 2drop { } ] [ (monotonic-split) ] if ;
+
 : delete-random ( seq -- value )
     [ length random ] keep [ nth ] 2keep delete-nth ;
 
+ERROR: element-not-found ;
 : split-around ( seq quot -- before elem after )
-    dupd find over [ "Element not found" throw ] unless
+    dupd find over [ element-not-found ] unless
     >r cut rest r> swap ; inline
 
 : (map-until) ( quot pred -- quot )