Commit a39afe49 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.
Browse files

Tabs -> spaces

parent f2e8f5d9
-- -*-haskell-*-
-- -*-haskell-*-
-- ---------------------------------------------------------------------------
-- (c) The University of Glasgow 1997-2003
---
......@@ -25,36 +25,36 @@ throw away inlinings as it would normally do in -O0 mode.
-}
module Parser ( parseModule, parseStmt, parseIdentifier, parseType,
parseHeader ) where
parseHeader ) where
import HsSyn
import RdrHsSyn
import HscTypes ( IsBootInterface, WarningTxt(..) )
import HscTypes ( IsBootInterface, WarningTxt(..) )
import Lexer
import RdrName
import TysPrim ( eqPrimTyCon )
import TysWiredIn ( unitTyCon, unitDataCon, tupleTyCon, tupleCon, nilDataCon,
unboxedSingletonTyCon, unboxedSingletonDataCon,
listTyCon_RDR, parrTyCon_RDR, consDataCon_RDR, eqTyCon_RDR )
import Type ( funTyCon )
import ForeignCall ( Safety(..), CExportSpec(..), CLabelString,
CCallConv(..), CCallTarget(..), defaultCCallConv
)
import OccName ( varName, dataName, tcClsName, tvName )
import DataCon ( DataCon, dataConName )
import TysPrim ( eqPrimTyCon )
import TysWiredIn ( unitTyCon, unitDataCon, tupleTyCon, tupleCon, nilDataCon,
unboxedSingletonTyCon, unboxedSingletonDataCon,
listTyCon_RDR, parrTyCon_RDR, consDataCon_RDR, eqTyCon_RDR )
import Type ( funTyCon )
import ForeignCall ( Safety(..), CExportSpec(..), CLabelString,
CCallConv(..), CCallTarget(..), defaultCCallConv
)
import OccName ( varName, dataName, tcClsName, tvName )
import DataCon ( DataCon, dataConName )
import SrcLoc
import Module
import StaticFlags ( opt_SccProfilingOn, opt_Hpc )
import Type ( Kind, liftedTypeKind, unliftedTypeKind )
import Coercion ( mkArrowKind )
import Class ( FunDep )
import StaticFlags ( opt_SccProfilingOn, opt_Hpc )
import Type ( Kind, liftedTypeKind, unliftedTypeKind )
import Coercion ( mkArrowKind )
import Class ( FunDep )
import BasicTypes
import DynFlags
import OrdList
import HaddockUtils
import FastString
import Maybes ( orElse )
import Maybes ( orElse )
import Outputable
import Control.Monad ( unless )
......@@ -111,49 +111,49 @@ would think the two should never occur in the same context.
-----------------------------------------------------------------------------
Conflicts: 38 shift/reduce (1.25)
10 for abiguity in 'if x then y else z + 1' [State 178]
(shift parses as 'if x then y else (z + 1)', as per longest-parse rule)
10 because op might be: : - ! * . `x` VARSYM CONSYM QVARSYM QCONSYM
10 for abiguity in 'if x then y else z + 1' [State 178]
(shift parses as 'if x then y else (z + 1)', as per longest-parse rule)
10 because op might be: : - ! * . `x` VARSYM CONSYM QVARSYM QCONSYM
1 for ambiguity in 'if x then y else z :: T' [State 178]
(shift parses as 'if x then y else (z :: T)', as per longest-parse rule)
1 for ambiguity in 'if x then y else z :: T' [State 178]
(shift parses as 'if x then y else (z :: T)', as per longest-parse rule)
4 for ambiguity in 'if x then y else z -< e' [State 178]
(shift parses as 'if x then y else (z -< T)', as per longest-parse rule)
There are four such operators: -<, >-, -<<, >>-
4 for ambiguity in 'if x then y else z -< e' [State 178]
(shift parses as 'if x then y else (z -< T)', as per longest-parse rule)
There are four such operators: -<, >-, -<<, >>-
2 for ambiguity in 'case v of { x :: T -> T ... } ' [States 11, 253]
Which of these two is intended?
case v of
(x::T) -> T -- Rhs is T
2 for ambiguity in 'case v of { x :: T -> T ... } ' [States 11, 253]
Which of these two is intended?
case v of
(x::T) -> T -- Rhs is T
or
case v of
(x::T -> T) -> .. -- Rhs is ...
case v of
(x::T -> T) -> .. -- Rhs is ...
10 for ambiguity in 'e :: a `b` c'. Does this mean [States 11, 253]
(e::a) `b` c, or
(e :: (a `b` c))
10 for ambiguity in 'e :: a `b` c'. Does this mean [States 11, 253]
(e::a) `b` c, or
(e :: (a `b` c))
As well as `b` we can have !, VARSYM, QCONSYM, and CONSYM, hence 5 cases
Same duplication between states 11 and 253 as the previous case
1 for ambiguity in 'let ?x ...' [State 329]
the parser can't tell whether the ?x is the lhs of a normal binding or
an implicit binding. Fortunately resolving as shift gives it the only
sensible meaning, namely the lhs of an implicit binding.
1 for ambiguity in 'let ?x ...' [State 329]
the parser can't tell whether the ?x is the lhs of a normal binding or
an implicit binding. Fortunately resolving as shift gives it the only
sensible meaning, namely the lhs of an implicit binding.
1 for ambiguity in '{-# RULES "name" [ ... #-} [State 382]
we don't know whether the '[' starts the activation or not: it
might be the start of the declaration with the activation being
empty. --SDM 1/4/2002
1 for ambiguity in '{-# RULES "name" [ ... #-} [State 382]
we don't know whether the '[' starts the activation or not: it
might be the start of the declaration with the activation being
empty. --SDM 1/4/2002
1 for ambiguity in '{-# RULES "name" forall = ... #-}' [State 474]
since 'forall' is a valid variable name, we don't know whether
to treat a forall on the input as the beginning of a quantifier
or the beginning of the rule itself. Resolving to shift means
it's always treated as a quantifier, hence the above is disallowed.
This saves explicitly defining a grammar for the rule lhs that
doesn't include 'forall'.
1 for ambiguity in '{-# RULES "name" forall = ... #-}' [State 474]
since 'forall' is a valid variable name, we don't know whether
to treat a forall on the input as the beginning of a quantifier
or the beginning of the rule itself. Resolving to shift means
it's always treated as a quantifier, hence the above is disallowed.
This saves explicitly defining a grammar for the rule lhs that
doesn't include 'forall'.
1 for ambiguity when the source file starts with "-- | doc". We need another
token of lookahead to determine if a top declaration or the 'module' keyword
......@@ -169,11 +169,11 @@ and LL. Each of these macros can be thought of as having type
They each add a SrcSpan to their argument.
L0 adds 'noSrcSpan', used for empty productions
L0 adds 'noSrcSpan', used for empty productions
-- This doesn't seem to work anymore -=chak
L1 for a production with a single token on the lhs. Grabs the SrcSpan
from that token.
from that token.
LL for a production with >1 token on the lhs. Makes up a SrcSpan from
the first and last tokens.
......@@ -183,9 +183,9 @@ especially careful with empty productions: LL won't work if the first
or last token on the lhs can represent an empty span. In these cases,
we have to calculate the span using more of the tokens from the lhs, eg.
| 'newtype' tycl_hdr '=' newconstr deriving
{ L (comb3 $1 $4 $5)
(mkTyData NewType (unLoc $2) [$4] (unLoc $5)) }
| 'newtype' tycl_hdr '=' newconstr deriving
{ L (comb3 $1 $4 $5)
(mkTyData NewType (unLoc $2) [$4] (unLoc $5)) }
We provide comb3 and comb4 functions which are useful in such cases.
......@@ -206,48 +206,48 @@ incorrect.
-}
%token
'_' { L _ ITunderscore } -- Haskell keywords
'as' { L _ ITas }
'case' { L _ ITcase }
'class' { L _ ITclass }
'data' { L _ ITdata }
'default' { L _ ITdefault }
'deriving' { L _ ITderiving }
'do' { L _ ITdo }
'else' { L _ ITelse }
'hiding' { L _ IThiding }
'if' { L _ ITif }
'import' { L _ ITimport }
'in' { L _ ITin }
'infix' { L _ ITinfix }
'infixl' { L _ ITinfixl }
'infixr' { L _ ITinfixr }
'instance' { L _ ITinstance }
'let' { L _ ITlet }
'module' { L _ ITmodule }
'newtype' { L _ ITnewtype }
'of' { L _ ITof }
'qualified' { L _ ITqualified }
'then' { L _ ITthen }
'type' { L _ ITtype }
'where' { L _ ITwhere }
'_scc_' { L _ ITscc } -- ToDo: remove
'forall' { L _ ITforall } -- GHC extension keywords
'foreign' { L _ ITforeign }
'export' { L _ ITexport }
'label' { L _ ITlabel }
'dynamic' { L _ ITdynamic }
'safe' { L _ ITsafe }
'_' { L _ ITunderscore } -- Haskell keywords
'as' { L _ ITas }
'case' { L _ ITcase }
'class' { L _ ITclass }
'data' { L _ ITdata }
'default' { L _ ITdefault }
'deriving' { L _ ITderiving }
'do' { L _ ITdo }
'else' { L _ ITelse }
'hiding' { L _ IThiding }
'if' { L _ ITif }
'import' { L _ ITimport }
'in' { L _ ITin }
'infix' { L _ ITinfix }
'infixl' { L _ ITinfixl }
'infixr' { L _ ITinfixr }
'instance' { L _ ITinstance }
'let' { L _ ITlet }
'module' { L _ ITmodule }
'newtype' { L _ ITnewtype }
'of' { L _ ITof }
'qualified' { L _ ITqualified }
'then' { L _ ITthen }
'type' { L _ ITtype }
'where' { L _ ITwhere }
'_scc_' { L _ ITscc } -- ToDo: remove
'forall' { L _ ITforall } -- GHC extension keywords
'foreign' { L _ ITforeign }
'export' { L _ ITexport }
'label' { L _ ITlabel }
'dynamic' { L _ ITdynamic }
'safe' { L _ ITsafe }
'interruptible' { L _ ITinterruptible }
'unsafe' { L _ ITunsafe }
'mdo' { L _ ITmdo }
'family' { L _ ITfamily }
'unsafe' { L _ ITunsafe }
'mdo' { L _ ITmdo }
'family' { L _ ITfamily }
'stdcall' { L _ ITstdcallconv }
'ccall' { L _ ITccallconv }
'prim' { L _ ITprimcallconv }
'proc' { L _ ITproc } -- for arrow notation extension
'rec' { L _ ITrec } -- for arrow notation extension
'proc' { L _ ITproc } -- for arrow notation extension
'rec' { L _ ITrec } -- for arrow notation extension
'group' { L _ ITgroup } -- for list transform extension
'by' { L _ ITby } -- for list transform extension
'using' { L _ ITusing } -- for list transform extension
......@@ -255,9 +255,9 @@ incorrect.
'{-# INLINE' { L _ (ITinline_prag _ _) }
'{-# SPECIALISE' { L _ ITspec_prag }
'{-# SPECIALISE_INLINE' { L _ (ITspec_inline_prag _) }
'{-# SOURCE' { L _ ITsource_prag }
'{-# RULES' { L _ ITrules_prag }
'{-# CORE' { L _ ITcore_prag } -- hdaume: annotated core
'{-# SOURCE' { L _ ITsource_prag }
'{-# RULES' { L _ ITrules_prag }
'{-# CORE' { L _ ITcore_prag } -- hdaume: annotated core
'{-# SCC' { L _ ITscc_prag }
'{-# GENERATED' { L _ ITgenerated_prag }
'{-# DEPRECATED' { L _ ITdeprecated_prag }
......@@ -267,78 +267,78 @@ incorrect.
'{-# VECTORISE' { L _ ITvect_prag }
'{-# VECTORISE_SCALAR' { L _ ITvect_scalar_prag }
'{-# NOVECTORISE' { L _ ITnovect_prag }
'#-}' { L _ ITclose_prag }
'..' { L _ ITdotdot } -- reserved symbols
':' { L _ ITcolon }
'::' { L _ ITdcolon }
'=' { L _ ITequal }
'\\' { L _ ITlam }
'|' { L _ ITvbar }
'<-' { L _ ITlarrow }
'->' { L _ ITrarrow }
'@' { L _ ITat }
'~' { L _ ITtilde }
'~#' { L _ ITtildehsh }
'=>' { L _ ITdarrow }
'-' { L _ ITminus }
'!' { L _ ITbang }
'*' { L _ ITstar }
'-<' { L _ ITlarrowtail } -- for arrow notation
'>-' { L _ ITrarrowtail } -- for arrow notation
'-<<' { L _ ITLarrowtail } -- for arrow notation
'>>-' { L _ ITRarrowtail } -- for arrow notation
'.' { L _ ITdot }
'{' { L _ ITocurly } -- special symbols
'}' { L _ ITccurly }
'#-}' { L _ ITclose_prag }
'..' { L _ ITdotdot } -- reserved symbols
':' { L _ ITcolon }
'::' { L _ ITdcolon }
'=' { L _ ITequal }
'\\' { L _ ITlam }
'|' { L _ ITvbar }
'<-' { L _ ITlarrow }
'->' { L _ ITrarrow }
'@' { L _ ITat }
'~' { L _ ITtilde }
'~#' { L _ ITtildehsh }
'=>' { L _ ITdarrow }
'-' { L _ ITminus }
'!' { L _ ITbang }
'*' { L _ ITstar }
'-<' { L _ ITlarrowtail } -- for arrow notation
'>-' { L _ ITrarrowtail } -- for arrow notation
'-<<' { L _ ITLarrowtail } -- for arrow notation
'>>-' { L _ ITRarrowtail } -- for arrow notation
'.' { L _ ITdot }
'{' { L _ ITocurly } -- special symbols
'}' { L _ ITccurly }
'{|' { L _ ITocurlybar }
'|}' { L _ ITccurlybar }
vocurly { L _ ITvocurly } -- virtual open curly (from layout)
vccurly { L _ ITvccurly } -- virtual close curly (from layout)
'[' { L _ ITobrack }
']' { L _ ITcbrack }
'[:' { L _ ITopabrack }
':]' { L _ ITcpabrack }
'(' { L _ IToparen }
')' { L _ ITcparen }
'(#' { L _ IToubxparen }
'#)' { L _ ITcubxparen }
'(|' { L _ IToparenbar }
'|)' { L _ ITcparenbar }
';' { L _ ITsemi }
',' { L _ ITcomma }
'`' { L _ ITbackquote }
VARID { L _ (ITvarid _) } -- identifiers
CONID { L _ (ITconid _) }
VARSYM { L _ (ITvarsym _) }
CONSYM { L _ (ITconsym _) }
QVARID { L _ (ITqvarid _) }
QCONID { L _ (ITqconid _) }
QVARSYM { L _ (ITqvarsym _) }
QCONSYM { L _ (ITqconsym _) }
vocurly { L _ ITvocurly } -- virtual open curly (from layout)
vccurly { L _ ITvccurly } -- virtual close curly (from layout)
'[' { L _ ITobrack }
']' { L _ ITcbrack }
'[:' { L _ ITopabrack }
':]' { L _ ITcpabrack }
'(' { L _ IToparen }
')' { L _ ITcparen }
'(#' { L _ IToubxparen }
'#)' { L _ ITcubxparen }
'(|' { L _ IToparenbar }
'|)' { L _ ITcparenbar }
';' { L _ ITsemi }
',' { L _ ITcomma }
'`' { L _ ITbackquote }
VARID { L _ (ITvarid _) } -- identifiers
CONID { L _ (ITconid _) }
VARSYM { L _ (ITvarsym _) }
CONSYM { L _ (ITconsym _) }
QVARID { L _ (ITqvarid _) }
QCONID { L _ (ITqconid _) }
QVARSYM { L _ (ITqvarsym _) }
QCONSYM { L _ (ITqconsym _) }
PREFIXQVARSYM { L _ (ITprefixqvarsym _) }
PREFIXQCONSYM { L _ (ITprefixqconsym _) }
IPDUPVARID { L _ (ITdupipvarid _) } -- GHC extension
CHAR { L _ (ITchar _) }
STRING { L _ (ITstring _) }
INTEGER { L _ (ITinteger _) }
RATIONAL { L _ (ITrational _) }
PRIMCHAR { L _ (ITprimchar _) }
PRIMSTRING { L _ (ITprimstring _) }
PRIMINTEGER { L _ (ITprimint _) }
PRIMWORD { L _ (ITprimword _) }
PRIMFLOAT { L _ (ITprimfloat _) }
PRIMDOUBLE { L _ (ITprimdouble _) }
DOCNEXT { L _ (ITdocCommentNext _) }
DOCPREV { L _ (ITdocCommentPrev _) }
DOCNAMED { L _ (ITdocCommentNamed _) }
DOCSECTION { L _ (ITdocSection _ _) }
IPDUPVARID { L _ (ITdupipvarid _) } -- GHC extension
CHAR { L _ (ITchar _) }
STRING { L _ (ITstring _) }
INTEGER { L _ (ITinteger _) }
RATIONAL { L _ (ITrational _) }
PRIMCHAR { L _ (ITprimchar _) }
PRIMSTRING { L _ (ITprimstring _) }
PRIMINTEGER { L _ (ITprimint _) }
PRIMWORD { L _ (ITprimword _) }
PRIMFLOAT { L _ (ITprimfloat _) }
PRIMDOUBLE { L _ (ITprimdouble _) }
DOCNEXT { L _ (ITdocCommentNext _) }
DOCPREV { L _ (ITdocCommentPrev _) }
DOCNAMED { L _ (ITdocCommentNamed _) }
DOCSECTION { L _ (ITdocSection _ _) }
-- Template Haskell
'[|' { L _ ITopenExpQuote }
......@@ -347,10 +347,10 @@ incorrect.
'[d|' { L _ ITopenDecQuote }
'|]' { L _ ITcloseQuote }
TH_ID_SPLICE { L _ (ITidEscape _) } -- $x
'$(' { L _ ITparenEscape } -- $( exp )
TH_VAR_QUOTE { L _ ITvarQuote } -- 'x
TH_TY_QUOTE { L _ ITtyQuote } -- ''T
TH_QUASIQUOTE { L _ (ITquasiQuote _) }
'$(' { L _ ITparenEscape } -- $( exp )
TH_VAR_QUOTE { L _ ITvarQuote } -- 'x
TH_TY_QUOTE { L _ ITtyQuote } -- ''T
TH_QUASIQUOTE { L _ (ITquasiQuote _) }
%monad { P } { >>= } { return }
%lexer { lexer } { L _ ITeof }
......@@ -365,10 +365,10 @@ TH_QUASIQUOTE { L _ (ITquasiQuote _) }
-----------------------------------------------------------------------------
-- Identifiers; one of the entry points
identifier :: { Located RdrName }
: qvar { $1 }
| qcon { $1 }
| qvarop { $1 }
| qconop { $1 }
: qvar { $1 }
| qcon { $1 }
| qvarop { $1 }
| qconop { $1 }
| '(' '->' ')' { LL $ getRdrName funTyCon }
-----------------------------------------------------------------------------
......@@ -381,14 +381,14 @@ identifier :: { Located RdrName }
-- either, and DEPRECATED is only expected to be used by people who really
-- know what they are doing. :-)
module :: { Located (HsModule RdrName) }
: maybedocheader 'module' modid maybemodwarning maybeexports 'where' body
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule (Just $3) $5 (fst $7) (snd $7) $4 $1
module :: { Located (HsModule RdrName) }
: maybedocheader 'module' modid maybemodwarning maybeexports 'where' body
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule (Just $3) $5 (fst $7) (snd $7) $4 $1
) )}
| body2
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule Nothing Nothing
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule Nothing Nothing
(fst $1) (snd $1) Nothing Nothing
)) }
......@@ -397,44 +397,44 @@ maybedocheader :: { Maybe LHsDocString }
| {- empty -} { Nothing }
missing_module_keyword :: { () }
: {- empty -} {% pushCurrentContext }
: {- empty -} {% pushCurrentContext }
maybemodwarning :: { Maybe WarningTxt }
: '{-# DEPRECATED' strings '#-}' { Just (DeprecatedTxt $ unLoc $2) }
| '{-# WARNING' strings '#-}' { Just (WarningTxt $ unLoc $2) }
| {- empty -} { Nothing }
body :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
: '{' top '}' { $2 }
| vocurly top close { $2 }
body :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
: '{' top '}' { $2 }
| vocurly top close { $2 }
body2 :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
: '{' top '}' { $2 }
| missing_module_keyword top close { $2 }
body2 :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
: '{' top '}' { $2 }
| missing_module_keyword top close { $2 }
top :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
: importdecls { (reverse $1,[]) }
| importdecls ';' cvtopdecls { (reverse $1,$3) }
| cvtopdecls { ([],$1) }
top :: { ([LImportDecl RdrName], [LHsDecl RdrName]) }
: importdecls { (reverse $1,[]) }
| importdecls ';' cvtopdecls { (reverse $1,$3) }
| cvtopdecls { ([],$1) }
cvtopdecls :: { [LHsDecl RdrName] }
: topdecls { cvTopDecls $1 }
: topdecls { cvTopDecls $1 }
-----------------------------------------------------------------------------
-- Module declaration & imports only
header :: { Located (HsModule RdrName) }
: maybedocheader 'module' modid maybemodwarning maybeexports 'where' header_body
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule (Just $3) $5 $7 [] $4 $1
header :: { Located (HsModule RdrName) }
: maybedocheader 'module' modid maybemodwarning maybeexports 'where' header_body
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule (Just $3) $5 $7 [] $4 $1
))}
| header_body2
{% fileSrcSpan >>= \ loc ->
{% fileSrcSpan >>= \ loc ->
return (L loc (HsModule Nothing Nothing $1 [] Nothing
Nothing)) }
header_body :: { [LImportDecl RdrName] }
: '{' importdecls { $2 }
: '{' importdecls { $2 }
| vocurly importdecls { $2 }
header_body2 :: { [LImportDecl RdrName] }
......@@ -445,17 +445,17 @@ header_body2 :: { [LImportDecl RdrName] }
-- The Export List
maybeexports :: { Maybe [LIE RdrName] }
: '(' exportlist ')' { Just $2 }
| {- empty -} { Nothing }
: '(' exportlist ')' { Just $2 }
| {- empty -} { Nothing }
exportlist :: { [LIE RdrName] }
: expdoclist ',' expdoclist { $1 ++ $3 }
| exportlist1 { $1 }
: expdoclist ',' expdoclist { $1 ++ $3 }
| exportlist1 { $1 }
exportlist1 :: { [LIE RdrName] }
: expdoclist export expdoclist ',' exportlist { $1 ++ ($2 : $3) ++ $5 }
| expdoclist export expdoclist { $1 ++ ($2 : $3) }
| expdoclist { $1 }
| expdoclist export expdoclist { $1 ++ ($2 : $3) }
| expdoclist { $1 }
expdoclist :: { [LIE RdrName] }
: exp_doc expdoclist { $1 : $2 }
......@@ -468,29 +468,29 @@ exp_doc :: { LIE RdrName }
-- No longer allow things like [] and (,,,) to be exported
-- They are built in syntax, always available
export :: { LIE RdrName }
: qvar { L1 (IEVar (unLoc $1)) }
| oqtycon { L1 (IEThingAbs (unLoc $1)) }
| oqtycon '(' '..' ')' { LL (IEThingAll (unLoc $1)) }
| oqtycon '(' ')' { LL (IEThingWith (unLoc $1) []) }
| oqtycon '(' qcnames ')' { LL (IEThingWith (unLoc $1) (reverse $3)) }
| 'module' modid { LL (IEModuleContents (unLoc $2)) }
export :: { LIE RdrName }
: qvar { L1 (IEVar (unLoc $1)) }
| oqtycon { L1 (IEThingAbs (unLoc $1)) }
| oqtycon '(' '..' ')' { LL (IEThingAll (unLoc $1)) }
| oqtycon '(' ')' { LL (IEThingWith (unLoc $1) []) }
| oqtycon '(' qcnames ')' { LL (IEThingWith (unLoc $1) (reverse $3)) }
| 'module' modid { LL (IEModuleContents (unLoc $2)) }
qcnames :: { [RdrName] }
: qcnames ',' qcname_ext { unLoc $3 : $1 }
| qcname_ext { [unLoc $1] }
: qcnames ',' qcname_ext { unLoc $3 : $1 }
| qcname_ext { [unLoc $1] }
qcname_ext :: { Located RdrName } -- Variable or data constructor
-- or tagged type constructor
: qcname { $1 }
| 'type' qcon { sL (comb2 $1 $2)
(setRdrNameSpace (unLoc $2)
tcClsName) }
qcname_ext :: { Located RdrName } -- Variable or data constructor
-- or tagged type constructor
: qcname { $1 }
| 'type' qcon { sL (comb2 $1 $2)
(setRdrNameSpace (unLoc $2)
tcClsName) }
-- Cannot pull into qcname_ext, as qcname is also used in expression.
qcname :: { Located RdrName } -- Variable or data constructor
: qvar { $1 }