 
 ERROR: zone-not-found name ;
 
-: find-zone ( string -- rules )
+: find-zone ( string -- zone )
     raw-zone-map
     [ last ] assoc-map ?at [ zone-not-found ] unless ;
 
 : find-zone-rules ( string -- zone rules )
     find-zone dup rules/save>> find-rules ;
+
+: zone-abbrevs ( -- assoc )
+    zoneinfo-zones [
+        find-zone-rules [ format>> ] dip
+        [
+            letters>> swap "%" split1 dup [ 1 tail ] when surround
+        ] with V{ } map-as
+    ] map-zip ;
 
 : number>value ( n -- n' )
     {

        [ in>> month-abbreviation-index ]
        [ on>> on>value ]
    } cleave>array ;

! "Europe/Helsinki" find-zone-rules

! Rule
! name - string
! from - year or "min"
! name    "France"
! from    "1938"  or "min"
! to      "1945" or "max" or "only"
! type    "-"  always "-"
! in      "Mar"  -- 3-letter month name
! on      "26"  or "Mon>=15"  or lastSun lastFri
! at      "23:00s"  "12:13:00s" "1:00s" "1:00u"
! save    "-0:00:05" "1:00" "0:14:15"
! letters "S" or "-" or "AMT" "BDST"

! Zone
! name       "Indian/Maldives"
! gmt-offset "4:54:00" "9:55:56" "-9:55:56"
! rules/save "-" "0:20" "0:30" "1:00" "AN" "W-Eur" "Winn" "Zion" "sol87" "sol88"
! format     "LMT" "%s" "%sT" "A%sT" "AC%sT" "ACT"
! until      { "1880" }
    ! { "1847" "Dec" "1" "0:00s" }
    ! { "1883" "Nov" "18" "12:12:57" }
    ! { "1989" "Sep" "lastSun" "2:00s" }

! Link
! T{ link { from "Asia/Riyadh88" } { to "Mideast/Riyadh88" } }

GENERIC: zone-matches? ( string rule -- ? )

M: raw-rule zone-matches? name>> = ;
M: raw-link zone-matches? from>> = ;
M: raw-leap zone-matches? 2drop f ;
M: raw-zone zone-matches? name>> = ;

: find-rules ( string -- rules )
    raw-rule-map
