diff options
author | Adam Chlipala <adamc@hcoop.net> | 2010-05-27 16:36:17 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2010-05-27 16:36:17 -0400 |
commit | d6b698a6ad00a5f707ae48af039388687ac9b4ba (patch) | |
tree | e323bae4aa24f7a07c4a5c0941b14dc88b97e75a /src/compiler.sml | |
parent | 0091af30d2d24940404e49b30a6d0e2a0e4ba4e7 (diff) |
-moduleOf command-line option; compatibility fixes and better error messages for SQLite
Diffstat (limited to 'src/compiler.sml')
-rw-r--r-- | src/compiler.sml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler.sml b/src/compiler.sml index d39122f0..1d15367f 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -1254,4 +1254,23 @@ fun compiler job = else OS.Process.exit OS.Process.failure +fun moduleOf fname = + let + val mrs = !moduleRoots + val fname = OS.Path.mkCanonical fname + in + case List.find (fn (root, _) => String.isPrefix (root ^ "/") fname) mrs of + NONE => capitalize (OS.Path.base (OS.Path.file fname)) + | SOME (root, name) => + let + val fname = OS.Path.base fname + val fname = String.extract (fname, size root + 1, NONE) + val fs = String.fields (fn ch => ch = #"/") fname + val fs = List.filter (CharVector.exists (fn ch => not (Char.isDigit ch))) fs + val fs = map capitalize fs + in + String.concatWith "." (name :: fs) + end + end + end |