[project @ 1999-06-01 16:15:42 by simonmar]
[ghc-hetmet.git] / ghc / compiler / reader / PrefixSyn.lhs
index 6dc0e55..cf2419b 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 %
 \section[PrefixSyn]{``Prefix-form'' syntax}
 
@@ -8,78 +8,59 @@ 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(..),
-       RdrTySigPragmas(..),
-       SigConverter(..),
-       SrcFile(..),
-       SrcFun(..),
-       SrcLine(..),
+       SigConverter,
+       SrcFile,
+       SrcFun,
+       SrcLine,
 
        readInteger
     ) where
 
-import AbsSyn
-import ProtoName       ( ProtoName(..) ) -- .. is for pragmas only
-import Outputable
-import Util            -- pragmas only
+#include "HsVersions.h"
+
+import HsSyn
+import RdrHsSyn
+import RdrName         ( RdrName )
+import Panic           ( panic )
+import Char            ( isDigit, ord )
 
-type RdrId   = ProtoName
+
+--UNUSED: type RdrId   = RdrName
 type SrcLine = Int
 type SrcFile = FAST_STRING
-type SrcFun  = FAST_STRING
+type SrcFun  = RdrName
 \end{code}
 
 \begin{code}
 data RdrBinding
-  = RdrNullBind
+  =    -- On input we use the Empty/And form rather than a list
+    RdrNullBind
   | RdrAndBindings     RdrBinding RdrBinding
 
-  | RdrTyData          ProtoNameTyDecl
-  | RdrTySynonym       ProtoNameTyDecl
-  | RdrFunctionBinding SrcLine [RdrMatch]
-  | RdrPatternBinding  SrcLine [RdrMatch]
-  | RdrClassDecl       ProtoNameClassDecl
-  | RdrInstDecl        ( FAST_STRING{-original  module's name-} ->
-                         FAST_STRING{-informant module's name-} ->
-                         Bool{-from here?-} ->
-                         ProtoNameInstDecl )
-  | RdrDefaultDecl     ProtoNameDefaultDecl
-  | RdrIfaceImportDecl IfaceImportDecl
-
-                       -- signatures are mysterious; we can't
-                       -- tell if its a Sig or a ClassOpSig,
-                       -- so we just save the pieces:
-  | RdrTySig           [ProtoName]         -- vars getting sigs
-                       ProtoNamePolyType   -- the type
-                       RdrTySigPragmas     -- val/class-op pragmas
-                       SrcLoc
-
-  -- user pragmas come in in a Sig-ish way/form...
-  | RdrSpecValSig      [ProtoNameSig]
-  | RdrInlineValSig    ProtoNameSig
-  | RdrDeforestSig     ProtoNameSig
-  | RdrMagicUnfoldingSig ProtoNameSig
-  | RdrSpecInstSig     ProtoNameSpecialisedInstanceSig
-  | RdrAbstractTypeSig  ProtoNameDataTypeSig
-  | RdrSpecDataSig     ProtoNameDataTypeSig
-
-data RdrTySigPragmas
-  = RdrNoPragma
-  | RdrGenPragmas      ProtoNameGenPragmas
-  | RdrClassOpPragmas  ProtoNameClassOpPragmas
-
-type SigConverter = RdrBinding {- a RdrTySig... -} -> [ProtoNameSig]
+       -- 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 SrcLine SrcFun ProtoNamePat [(ProtoNameExpr, ProtoNameExpr)] RdrBinding
-                                      -- (guard,         expr)
+  = RdrMatch
+            [RdrNamePat]
+            (Maybe RdrNameHsType)
+            RdrNameGRHSs
 \end{code}
 
 Unscramble strings representing oct/dec/hex integer literals: