[project @ 1996-06-26 10:26:00 by partain]
[ghc-hetmet.git] / ghc / compiler / reader / PrefixSyn.lhs
index 6dc0e55..cd4d1b8 100644 (file)
@@ -1,5 +1,5 @@
 %
-% (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
 %
 \section[PrefixSyn]{``Prefix-form'' syntax}
 
@@ -12,26 +12,31 @@ order that follows the \tr{Prefix_Form} document.
 
 module PrefixSyn (
        RdrBinding(..),
-       RdrId(..),
+       SYN_IE(RdrId),
        RdrMatch(..),
-       RdrTySigPragmas(..),
-       SigConverter(..),
-       SrcFile(..),
-       SrcFun(..),
-       SrcLine(..),
+       SYN_IE(SigConverter),
+       SYN_IE(SrcFile),
+       SYN_IE(SrcFun),
+       SYN_IE(SrcLine),
 
        readInteger
     ) where
 
-import AbsSyn
-import ProtoName       ( ProtoName(..) ) -- .. is for pragmas only
-import Outputable
-import Util            -- pragmas only
+IMP_Ubiq()
+IMPORT_1_3(Char(isDigit))
 
-type RdrId   = ProtoName
+import HsSyn
+import RdrHsSyn
+import Util            ( panic )
+
+#ifdef REALLY_HASKELL_1_3
+ord = fromEnum :: Char -> Int
+#endif
+
+type RdrId   = RdrName
 type SrcLine = Int
 type SrcFile = FAST_STRING
-type SrcFun  = FAST_STRING
+type SrcFun  = RdrName
 \end{code}
 
 \begin{code}
@@ -39,47 +44,45 @@ data RdrBinding
   = RdrNullBind
   | RdrAndBindings     RdrBinding RdrBinding
 
-  | RdrTyData          ProtoNameTyDecl
-  | RdrTySynonym       ProtoNameTyDecl
+  | RdrTyDecl          RdrNameTyDecl
   | 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
+  | 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           [ProtoName]         -- vars getting sigs
-                       ProtoNamePolyType   -- the type
-                       RdrTySigPragmas     -- val/class-op pragmas
+  | RdrTySig           [RdrName]           -- vars getting sigs
+                       RdrNamePolyType     -- the type
                        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]
+  | RdrSpecValSig      [RdrNameSig]
+  | RdrInlineValSig    RdrNameSig
+  | RdrDeforestSig     RdrNameSig
+  | RdrMagicUnfoldingSig RdrNameSig
+  | RdrSpecInstSig     RdrNameSpecInstSig
+  | RdrSpecDataSig     RdrNameSpecDataSig
+
+type SigConverter = RdrBinding {- a Sig -} -> [RdrNameSig]
 \end{code}
 
 \begin{code}
 data RdrMatch
-  = RdrMatch SrcLine SrcFun ProtoNamePat [(ProtoNameExpr, ProtoNameExpr)] RdrBinding
-                                      -- (guard,         expr)
+  = RdrMatch_NoGuard
+            SrcLine SrcFun
+            RdrNamePat
+            RdrNameHsExpr
+            RdrBinding
+
+  | RdrMatch_Guards
+            SrcLine SrcFun
+            RdrNamePat
+            [(RdrNameHsExpr, RdrNameHsExpr)]
+            -- (guard,         expr)
+            RdrBinding
 \end{code}
 
 Unscramble strings representing oct/dec/hex integer literals: