36 |
|
|
37 |
val context = AbsPath.relativeContext (AbsPath.dir specgroup) |
val context = AbsPath.relativeContext (AbsPath.dir specgroup) |
38 |
val specname = AbsPath.name specgroup |
val specname = AbsPath.name specgroup |
39 |
val stream = TextIO.openIn specname |
val _ = Say.vsay ["[reading init spec from ", specname, "]\n"] |
40 |
|
val stream = AbsPath.openTextIn specgroup |
41 |
val source = S.newSource (specname, 1, stream, false, errcons) |
val source = S.newSource (specname, 1, stream, false, errcons) |
42 |
val sourceMap = #sourceMap source |
val sourceMap = #sourceMap source |
43 |
|
|
99 |
val n = DG.SNODE { smlinfo = i, |
val n = DG.SNODE { smlinfo = i, |
100 |
localimports = li, |
localimports = li, |
101 |
globalimports = gi } |
globalimports = gi } |
102 |
|
val pl' = |
103 |
|
case pl of |
104 |
|
NONE => NONE |
105 |
|
| SOME l => SOME (p :: l) |
106 |
in |
in |
107 |
loop (split, |
loop (split, |
108 |
StringMap.insert (m, name, DG.SB_SNODE n), |
StringMap.insert (m, name, DG.SB_SNODE n), |
109 |
p :: pl, newpos) |
pl', newpos) |
110 |
end |
end |
111 |
in |
in |
112 |
case line of |
case line of |
113 |
[] => loop (split, m, pl, newpos) |
[] => loop (split, m, pl, newpos) |
114 |
| ["split"] => loop (true, m, pl, newpos) |
| ["split"] => loop (true, m, pl, newpos) |
115 |
| ["nosplit"] => loop (false, m, pl, newpos) |
| ["nosplit"] => loop (false, m, pl, newpos) |
116 |
| ("let" :: name :: file :: args) => |
| ["start"] => loop (split, m, SOME [], newpos) |
117 |
|
| ("bind" :: name :: file :: args) => |
118 |
node (name, file, args) |
node (name, file, args) |
119 |
| ("return" :: rts :: core :: pervasive :: prims) => |
| ("return" :: rts :: core :: pervasive :: prims) => |
120 |
|
(Say.vsay ["[init spec read successfully]\n"]; |
121 |
SOME { rts = look_snode rts, |
SOME { rts = look_snode rts, |
122 |
core = look_snode core, |
core = look_snode core, |
123 |
pervasive = look_snode pervasive, |
pervasive = look_snode pervasive, |
124 |
primitives = |
primitives = |
125 |
map (fn n => (n, look_snode n)) prims, |
map (fn n => (n, look_snode n)) prims, |
126 |
filepaths = rev pl } |
filepaths = rev (getOpt (pl, [])) }) |
127 |
| _ => (error "malformed line"; NONE) |
| _ => (error "malformed line"; NONE) |
128 |
end |
end |
129 |
in |
in |
130 |
loop (false, StringMap.empty, [], 2) (* consistent with ml-lex bug? *) |
(* 2: consistent with ml-lex bug? *) |
131 |
|
loop (false, StringMap.empty, NONE, 2) |
132 |
end |
end |
133 |
end |
end |