[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:46:47 UTC 2010
The following commit has been merged in the master branch:
commit c861ada3633a2f88b56ebed2b947e934d8987c95
Author: John Goerzen <jgoerzen at complete.org>
Date: Mon Nov 15 09:17:28 2004 +0100
New parser running
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.5--patch-43)
diff --git a/ChangeLog b/ChangeLog
index b4d23c4..20de341 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
#
+2004-11-15 02:17:28 GMT John Goerzen <jgoerzen at complete.org> patch-43
+
+ Summary:
+ New parser running
+ Revision:
+ missingh--head--0.5--patch-43
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Printf.hs testsrc/Printftest.hs
+
+
2004-11-15 02:03:20 GMT John Goerzen <jgoerzen at complete.org> patch-42
Summary:
diff --git a/libsrc/MissingH/Printf.hs b/libsrc/MissingH/Printf.hs
index a4a34a2..e4e2066 100644
--- a/libsrc/MissingH/Printf.hs
+++ b/libsrc/MissingH/Printf.hs
@@ -59,7 +59,7 @@ import Text.Regex
v :: PFType a => a -> Value
v = toValue
-sprintfre = mkRegex "^([#0 +'O-]*)(\\d*)(.\\d*)?([.])"
+sprintfre = mkRegex "^([#0 +'O-]*)([0-9]*)(\\.[0-9]*)?(.)"
toflags :: String -> [Flag]
toflags "" = []
@@ -90,12 +90,13 @@ sprintf ('%' : t : xs) (y:ys) =
sprintf ('%' : xs) (y : ys) =
case matchRegexAll sprintfre xs of
Nothing -> error $ "Problem in format string at %" ++ xs
- Just (_, _, remainder, [flagstr, widthstr, precstr, fmt]) ->
+ --Just (_, _, r, x) -> "<" ++ show x ++ ">" ++ sprintf r ys
+ Just (_, _, remainder, [flagstr, widthstr, precstr, [fmt]]) ->
let width = if widthstr == "" then Nothing else Just (read widthstr)
prec = if precstr == "" then Nothing else Just precstr
flags = toflags flagstr
in
- (get_conversion_func (head fmt) y flags width prec) ++ sprintf remainder ys
+ (get_conversion_func fmt y flags width prec) ++ sprintf remainder ys
_ -> error $ "Problem matching format string at %" ++ xs
sprintf (x:xs) y = x : sprintf xs y
diff --git a/testsrc/Printftest.hs b/testsrc/Printftest.hs
index 1776e09..82c8891 100644
--- a/testsrc/Printftest.hs
+++ b/testsrc/Printftest.hs
@@ -24,6 +24,7 @@ test_vsprintf =
do
"" @=? vsprintf ""
"%" @=? vsprintf "%%"
+ "asdf" @=? vsprintf "%s" "asdf"
"foo: 5" @=? vsprintf "%s: %d" "foo" (5::Integer)
"%foo%:% %-1%\n%" @=? vsprintf "%%%s%%:%% %%%d%%\n%%" "foo" (-1::Integer)
"baz: 3.140000" @=? vsprintf "%s: %f" "baz" (3.14::Double)
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list