summaryrefslogtreecommitdiff
path: root/src/compiler.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-01-12 11:07:39 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-01-12 11:07:39 -0500
commita91077596a525b0456a2c234df4a7b0cd1c6ff9f (patch)
treee3f2eab582c8634cefeb2698d79930f02115505e /src/compiler.sml
parentb7b292f806c4e26b23ede86c5ee3167f62148867 (diff)
-path and -root command-line flags
Diffstat (limited to 'src/compiler.sml')
-rw-r--r--src/compiler.sml18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 625d71ff..5fba9ae0 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -338,7 +338,7 @@ fun parseUrp' accLibs fname =
let
val fname = String.implode (List.filter (fn x => not (Char.isSpace x))
(String.explode line))
- val fname = relify fname
+ val fname = relifyA fname
in
fname :: acc
end
@@ -709,6 +709,7 @@ val parse = {
val ds = #func parseUr ur
val d = (Source.DStr (mname, sgnO, (Source.StrConst ds, loc)), loc)
+ val fname = OS.Path.mkCanonical fname
val d = case List.find (fn (root, name) =>
String.isPrefix (root ^ "/") fname) mrs of
NONE => d
@@ -766,10 +767,21 @@ val parse = {
();
let
- val final = nameOf (List.last fnames)
+ val final = List.last fnames
+ val final = case List.find (fn (root, name) =>
+ String.isPrefix (root ^ "/") final) mrs of
+ NONE => (Source.StrVar (nameOf final), loc)
+ | SOME (root, name) =>
+ let
+ val m = (Source.StrVar name, loc)
+ val final = String.extract (final, size root + 1, NONE)
+ in
+ foldl (fn (x, m) => (Source.StrProj (m, capitalize x), loc))
+ m (String.fields (fn ch => ch = #"/") final)
+ end
val ds = dsFfi @ ds
- @ [(Source.DExport (Source.StrVar final, loc), loc)]
+ @ [(Source.DExport final, loc)]
val ds = case database of
NONE => ds