From 2ca8dfd4613f8a26256f9b61589900fdc78494e3 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 24 Apr 2002 15:57:48 +0000 Subject: [haddock @ 2002-04-24 15:57:47 by simonmar] Handle gcons in export lists (a common extension). --- src/HsParser.ly | 16 ++++++++-------- src/HsSyn.lhs | 10 ++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/HsParser.ly b/src/HsParser.ly index 749b466a..26829cd9 100644 --- a/src/HsParser.ly +++ b/src/HsParser.ly @@ -1,5 +1,5 @@ q----------------------------------------------------------------------------- -$Id: HsParser.ly,v 1.2 2002/04/10 13:23:55 simonmar Exp $ +$Id: HsParser.ly,v 1.3 2002/04/24 15:57:47 simonmar Exp $ (c) Simon Marlow, Sven Panne 1997-2000 @@ -206,7 +206,7 @@ The Export List > qcname :: { HsQName } > : qvar { $1 } -> | qcon { $1 } +> | gcon { $1 } ----------------------------------------------------------------------------- Import Declarations @@ -608,7 +608,7 @@ other implementations don't manage this either. > aexp1 :: { HsExp } > : qvar { HsVar $1 } -> | gcon { $1 } +> | gcon { HsCon $1 } > | literal { $1 } > | '(' exp ')' { HsParen $2 } > | '(' texps ')' { HsTuple True $2 } @@ -725,11 +725,11 @@ Record Field Update/Construction ----------------------------------------------------------------------------- Variables, Constructors and Operators. -> gcon :: { HsExp } -> : '(' ')' { unit_con } -> | '[' ']' { HsList [] } -> | '(' commas ')' { tuple_con $2 } -> | qcon { HsCon $1 } +> gcon :: { HsQName } +> : '(' ')' { unit_con_name } +> | '[' ']' { nil_con_name } +> | '(' commas ')' { tuple_con_name $2 } +> | qcon { $1 } > var :: { HsName } > : varid { $1 } diff --git a/src/HsSyn.lhs b/src/HsSyn.lhs index 852f9fc1..ae55402e 100644 --- a/src/HsSyn.lhs +++ b/src/HsSyn.lhs @@ -1,5 +1,5 @@ % ----------------------------------------------------------------------------- -% $Id: HsSyn.lhs,v 1.2 2002/04/10 16:10:26 simonmar Exp $ +% $Id: HsSyn.lhs,v 1.3 2002/04/24 15:57:48 simonmar Exp $ % % (c) The GHC Team, 1997-2002 % @@ -22,8 +22,7 @@ module HsSyn ( mkHsForAllType, prelude_mod, main_mod, - unit_con_name, tuple_con_name, - unit_con, tuple_con, + unit_con_name, tuple_con_name, nil_con_name, as_name, qualified_name, hiding_name, minus_name, pling_name, dot_name, forall_name, unsafe_name, safe_name, threadsafe_name, export_name, stdcall_name, ccall_name, dotnet_name, @@ -279,12 +278,11 @@ main_mod = Module "Main" unit_ident = HsSpecial "()" tuple_ident i = HsSpecial ("("++replicate i ','++")") +nil_ident = HsSpecial "[]" unit_con_name = Qual prelude_mod (HsVarName unit_ident) tuple_con_name i = Qual prelude_mod (HsVarName (tuple_ident i)) - -unit_con = HsCon unit_con_name -tuple_con i = HsCon (tuple_con_name i) +nil_con_name = Qual prelude_mod (HsVarName nil_ident) as_name = HsVarName (HsIdent "as") qualified_name = HsVarName (HsIdent "qualified") -- cgit v1.2.3