 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs calendar.english combinators
 combinators.smart io.encodings.utf8 io.files kernel math.parser
-memoize namespaces sequences sorting splitting unicode ;
+memoize namespaces sequences sequences.extras sorting splitting
+unicode ;
 IN: zoneinfo
 
 CONSTANT: zoneinfo-paths


: parse-rule ( seq -- rule )
    [
        {
            [ drop ]
            [ ]
            [ ]
            [ ]
            [ ]
            [ ]
            [ ]
            [ ]
            [ ]
            [ ]
        } spread
    ] input<sequence raw-rule boa ;

: parse-zone ( seq -- zone )
    {

        [ 3 tail harvest ]
    } cleave raw-zone boa ;

: parse-line ( seq -- tuple )
    dup first >lower
    {
        { "rule" [ parse-rule ] }
        { "link" [ parse-link ] }
        { "leap" [ parse-leap ] }
        { "zone" [ parse-zone dup last-zone set ] }
        [ drop harvest parse-partial-zone ]
    } case ;

