Mercurial > urweb
comparison src/compiler.sml @ 1266:459a334345ae
-moduleOf command-line option; compatibility fixes and better error messages for SQLite
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 27 May 2010 16:36:17 -0400 |
parents | 79b2bcac6200 |
children | 56bd4a4f6e66 |
comparison
equal
deleted
inserted
replaced
1265:e8d68fd8ed4b | 1266:459a334345ae |
---|---|
1252 if compile job then | 1252 if compile job then |
1253 () | 1253 () |
1254 else | 1254 else |
1255 OS.Process.exit OS.Process.failure | 1255 OS.Process.exit OS.Process.failure |
1256 | 1256 |
1257 fun moduleOf fname = | |
1258 let | |
1259 val mrs = !moduleRoots | |
1260 val fname = OS.Path.mkCanonical fname | |
1261 in | |
1262 case List.find (fn (root, _) => String.isPrefix (root ^ "/") fname) mrs of | |
1263 NONE => capitalize (OS.Path.base (OS.Path.file fname)) | |
1264 | SOME (root, name) => | |
1265 let | |
1266 val fname = OS.Path.base fname | |
1267 val fname = String.extract (fname, size root + 1, NONE) | |
1268 val fs = String.fields (fn ch => ch = #"/") fname | |
1269 val fs = List.filter (CharVector.exists (fn ch => not (Char.isDigit ch))) fs | |
1270 val fs = map capitalize fs | |
1271 in | |
1272 String.concatWith "." (name :: fs) | |
1273 end | |
1274 end | |
1275 | |
1257 end | 1276 end |