X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fmain%2FParsePkgConf.y;h=6028af89ce7270ecd88edbc7949207b9ccb05d48;hp=ac0cebbf6471ad5218e3c4d90fcafab5c6682101;hb=7bb3d1fc79521d591cd9f824893963141a7997b6;hpb=a8624a9d185bd3d08d318596e134042224859a6b diff --git a/compiler/main/ParsePkgConf.y b/compiler/main/ParsePkgConf.y index ac0cebb..6028af8 100644 --- 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 @@ -10,6 +10,7 @@ module ParsePkgConf( loadPackageConfig ) where #include "HsVersions.h" +import Distribution.Package hiding ( depends ) import PackageConfig import Lexer import Module @@ -19,11 +20,12 @@ import StringBuffer import ErrUtils ( mkLocMessage ) import SrcLoc import Outputable -import Panic ( GhcException(..) ) -import Control.Exception ( throwDyn ) +import Panic } +%expect 0 + %token '{' { L _ ITocurly } '}' { L _ ITccurly } @@ -112,9 +114,15 @@ field :: { PackageConfig -> PackageConfig } } pkgid :: { PackageIdentifier } - : CONID '{' VARID '=' STRING ',' VARID '=' version '}' - { PackageIdentifier{ pkgName = unpackFS $5, - pkgVersion = $9 } } + : CONID '{' VARID '=' CONID STRING ',' VARID '=' version '}' + {% case unpackFS $5 of + "PackageName" -> + return $ PackageIdentifier { + pkgName = PackageName (unpackFS $6), + pkgVersion = $10 + } + _ -> happyError + } version :: { Version } : CONID '{' VARID '=' intlist ',' VARID '=' strlist '}' @@ -155,7 +163,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 -> - throwDyn (InstallationError (showSDoc (mkLocMessage span err))) + ghcError (InstallationError (showSDoc (mkLocMessage span err))) POk _ pkg_details -> do return pkg_details