From e9e72bd1cd7776609aa7d7f5e71edc4c2edced4d Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 27 Nov 2003 13:26:39 +0000 Subject: [PATCH 1/1] [project @ 2003-11-27 13:26:38 by simonmar] On reflection, using the '!!' prefix for unboxing a constructor field was a mistake: firstly it has to be written '! !', and secondly it isn't backwards-compatible. So instead, we now use the syntax: data T = T {-# UNPACK #-} !Int to unbox a field. We thought this would be a cute reuse of the UNPACK pragma. The effect of -funbox-strict-fields is to add {-# UNPACK #-} to every strict field. --- ghc/compiler/parser/Lexer.x | 2 ++ ghc/compiler/parser/Parser.y | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/parser/Lexer.x b/ghc/compiler/parser/Lexer.x index ccfc3e8..bb32d63 100644 --- a/ghc/compiler/parser/Lexer.x +++ b/ghc/compiler/parser/Lexer.x @@ -174,6 +174,7 @@ $white_no_nl+ ; { token ITdeprecated_prag } "{-#" $whitechar* (SCC|scc) { token ITscc_prag } "{-#" $whitechar* (CORE|core) { token ITcore_prag } + "{-#" $whitechar* (UNPACK|unpack) { token ITunpack_prag } "{-#" { nested_comment } @@ -349,6 +350,7 @@ data Token__ | ITline_prag | ITscc_prag | ITcore_prag -- hdaume: core annotations + | ITunpack_prag | ITclose_prag | ITdotdot -- reserved symbols diff --git a/ghc/compiler/parser/Parser.y b/ghc/compiler/parser/Parser.y index 9333122..965863a 100644 --- a/ghc/compiler/parser/Parser.y +++ b/ghc/compiler/parser/Parser.y @@ -1,6 +1,6 @@ {- -*-haskell-*- ----------------------------------------------------------------------------- -$Id: Parser.y,v 1.130 2003/11/26 10:07:19 simonmar Exp $ +$Id: Parser.y,v 1.131 2003/11/27 13:26:39 simonmar Exp $ Haskell grammar. @@ -137,6 +137,7 @@ Conflicts: 29 shift/reduce, [SDM 19/9/2002] '{-# CORE' { T _ _ ITcore_prag } -- hdaume: annotated core '{-# SCC' { T _ _ ITscc_prag } '{-# DEPRECATED' { T _ _ ITdeprecated_prag } + '{-# UNPACK' { T _ _ ITunpack_prag } '#-}' { T _ _ ITclose_prag } '..' { T _ _ ITdotdot } -- reserved symbols @@ -827,7 +828,7 @@ stype :: { RdrNameBangType } strict_mark :: { HsBang } : '!' { HsStrict } - | '!' '!' { HsUnbox } + | '{-# UNPACK' '#-}' '!' { HsUnbox } deriving :: { Maybe RdrNameContext } : {- empty -} { Nothing } -- 1.7.10.4