File: ppprim.sml

package info (click to toggle)
smlnj 110.79-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 82,552 kB
  • sloc: ansic: 32,532; asm: 6,314; sh: 2,303; makefile: 1,821; perl: 1,170; pascal: 295; yacc: 190; cs: 78; python: 77; lisp: 19
file content (38 lines) | stat: -rw-r--r-- 1,095 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
structure PPPrim =
struct

local 
  structure PP = PrettyPrintNew
  structure PU = PPUtilNew   
  open PPUtilNew
in

fun ppPrim ppstrm prim =
    let val pps = PU.pps ppstrm
    in (case prim
	  of PrimOpId.NonPrim => pps "<NonPrim>"
	   | PrimOpId.Prim(name) =>
             (pps "<PrimE "; pps name; pps ">"))
    end (* function ppPrim *)

fun ppStrPrimInfo ppstrm strPrimInfo =
    let val {openHOVBox, closeBox, pps, ...} = en_pp ppstrm
	fun ppStrPrimElem ppstrm (PrimOpId.PrimE p) = ppPrim ppstrm p
	  | ppStrPrimElem ppstrm (PrimOpId.StrE ps) = ppStrPrimInfo ppstrm ps
    in
	ppSequence ppstrm 
         {sep = fn ppstrm => (PP.string ppstrm ", ";
                              PP.break ppstrm {nsp=1, offset=0}),
          pr = (fn _ => fn elem => 
                           (openHOVBox 1; 
                            pps "(";
                            ppStrPrimElem ppstrm;
                            pps ")";
                            closeBox())),
          style = INCONSISTENT}
	 strPrimInfo
    end (* function ppStrPrimInfo *)

end (* local *)

end (* structure PPPrim *)