[Fencommits] fenfire-hs: overengineer turtle_escaped to work

Tuukka Hastrup Tuukka.Hastrup at iki.fi
Wed Mar 28 09:43:17 EEST 2007


Wed Mar 28 09:42:37 EEST 2007  Tuukka Hastrup <Tuukka.Hastrup at iki.fi>
  * overengineer turtle_escaped to work
diff -rN -u old-fenfire-hs/Fenfire/RDF.hs new-fenfire-hs/Fenfire/RDF.hs
--- old-fenfire-hs/Fenfire/RDF.hs	2007-03-28 09:43:17.000000000 +0300
+++ new-fenfire-hs/Fenfire/RDF.hs	2007-03-28 09:43:17.000000000 +0300
@@ -144,8 +144,10 @@
 turtle_escaped c ('\r':xs) = '\\': 'r':turtle_escaped c xs
 turtle_escaped c ('\t':xs) = '\\': 't':turtle_escaped c xs
 turtle_escaped c    (x:xs) | i <- fromEnum x, i < 0x20 || i == 0x5C 
-                           = '\\':'u':((if i<16 then ('0':) else id) $
+                           = '\\':'u':(p 4 (Numeric.showHex i "") $
                                        Numeric.showHex i (turtle_escaped c xs))
+    where p n s rest | n > length s = '0':p n ('0':s) rest
+                     | otherwise    = rest
 turtle_escaped c (   x:xs) =         x:turtle_escaped c xs
 
 subject :: Triple -> Node




More information about the Fencommits mailing list