projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add unique package identifiers (InstalledPackageId) in the package DB
[ghc-hetmet.git]
/
compiler
/
main
/
ParsePkgConf.y
diff --git
a/compiler/main/ParsePkgConf.y
b/compiler/main/ParsePkgConf.y
index
ea515db
..
d05a6d5
100644
(file)
--- a/
compiler/main/ParsePkgConf.y
+++ b/
compiler/main/ParsePkgConf.y
@@
-1,5
+1,5
@@
{
{
-{-# OPTIONS -fno-warn-unused-binds -fno-warn-unused-matches -fno-warn-missing-signatures #-}
+{-# OPTIONS -fno-warn-unused-binds -fno-warn-unused-matches -fno-warn-missing-signatures -fno-warn-incomplete-patterns -Wwarn #-}
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and fix
-- any warnings in the module. See
-- The above warning supression flag is a temporary kludge.
-- While working on this module you are encouraged to remove it and fix
-- any warnings in the module. See
@@
-20,11
+20,12
@@
import StringBuffer
import ErrUtils ( mkLocMessage )
import SrcLoc
import Outputable
import ErrUtils ( mkLocMessage )
import SrcLoc
import Outputable
-import Panic ( GhcException(..) )
-import Control.Exception ( throwDyn )
+import Panic
}
}
+%expect 0
+
%token
'{' { L _ ITocurly }
'}' { L _ ITccurly }
%token
'{' { L _ ITocurly }
'}' { L _ ITccurly }
@@
-80,8
+81,12
@@
field :: { PackageConfig -> PackageConfig }
_ -> happyError }
}
_ -> happyError }
}
- | VARID '=' CONID STRING { id }
- -- another case of license
+ | VARID '=' CONID STRING
+ { \p -> case unpackFS $1 of
+ "installedPackageId" ->
+ p{installedPackageId = InstalledPackageId (unpackFS $4)}
+ _ -> p -- another case of license
+ }
| VARID '=' strlist
{\p -> case unpackFS $1 of
| VARID '=' strlist
{\p -> case unpackFS $1 of
@@
-106,7
+111,7
@@
field :: { PackageConfig -> PackageConfig }
_ -> p
}
_ -> p
}
- | VARID '=' pkgidlist
+ | VARID '=' ipidlist
{% case unpackFS $1 of
"depends" -> return (\p -> p{depends = $3})
_ -> happyError
{% case unpackFS $1 of
"depends" -> return (\p -> p{depends = $3})
_ -> happyError
@@
-128,13
+133,20
@@
version :: { Version }
{ Version{ versionBranch=$5,
versionTags=map unpackFS $9 } }
{ Version{ versionBranch=$5,
versionTags=map unpackFS $9 } }
-pkgidlist :: { [PackageIdentifier] }
- : '[' pkgids ']' { $2 }
+ipid :: { InstalledPackageId }
+ : CONID STRING
+ {% case unpackFS $1 of
+ "InstalledPackageId" -> return (InstalledPackageId (unpackFS $2))
+ _ -> happyError
+ }
+
+ipidlist :: { [InstalledPackageId] }
+ : '[' ipids ']' { $2 }
-- empty list case is covered by strlist, to avoid conflicts
-- empty list case is covered by strlist, to avoid conflicts
-pkgids :: { [PackageIdentifier] }
- : pkgid { [ $1 ] }
- | pkgid ',' pkgids { $1 : $3 }
+ipids :: { [InstalledPackageId] }
+ : ipid { [ $1 ] }
+ | ipid ',' ipids { $1 : $3 }
intlist :: { [Int] }
: '[' ']' { [] }
intlist :: { [Int] }
: '[' ']' { [] }
@@
-162,7
+174,7
@@
loadPackageConfig dflags conf_filename = do
let loc = mkSrcLoc (mkFastString conf_filename) 1 0
case unP parse (mkPState buf loc dflags) of
PFailed span err ->
let loc = mkSrcLoc (mkFastString conf_filename) 1 0
case unP parse (mkPState buf loc dflags) of
PFailed span err ->
- throwDyn (InstallationError (showSDoc (mkLocMessage span err)))
+ ghcError (InstallationError (showSDoc (mkLocMessage span err)))
POk _ pkg_details -> do
return pkg_details
POk _ pkg_details -> do
return pkg_details