Paste: sax with parent stack

Author: jedahu
Mode: factor
Date: Tue, 2 Dec 2008 07:00:12
Plain Text |
USING: combinators fry kernel namespaces sequences vectors xml xml.data ;

: stack-sax ( stream quot: ( parents xml-elem -- ) -- )
    '[
        V{ } clone sax-stack
        [
            [
                sax-stack get swap [ _ call ] 2keep {
                    { [ dup opener? ] [ swap push ] }
                    { [ dup closer? ] [ drop pop* ] }
                    [ 2drop ]
                } cond
            ] sax
        ] with-variable
    ] call ;

Annotation: what about this?

Author: slava
Mode: factor
Date: Tue, 2 Dec 2008 07:03:37
Plain Text |
: stack-sax ( stream quot: ( parents xml-elem -- ) -- )
    V{ } clone '[
        _ _ swap 2keep {
            { [ dup opener? ] [ swap push ] }
            { [ dup closer? ] [ drop pop* ] }
            [ 2drop ]
        } cond
    ] sax ;

New Annotation

Summary:
Author:
Mode:
Body: