Show channel attributes in occam code.

This commit is contained in:
Adam Sampson 2008-06-09 12:36:26 +00:00
parent 23e1ba2eec
commit 19484ec72e

View File

@ -249,7 +249,20 @@ instance ShowOccam A.Type where
A.Dimension n -> tell ["["] >> showOccamM n >> tell ["]"]
A.UnknownDimension -> tell ["[]"]
| d <- ds]
showOccamM (A.Chan _ _ t) = tell ["CHAN "] >> showOccamM t
showOccamM (A.Chan dir ca t)
= tell [shared, "CHAN", direction, " "] >> showOccamM t
where
shared
= case (A.caWritingShared ca, A.caReadingShared ca) of
(False, False) -> ""
(True, False) -> "SHARED! "
(False, True) -> "SHARED? "
(True, True) -> "SHARED "
direction
= case dir of
A.DirInput -> "?"
A.DirOutput -> "!"
A.DirUnknown -> ""
showOccamM (A.Counted ct et) = showOccamM ct >> tell ["::"] >> showOccamM et
showOccamM (A.Port t) = tell ["PORT "] >> showOccamM t
showOccamM (A.UserDataType n) = showName n >> helper "{data type}"