]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix simple-flat-file
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 8 Mar 2009 02:55:55 +0000 (20:55 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 8 Mar 2009 02:55:55 +0000 (20:55 -0600)
basis/simple-flat-file/simple-flat-file.factor

index 721f4986a0dfc5095d1ac89c3dff376e14b2338c..403fc4d14b82e0a4b8056d0d5120184e867c3dbf 100644 (file)
@@ -7,10 +7,13 @@ IN: simple-flat-file
     [ "#" split1 drop ] map harvest ;
 
 : split-column ( line -- columns )
-    " \t" split harvest 2 head ;
+    " \t" split harvest 2 short head 2 f pad-tail ;
 
 : parse-hex ( s -- n )
-    2 short tail hex> ;
+    dup [
+        "0x" ?head [ "U+" ?head [ "Missing 0x or U+" throw ] unless ] unless
+        hex>
+    ] when ;
 
 : parse-line ( line -- code-unicode )
     split-column [ parse-hex ] map ;