Mercurial > urweb
comparison src/compiler.sml @ 2211:ef766ef6e242
Merge.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sat, 13 Sep 2014 19:16:07 -0400 |
parents | 0ca11d57c175 88841212f0ba |
children | 365727ff68f4 |
comparison
equal
deleted
inserted
replaced
2210:69c0f36255cb | 2211:ef766ef6e242 |
---|---|
1 (* Copyright (c) 2008-2012, Adam Chlipala | 1 (* Copyright (c) 2008-2012, 2014, Adam Chlipala |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
460 institutionalizeJob job; | 460 institutionalizeJob job; |
461 {Job = job, Libs = []} | 461 {Job = job, Libs = []} |
462 end | 462 end |
463 else | 463 else |
464 let | 464 let |
465 val thisPath = OS.Path.dir fname | |
466 | |
465 val pathmap = ref (!pathmap) | 467 val pathmap = ref (!pathmap) |
466 val bigLibs = ref [] | 468 val bigLibs = ref [] |
467 | 469 |
468 fun pu filename = | 470 fun pu filename = |
469 let | 471 let |
875 | "timeFormat" => Settings.setTimeFormat arg | 877 | "timeFormat" => Settings.setTimeFormat arg |
876 | "noMangleSql" => Settings.setMangleSql false | 878 | "noMangleSql" => Settings.setMangleSql false |
877 | "html5" => Settings.setIsHtml5 true | 879 | "html5" => Settings.setIsHtml5 true |
878 | "lessSafeFfi" => Settings.setLessSafeFfi true | 880 | "lessSafeFfi" => Settings.setLessSafeFfi true |
879 | 881 |
882 | "file" => | |
883 (case String.fields Char.isSpace arg of | |
884 [uri, fname] => (Settings.setFilePath thisPath; | |
885 Settings.addFile {Uri = uri, | |
886 LoadFromFilename = fname}) | |
887 | _ => ErrorMsg.error "Bad 'file' arguments") | |
888 | |
880 | _ => ErrorMsg.error ("Unrecognized command '" ^ cmd ^ "'"); | 889 | _ => ErrorMsg.error ("Unrecognized command '" ^ cmd ^ "'"); |
881 read () | 890 read () |
882 end | 891 end |
883 | 892 |
884 val job = if hasBlankLine then | 893 val job = if hasBlankLine then |
1391 print = MonoPrint.p_file MonoEnv.empty | 1400 print = MonoPrint.p_file MonoEnv.empty |
1392 } | 1401 } |
1393 | 1402 |
1394 val toScriptcheck = transform scriptcheck "scriptcheck" o toNamejs_untangle | 1403 val toScriptcheck = transform scriptcheck "scriptcheck" o toNamejs_untangle |
1395 | 1404 |
1405 val dbmodecheck = { | |
1406 func = DbModeCheck.classify, | |
1407 print = MonoPrint.p_file MonoEnv.empty | |
1408 } | |
1409 | |
1410 val toDbmodecheck = transform dbmodecheck "dbmodecheck" o toScriptcheck | |
1411 | |
1396 val jscomp = { | 1412 val jscomp = { |
1397 func = JsComp.process, | 1413 func = JsComp.process, |
1398 print = MonoPrint.p_file MonoEnv.empty | 1414 print = MonoPrint.p_file MonoEnv.empty |
1399 } | 1415 } |
1400 | 1416 |
1401 val toJscomp = transform jscomp "jscomp" o toScriptcheck | 1417 val toJscomp = transform jscomp "jscomp" o toDbmodecheck |
1402 | 1418 |
1403 val toMono_opt3 = transform mono_opt "mono_opt3" o toJscomp | 1419 val toMono_opt3 = transform mono_opt "mono_opt3" o toJscomp |
1404 | 1420 |
1405 val fuse = { | 1421 val fuse = { |
1406 func = Fuse.fuse, | 1422 func = Fuse.fuse, |
1473 print = CjrPrint.p_sql CjrEnv.empty | 1489 print = CjrPrint.p_sql CjrEnv.empty |
1474 } | 1490 } |
1475 | 1491 |
1476 val toSqlify = transform sqlify "sqlify" o toMono_opt2 | 1492 val toSqlify = transform sqlify "sqlify" o toMono_opt2 |
1477 | 1493 |
1478 val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch) | 1494 fun escapeFilename s = |
1495 "\"" | |
1496 ^ String.translate (fn #"\"" => "\\\"" | #"\\" => "\\\\" | ch => str ch) s | |
1497 ^ "\"" | |
1479 | 1498 |
1480 val beforeC = ref (fn () => ()) | 1499 val beforeC = ref (fn () => ()) |
1481 | 1500 |
1482 structure StringSet = BinarySetFn(struct | 1501 structure StringSet = BinarySetFn(struct |
1483 type ord_key = string | 1502 type ord_key = string |