]> gitweb.factorcode.org Git - factor.git/commitdiff
Docs moved to own file and ? instead of if.
authorbjourne@gmail.com <bjourne@gmail.com>
Wed, 24 Apr 2013 19:57:56 +0000 (21:57 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 24 Apr 2013 20:35:04 +0000 (13:35 -0700)
extra/html/parser/analyzer/analyzer-docs.factor [new file with mode: 0644]
extra/html/parser/analyzer/analyzer.factor

diff --git a/extra/html/parser/analyzer/analyzer-docs.factor b/extra/html/parser/analyzer/analyzer-docs.factor
new file mode 100644 (file)
index 0000000..797126b
--- /dev/null
@@ -0,0 +1,11 @@
+USING: help.syntax help.markup html.parser.analyzer sequences strings ;
+IN: html.parser.analyzer-docs
+
+HELP: stack-find
+{ $values { "seq" sequence } { "quot" { $quotation "( elt -- 1/0/-1 )" } } }
+{ $description "Takes a sequence and a quotation expected to return -1 if the element decrements the stack, 0 if it doesnt affect it and 1 if it increments it. Then finds the first element where the stack is empty." } ;
+
+HELP: tag-classifier
+{ $values { "string" string } }
+{ $description "Builds a function that classifies tag tuples. Returns 1 if the tag is an opening tag with the given name, -1 if it is a closing tag and 0 otherwise." } ;
+
index eeb15950a7da85f0a53b38b9cdc88643eea806f6..952b34421692eeae9c46ef2bc7efa590f6569284 100644 (file)
@@ -51,19 +51,12 @@ ERROR: undefined-find-nth m n seq quot ;
 : find-first-name ( vector string -- i/f tag/f )
     >lower '[ name>> _ = ] find ; inline
 
-! Takes a sequence and a quotation expected to return -1 if the
-! element decrements the stack, 0 if it doesnt affect it and 1 if it
-! increments it. Then finds the matching element where the stack is
-! empty.
-: stack-find ( seq quot -- i/f )
+: stack-find ( seq quot: ( elt -- 1/0/-1 ) -- i/f )
     map cum-sum [ 0 = ] find drop ; inline
 
-! Produces a function which returns 1 if the input item is an opening
-! tag element with the specified name, -1 if it is a closing tag of
-! the same name and 0 otherwise.
 : tag-classifier ( string -- quot )
     >lower
-    '[ dup name>> _ = [ closing?>> [ -1 ] [ 1 ] if ] [ drop 0 ] if ] ; inline
+    '[ dup name>> _ = [ closing?>> -1 1  ? ] [ drop 0 ] if ] ; inline
 
 : find-between* ( vector i/f tag/f -- vector )
     over integer? [