freebsd-ports/textproc/sml-fxp/files/patch-src-Unicode-Uri-uri.sml
Thomas Abthorpe 7542e5c15d fxp is a validating XML parser written completely in the functional
programming language SML. fxp can validate both XML 1.0 and XML 1.1
documents. It has a programming interface allowing for production of XML
applications based on fxp. It is installed with four example applications.

WWW: http://www2.informatik.tu-muenchen.de/~berlea/Fxp

PR:		ports/116572
Submitted by:	Timothy Bourke <timbob at bigpond.com>
2007-10-04 03:02:59 +00:00

36 lines
1.2 KiB
Standard ML

--- src/Unicode/Uri/uri.sml.orig Mon May 28 15:04:18 2007
+++ src/Unicode/Uri/uri.sml Mon May 28 15:05:32 2007
@@ -50,6 +50,8 @@
val slash = "/"
+ fun substringAll s = Substring.substring(s, 0, String.size s)
+
fun uriSuffix s =
let fun search i = if i<0 then NONE else case String.sub(s,i)
of #"." => SOME i
@@ -154,7 +156,7 @@
fun convertCommand str (src,dst) =
let
- val s = Substring.all str
+ val s = substringAll str
fun doit ss s =
if Substring.isEmpty s then ss
else let val (sl,sr) = Substring.splitr (fn c => #"%"<>c) s
@@ -162,12 +164,12 @@
else let val sl' = Substring.trimr 1 sl
in case Substring.first sr
of SOME #"1" => let val sr' = Substring.triml 1 sr
- in doit (Substring.all src::sr'::ss) sl'
+ in doit (substringAll src::sr'::ss) sl'
end
| SOME #"2" => let val sr' = Substring.triml 1 sr
- in doit (Substring.all dst::sr'::ss) sl'
+ in doit (substringAll dst::sr'::ss) sl'
end
- | _ => doit (Substring.all "%"::sr::ss) sl'
+ | _ => doit (substringAll "%"::sr::ss) sl'
end
end
val ss = doit nil s