[project @ 1999-01-27 14:51:14 by simonpj]
[ghc-hetmet.git] / ghc / compiler / reader / PrefixSyn.lhs
index b61c178..696c4b5 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,34 +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(..),
-       SYN_IE(RdrId),
        RdrMatch(..),
-       SYN_IE(SigConverter),
-       SYN_IE(SrcFile),
-       SYN_IE(SrcFun),
-       SYN_IE(SrcLine),
+       SigConverter,
+       SrcFile,
+       SrcFun,
+       SrcLine,
 
        readInteger
     ) where
 
-IMP_Ubiq()
-IMPORT_1_3(Char(isDigit))
+#include "HsVersions.h"
 
 import HsSyn
 import RdrHsSyn
-import BasicTypes      ( IfaceFlavour )
-import Util            ( panic )
-import SrcLoc           ( SrcLoc )
+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
@@ -45,45 +38,26 @@ type SrcFun  = RdrName
 data RdrBinding
   = RdrNullBind
   | RdrAndBindings     RdrBinding RdrBinding
-
-  | RdrTyDecl          RdrNameTyDecl
-  | RdrFunctionBinding SrcLine [RdrMatch]
-  | RdrPatternBinding  SrcLine [RdrMatch]
-  | RdrClassDecl       RdrNameClassDecl
+  | RdrTyClDecl                RdrNameTyClDecl
+  | RdrValBinding      RdrNameMonoBinds        -- Pattern or function binding
   | RdrInstDecl        RdrNameInstDecl
   | RdrDefaultDecl     RdrNameDefaultDecl
+  | RdrForeignDecl      RdrNameForeignDecl
 
                        -- 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
-                       RdrNameHsType     -- the type
-                       SrcLoc
-
-  -- user pragmas come in in a Sig-ish way/form...
-  | RdrSpecValSig      [RdrNameSig]
-  | RdrInlineValSig    RdrNameSig
-  | RdrMagicUnfoldingSig RdrNameSig
-  | RdrSpecInstSig     RdrNameSpecInstSig
-  | RdrSpecDataSig     RdrNameSpecDataSig
-
-type SigConverter = RdrBinding {- a Sig -} -> [RdrNameSig]
+  | RdrSig             RdrNameSig
+
+type SigConverter = RdrNameSig -> RdrNameSig
 \end{code}
 
 \begin{code}
 data RdrMatch
-  = RdrMatch_NoGuard
-            SrcLine SrcFun
-            RdrNamePat
-            RdrNameHsExpr
-            RdrBinding
-
-  | RdrMatch_Guards
-            SrcLine SrcFun
-            RdrNamePat
-            [([RdrNameStmt], RdrNameHsExpr)]
-            -- (guard,         expr)
-            RdrBinding
+  = RdrMatch
+            [RdrNamePat]
+            (Maybe RdrNameHsType)
+            RdrNameGRHSs
 \end{code}
 
 Unscramble strings representing oct/dec/hex integer literals: