tcName, varName, ipName, dataName, clsName, tvName, uvName,
EncodedFS
)
-import Module ( ModuleName, mkSysModuleFS )
+import Module ( ModuleName, PackageName, mkSysModuleFS, mkModule )
import PrelInfo ( mkTupConRdrName, mkUbxTupConRdrName )
import SrcLoc ( SrcLoc )
+import CmdLineOpts ( opt_InPackage )
import Maybes
import Outputable
%lexer { lexer } { ITeof }
%token
+ 'as' { ITas }
'case' { ITcase } -- Haskell keywords
'class' { ITclass }
'data' { ITdata }
'deriving' { ITderiving }
'do' { ITdo }
'else' { ITelse }
+ 'hiding' { IThiding }
'if' { ITif }
'import' { ITimport }
'in' { ITin }
'module' { ITmodule }
'newtype' { ITnewtype }
'of' { ITof }
+ 'qualified' { ITqualified }
'then' { ITthen }
'type' { ITtype }
'where' { ITwhere }
- 'as' { ITas }
- 'qualified' { ITqualified }
- 'hiding' { IThiding }
'forall' { ITforall } -- GHC extension keywords
'foreign' { ITforeign }
'dynamic' { ITdynamic }
'unsafe' { ITunsafe }
'with' { ITwith }
+ 'stdcall' { ITstdcallconv }
+ 'ccall' { ITccallconv }
'__interface' { ITinterface } -- interface keywords
'__export' { IT__export }
- '__forall' { IT__forall }
'__depends' { ITdepends }
+ '__forall' { IT__forall }
'__letrec' { ITletrec }
'__coerce' { ITcoerce }
- '__inline_call'{ ITinlineCall }
'__inline_me' { ITinlineMe }
+ '__inline_call'{ ITinlineCall }
'__DEFAULT' { ITdefaultbranch }
'__bot' { ITbottom }
'__integer' { ITinteger_lit }
-- (c) the IdInfo part of a signature (same reason)
iface_stuff :: { IfaceStuff }
-iface_stuff : iface { let (nm, iff) = $1 in PIface nm iff }
+iface_stuff : iface { PIface $1 }
| type { PType $1 }
| id_info { PIdInfo $1 }
| '__R' rules { PRules $2 }
| '__D' deprecs { PDeprecs $2 }
-iface :: { (ModuleName, ParsedIface) }
-iface : '__interface' mod_fs INTEGER orphans checkVersion 'where'
+iface :: { ParsedIface }
+iface : '__interface' package mod_name INTEGER orphans checkVersion 'where'
exports_part
import_part
instance_decl_part
decls_part
rules_and_deprecs
- { ( $2 -- Module name
- , ParsedIface {
- pi_mod = fromInteger $3, -- Module version
- pi_orphan = $4,
- pi_exports = $7, -- Exports
- pi_usages = $8, -- Usages
- pi_insts = $9, -- Local instances
- pi_decls = $10, -- Decls
- pi_rules = fst $11, -- Rules
- pi_deprecs = snd $11 -- Deprecations
- } ) }
+ { ParsedIface {
+ pi_mod = mkModule $3 $2, -- Module itself
+ pi_vers = fromInteger $4, -- Module version
+ pi_orphan = $5,
+ pi_exports = $8, -- Exports
+ pi_usages = $9, -- Usages
+ pi_insts = $10, -- Local instances
+ pi_decls = $11, -- Decls
+ pi_rules = fst $12, -- Rules
+ pi_deprecs = snd $12 -- Deprecations
+ } }
--------------------------------------------------------------------------
| import_part import_decl { $2 : $1 }
import_decl :: { ImportVersion OccName }
-import_decl : 'import' mod_fs INTEGER orphans is_boot whats_imported ';'
+import_decl : 'import' mod_name INTEGER orphans is_boot whats_imported ';'
{ (mkSysModuleFS $2, fromInteger $3, $4, $5, $6) }
-- import Foo 3 :: a 1 b 3 c 7 ; means import a,b,c from Foo
-- import Foo 3 ; means import all of Foo
- -- import Foo 3 ! @ :: ...stuff... ; the ! means that Foo contains orphans
- -- and @ that Foo is a boot interface
+ -- import Foo 3 ! :: ...stuff... ; the ! means that Foo contains orphans
orphans :: { WhetherHasOrphans }
orphans : { False }
exports_part :: { [ExportItem] }
exports_part : { [] }
| exports_part '__export'
- mod_fs entities ';' { (mkSysModuleFS $3, $4) : $1 }
+ mod_name entities ';' { (mkSysModuleFS $3, $4) : $1 }
entities :: { [RdrAvailInfo] }
entities : { [] }
atypes : { [] }
| atype atypes { $1 : $2 }
---------------------------------------------------------------------
-mod_fs :: { EncodedFS }
- : CONID { $1 }
+package :: { PackageName }
+ : STRING { $1 }
+ | {- empty -} { opt_InPackage } -- Useful for .hi-boot files,
+ -- which can omit the package Id
+ -- Module loops are always within a package
mod_name :: { ModuleName }
- : mod_fs { mkSysModuleFS $1 }
+ : CONID { mkSysModuleFS $1 }
---------------------------------------------------
| 'dynamic' { SLIT("dynamic") }
| 'unsafe' { SLIT("unsafe") }
| 'with' { SLIT("with") }
+ | 'ccall' { SLIT("ccall") }
+ | 'stdcall' { SLIT("stdcall") }
qvar_fs :: { (EncodedFS, EncodedFS) }
: QVARID { $1 }
happyError :: P a
happyError buf PState{ loc = loc } = PFailed (ifaceParseErr buf loc)
-data IfaceStuff = PIface EncodedFS{-.hi module name-} ParsedIface
+data IfaceStuff = PIface ParsedIface
| PIdInfo [HsIdInfo RdrName]
| PType RdrNameHsType
| PRules [RdrNameRuleDecl]