]> gitweb.factorcode.org Git - factor.git/commitdiff
more renaing get-char to current
authorDoug Coleman <erg@jobim.local>
Wed, 1 Apr 2009 07:33:38 +0000 (02:33 -0500)
committerDoug Coleman <erg@jobim.local>
Wed, 1 Apr 2009 07:33:38 +0000 (02:33 -0500)
extra/html/parser/analyzer/analyzer.factor
extra/html/parser/parser.factor

index b344ce160f4c64ad9de06f9ded2e05b0a5c07d44..54b8c8fc69d28a1befb29ee7889803f629ed3c30 100755 (executable)
@@ -3,7 +3,7 @@
 USING: assocs html.parser kernel math sequences strings ascii
 arrays generalizations shuffle unicode.case namespaces make
 splitting http accessors io combinators http.client urls
-urls.encoding fry prettyprint ;
+urls.encoding fry prettyprint sets ;
 IN: html.parser.analyzer
 
 TUPLE: link attributes clickable ;
@@ -126,7 +126,15 @@ TUPLE: link attributes clickable ;
     [ [
         [ name>> "a" = ]
         [ attributes>> "href" swap key? ] bi and ] filter
-    ] map sift [ [ attributes>> "href" swap at ] map ] map concat ;
+    ] map sift
+    [ [ attributes>> "href" swap at ] map ] map concat ;
+
+: find-frame-links ( vector -- vector' )
+    [ name>> "frame" = ] find-between-all
+    [ [ attributes>> "src" swap at ] map sift ] map concat sift ;
+
+: find-all-links ( vector -- vector' )
+    [ find-hrefs ] [ find-frame-links ] bi append prune ;
 
 : find-forms ( vector -- vector' )
     "form" over find-opening-tags-by-name
index 94ef59bdfdfda0bf0a642f8e440bf56f3a11bee5..9209e2dbc87f020e4aaf68f9fc9892b06b2126fb 100644 (file)
@@ -64,7 +64,7 @@ SYMBOL: tagstack
 
 : read-value ( state-parser -- string )
     skip-whitespace
-    dup get-char quote? [ read-quote ] [ read-token ] if
+    dup current quote? [ read-quote ] [ read-token ] if
     [ blank? ] trim ;
 
 : read-comment ( state-parser -- )
@@ -74,7 +74,7 @@ SYMBOL: tagstack
     ">" take-until-sequence make-dtd-tag push-tag ;
 
 : read-bang ( state-parser -- )
-    next dup { [ get-char CHAR: - = ] [ get-next CHAR: - = ] } 1&& [
+    next dup { [ current CHAR: - = ] [ peek-next CHAR: - = ] } 1&& [
         next next
         read-comment
     ] [
@@ -83,7 +83,7 @@ SYMBOL: tagstack
 
 : read-tag ( state-parser -- string )
     [ [ "><" member? ] take-until ]
-    [ dup get-char CHAR: < = [ next ] unless drop ] bi ;
+    [ dup current CHAR: < = [ next ] unless drop ] bi ;
 
 : read-until-< ( state-parser -- string )
     [ CHAR: < = ] take-until ;
@@ -111,7 +111,7 @@ SYMBOL: tagstack
     ] state-parse ;
 
 : read-< ( state-parser -- string/f )
-    next dup get-char [
+    next dup current [
         CHAR: ! = [ read-bang f ] [ read-tag ] if
     ] [
         drop f
@@ -121,7 +121,7 @@ SYMBOL: tagstack
     read-< [ (parse-tag) make-tag push-tag ] unless-empty ;
 
 : (parse-html) ( state-parser -- )
-    dup get-next [
+    dup peek-next [
         [ parse-text ] [ parse-tag ] [ (parse-html) ] tri
     ] [ drop ] if ;