Make Show Type produce occam-looking types, for nicer error messages
This commit is contained in:
parent
b6537890e0
commit
5c0a152320
25
fco2/AST.hs
25
fco2/AST.hs
|
@ -49,7 +49,30 @@ data Type =
|
|||
| Any
|
||||
| Timer
|
||||
| Port Type
|
||||
deriving (Show, Eq, Typeable, Data)
|
||||
deriving (Eq, Typeable, Data)
|
||||
|
||||
instance Show Type where
|
||||
show Bool = "BOOL"
|
||||
show Byte = "BYTE"
|
||||
show Int = "INT"
|
||||
show Int16 = "INT16"
|
||||
show Int32 = "INT32"
|
||||
show Int64 = "INT64"
|
||||
show Real32 = "REAL32"
|
||||
show Real64 = "REAL64"
|
||||
show (Array ds t)
|
||||
= concat [case d of
|
||||
Dimension n -> "[" ++ show n ++ "]"
|
||||
UnknownDimension -> "[]"
|
||||
| d <- ds] ++ show t
|
||||
show (UserDataType n) = nameName n ++ "{data type}"
|
||||
show (Record n) = nameName n ++ "{record}"
|
||||
show (UserProtocol n) = nameName n ++ "{protocol}"
|
||||
show (Chan t) = "CHAN OF " ++ show t
|
||||
show (Counted ct et) = show ct ++ "::" ++ show et
|
||||
show Any = "ANY"
|
||||
show Timer = "TIMER"
|
||||
show (Port t) = "PORT OF " ++ show t
|
||||
|
||||
data Dimension =
|
||||
Dimension Int
|
||||
|
|
|
@ -10,8 +10,6 @@ that takes several expressions.
|
|||
(Multi-subscript expressions like a[x][y] currently get pulled up into an array
|
||||
slice, which is inefficient.)
|
||||
|
||||
The show instance for types should produce occam-looking types.
|
||||
|
||||
ParseState should be called something more sensible, since most of it has
|
||||
nothing to do with parsing.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user