diff options
Diffstat (limited to 'ghc/compiler/parser')
-rw-r--r-- | ghc/compiler/parser/Lex.lhs | 2 | ||||
-rw-r--r-- | ghc/compiler/parser/Parser.y | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/ghc/compiler/parser/Lex.lhs b/ghc/compiler/parser/Lex.lhs index 6c69738d9f..9cd6567c50 100644 --- a/ghc/compiler/parser/Lex.lhs +++ b/ghc/compiler/parser/Lex.lhs @@ -123,6 +123,7 @@ data Token | ITccallconv | ITinterface -- interface keywords + | ITexpr | IT__export | ITdepends | IT__forall @@ -295,6 +296,7 @@ ghcExtensionKeywordsFM = listToUFM $ -- interface keywords ("__interface", ITinterface), + ("__expr", ITexpr), ("__export", IT__export), ("__depends", ITdepends), ("__forall", IT__forall), diff --git a/ghc/compiler/parser/Parser.y b/ghc/compiler/parser/Parser.y index 779c235abe..9dc85a293c 100644 --- a/ghc/compiler/parser/Parser.y +++ b/ghc/compiler/parser/Parser.y @@ -1,6 +1,6 @@ {- ----------------------------------------------------------------------------- -$Id: Parser.y,v 1.47 2000/11/07 15:21:40 simonmar Exp $ +$Id: Parser.y,v 1.48 2000/11/16 11:39:37 simonmar Exp $ Haskell grammar. @@ -9,7 +9,7 @@ Author(s): Simon Marlow, Sven Panne 1997, 1998, 1999 -} { -module Parser ( parse ) where +module Parser ( ParseStuff(..), parse ) where import HsSyn import HsTypes ( mkHsTupCon ) @@ -113,6 +113,8 @@ Conflicts: 14 shift/reduce '{-# DEPRECATED' { ITdeprecated_prag } '#-}' { ITclose_prag } + '__expr' { ITexpr } + {- '__interface' { ITinterface } -- interface keywords '__export' { IT__export } @@ -202,6 +204,13 @@ Conflicts: 14 shift/reduce %% ----------------------------------------------------------------------------- +-- Entry points + +parse :: { ParseStuff } + : module { PModule $1 } + | '__expr' exp { PExpr $2 } + +----------------------------------------------------------------------------- -- Module Header -- The place for module deprecation is really too restrictive, but if it @@ -1096,6 +1105,8 @@ commas :: { Int } ----------------------------------------------------------------------------- { +data ParseStuff = PModule RdrNameHsModule | PExpr RdrNameHsExpr + happyError :: P a happyError buf PState{ loc = loc } = PFailed (srcParseErr buf loc) } |