summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2003-11-27 13:26:39 +0000
committersimonmar <unknown>2003-11-27 13:26:39 +0000
commite9e72bd1cd7776609aa7d7f5e71edc4c2edced4d (patch)
tree4e71dae6f4aad30bab9a16b428bdf98e31835c3f
parentf901ffc86ada53aaa65a3d941d344b9c036a6147 (diff)
downloadhaskell-e9e72bd1cd7776609aa7d7f5e71edc4c2edced4d.tar.gz
[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.
-rw-r--r--ghc/compiler/parser/Lexer.x2
-rw-r--r--ghc/compiler/parser/Parser.y5
2 files changed, 5 insertions, 2 deletions
diff --git a/ghc/compiler/parser/Lexer.x b/ghc/compiler/parser/Lexer.x
index ccfc3e8505..bb32d631b3 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 9333122c75..965863abb9 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 }