[project @ 1999-06-01 16:15:42 by simonmar]
[ghc-hetmet.git] / ghc / compiler / reader / PrefixSyn.lhs
index 8cd388b..cf2419b 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 %
 \section[PrefixSyn]{``Prefix-form'' syntax}
 
@@ -8,31 +8,27 @@ string from the current Haskell parser is converted.  Given in an
 order that follows the \tr{Prefix_Form} document.
 
 \begin{code}
-#include "HsVersions.h"
-
 module PrefixSyn (
        RdrBinding(..),
-       RdrId(..),
        RdrMatch(..),
-       SigConverter(..),
-       SrcFile(..),
-       SrcFun(..),
-       SrcLine(..),
+       SigConverter,
+       SrcFile,
+       SrcFun,
+       SrcLine,
 
        readInteger
     ) where
 
-IMP_Ubiq()
+#include "HsVersions.h"
 
 import HsSyn
 import RdrHsSyn
-import Util            ( panic )
+import RdrName         ( RdrName )
+import Panic           ( panic )
+import Char            ( isDigit, ord )
 
-#ifdef REALLY_HASKELL_1_3
-ord = fromEnum :: Char -> Int
-#endif
 
-type RdrId   = RdrName
+--UNUSED: type RdrId   = RdrName
 type SrcLine = Int
 type SrcFile = FAST_STRING
 type SrcFun  = RdrName
@@ -40,48 +36,31 @@ type SrcFun  = RdrName
 
 \begin{code}
 data RdrBinding
-  = RdrNullBind
+  =    -- On input we use the Empty/And form rather than a list
+    RdrNullBind
   | RdrAndBindings     RdrBinding RdrBinding
 
-  | RdrTyDecl          RdrNameTyDecl
-  | RdrFunctionBinding SrcLine [RdrMatch]
-  | RdrPatternBinding  SrcLine [RdrMatch]
-  | RdrClassDecl       RdrNameClassDecl
-  | RdrInstDecl        RdrNameInstDecl
-  | RdrDefaultDecl     RdrNameDefaultDecl
-
-                       -- signatures are mysterious; we can't
-                       -- tell if its a Sig or a ClassOpSig,
-                       -- so we just save the pieces:
-  | RdrTySig           [RdrName]           -- vars getting sigs
-                       RdrNamePolyType     -- the type
-                       SrcLoc
-
-  -- user pragmas come in in a Sig-ish way/form...
-  | RdrSpecValSig      [RdrNameSig]
-  | RdrInlineValSig    RdrNameSig
-  | RdrDeforestSig     RdrNameSig
-  | RdrMagicUnfoldingSig RdrNameSig
-  | RdrSpecInstSig     RdrNameSpecInstSig
-  | RdrSpecDataSig     RdrNameSpecDataSig
-
-type SigConverter = RdrBinding {- a Sig -} -> [RdrNameSig]
+       -- Value bindings havn't been united with their
+       -- signatures yet
+  | RdrValBinding      RdrNameMonoBinds
+
+       -- Signatures are mysterious; we can't
+       -- tell if its a Sig or a ClassOpSig,
+       -- so we just save the pieces:
+  | RdrSig             RdrNameSig
+
+       -- The remainder all fit into the main HsDecl form
+  | RdrHsDecl          RdrNameHsDecl
+
+type SigConverter = RdrNameSig -> RdrNameSig
 \end{code}
 
 \begin{code}
 data RdrMatch
-  = RdrMatch_NoGuard
-            SrcLine SrcFun
-            RdrNamePat
-            RdrNameHsExpr
-            RdrBinding
-
-  | RdrMatch_Guards
-            SrcLine SrcFun
-            RdrNamePat
-            [(RdrNameHsExpr, RdrNameHsExpr)]
-            -- (guard,         expr)
-            RdrBinding
+  = RdrMatch
+            [RdrNamePat]
+            (Maybe RdrNameHsType)
+            RdrNameGRHSs
 \end{code}
 
 Unscramble strings representing oct/dec/hex integer literals: