summaryrefslogtreecommitdiff
path: root/src/corify.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-05-02 13:23:07 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-05-02 13:23:07 -0400
commit3417bfbe670bd15796dd0fa8ca97209acfedfffb (patch)
treeff50f45f052221ffeee46c29630832c2d29d9161 /src/corify.sml
parent471d5a79a82a673ca46d3a4e711f54ae1409c0f3 (diff)
Path rewriting
Diffstat (limited to 'src/corify.sml')
-rw-r--r--src/corify.sml20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/corify.sml b/src/corify.sml
index 6cd2b753..65f32fc2 100644
--- a/src/corify.sml
+++ b/src/corify.sml
@@ -37,16 +37,14 @@ structure SM = BinaryMapFn(struct
val compare = String.compare
end)
-val restify = ref (fn s : string => s)
-
-fun doRestify (mods, s) =
+fun doRestify k (mods, s) =
let
val s = if String.isPrefix "wrap_" s then
String.extract (s, 5, NONE)
else
s
in
- !restify (String.concatWith "/" (rev (s :: mods)))
+ Settings.rewrite k (String.concatWith "/" (rev (s :: mods)))
end
val relify = CharVector.map (fn #"/" => #"_"
@@ -702,7 +700,7 @@ fun corifyDecl mods (all as (d, loc : EM.span), st) =
| L.DVal (x, n, t, e) =>
let
val (st, n) = St.bindVal st x n
- val s = doRestify (mods, x)
+ val s = doRestify Settings.Url (mods, x)
in
([(L'.DVal (x, n, corifyCon st t, corifyExp st e, s), loc)], st)
end
@@ -720,7 +718,7 @@ fun corifyDecl mods (all as (d, loc : EM.span), st) =
val vis = map
(fn (x, n, t, e) =>
let
- val s = doRestify (mods, x)
+ val s = doRestify Settings.Url (mods, x)
in
(x, n, corifyCon st t, corifyExp st e, s)
end)
@@ -982,7 +980,7 @@ fun corifyDecl mods (all as (d, loc : EM.span), st) =
| L.DTable (_, x, n, c, pe, pc, ce, cc) =>
let
val (st, n) = St.bindVal st x n
- val s = relify (doRestify (mods, x))
+ val s = relify (doRestify Settings.Table (mods, x))
in
([(L'.DTable (x, n, corifyCon st c, s,
corifyExp st pe, corifyCon st pc,
@@ -991,14 +989,14 @@ fun corifyDecl mods (all as (d, loc : EM.span), st) =
| L.DSequence (_, x, n) =>
let
val (st, n) = St.bindVal st x n
- val s = relify (doRestify (mods, x))
+ val s = relify (doRestify Settings.Sequence (mods, x))
in
([(L'.DSequence (x, n, s), loc)], st)
end
| L.DView (_, x, n, e, c) =>
let
val (st, n) = St.bindVal st x n
- val s = relify (doRestify (mods, x))
+ val s = relify (doRestify Settings.View (mods, x))
in
([(L'.DView (x, n, s, corifyExp st e, corifyCon st c), loc)], st)
end
@@ -1008,14 +1006,14 @@ fun corifyDecl mods (all as (d, loc : EM.span), st) =
| L.DCookie (_, x, n, c) =>
let
val (st, n) = St.bindVal st x n
- val s = doRestify (mods, x)
+ val s = doRestify Settings.Cookie (mods, x)
in
([(L'.DCookie (x, n, corifyCon st c, s), loc)], st)
end
| L.DStyle (_, x, n) =>
let
val (st, n) = St.bindVal st x n
- val s = relify (doRestify (mods, x))
+ val s = relify (doRestify Settings.Style (mods, x))
in
([(L'.DStyle (x, n, s), loc)], st)
end