comparison src/source_print.sml @ 40:e3d3c2791105

Functor parsing
author Adam Chlipala <adamc@hcoop.net>
date Thu, 19 Jun 2008 15:15:00 -0400
parents 44b5405e74c7
children b3fbbc6cb1e5
comparison
equal deleted inserted replaced
39:02f42e9a1825 40:e3d3c2791105
245 newline, 245 newline,
246 p_list_sep newline p_sgn_item sgis, 246 p_list_sep newline p_sgn_item sgis,
247 newline, 247 newline,
248 string "end"] 248 string "end"]
249 | SgnVar x => string x 249 | SgnVar x => string x
250 | SgnFun (x, sgn, sgn') => box [string "functor",
251 space,
252 string "(",
253 string x,
254 space,
255 string ":",
256 p_sgn sgn,
257 string ")",
258 space,
259 string ":",
260 space,
261 p_sgn sgn']
250 262
251 fun p_decl ((d, _) : decl) = 263 fun p_decl ((d, _) : decl) =
252 case d of 264 case d of
253 DCon (x, NONE, c) => box [string "con", 265 DCon (x, NONE, c) => box [string "con",
254 space, 266 space,
322 string "end"] 334 string "end"]
323 | StrVar x => string x 335 | StrVar x => string x
324 | StrProj (str, x) => box [p_str str, 336 | StrProj (str, x) => box [p_str str,
325 string ".", 337 string ".",
326 string x] 338 string x]
339 | StrFun (x, sgn, NONE, str) => box [string "functor",
340 space,
341 string "(",
342 string x,
343 space,
344 string ":",
345 p_sgn sgn,
346 string ")",
347 space,
348 string "=>",
349 space,
350 p_str str]
351 | StrFun (x, sgn, SOME sgn', str) => box [string "functor",
352 space,
353 string "(",
354 string x,
355 space,
356 string ":",
357 p_sgn sgn,
358 string ")",
359 space,
360 string ":",
361 space,
362 p_sgn sgn',
363 space,
364 string "=>",
365 space,
366 p_str str]
327 367
328 val p_file = p_list_sep newline p_decl 368 val p_file = p_list_sep newline p_decl
329 369
330 end 370 end