File tree Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,13 @@ instance Pretty PkgconfigName where
56
56
pretty = Disp. text . unPkgconfigName
57
57
58
58
instance Parsec PkgconfigName where
59
- parsec = mkPkgconfigName <$> P. munch1 (\ c -> isAlphaNum c || c `elem` " +-._" )
59
+ parsec = mkPkgconfigName <$> P. munch1 isNameChar where
60
+ -- https://gitlab.haskell.org/ghc/ghc/issues/17752
61
+ isNameChar ' -' = True
62
+ isNameChar ' _' = True
63
+ isNameChar ' .' = True
64
+ isNameChar ' +' = True
65
+ isNameChar c = isAlphaNum c
60
66
61
67
instance NFData PkgconfigName where
62
68
rnf (PkgconfigName pkg) = rnf pkg
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ pkgconfigParser = P.spaces >> expr where
86
86
factor = parens expr <|> prim
87
87
88
88
prim = do
89
- op <- P. munch1 ( `elem` " <>=^- " ) P. <?> " operator"
89
+ op <- P. munch1 isOpChar P. <?> " operator"
90
90
case op of
91
91
" -" -> anyPkgconfigVersion <$ (P. string " any" *> P. spaces)
92
92
@@ -98,6 +98,14 @@ pkgconfigParser = P.spaces >> expr where
98
98
99
99
_ -> P. unexpected $ " Unknown version operator " ++ show op
100
100
101
+ -- https://gitlab.haskell.org/ghc/ghc/issues/17752
102
+ isOpChar ' <' = True
103
+ isOpChar ' =' = True
104
+ isOpChar ' >' = True
105
+ isOpChar ' ^' = True
106
+ isOpChar ' -' = True
107
+ isOpChar _ = False
108
+
101
109
afterOp f = do
102
110
P. spaces
103
111
v <- parsec
Original file line number Diff line number Diff line change @@ -78,7 +78,13 @@ instance Pretty UnitId where
78
78
-- GHC accepts for @-package-id@.
79
79
--
80
80
instance Parsec UnitId where
81
- parsec = mkUnitId <$> P. munch1 (\ c -> isAlphaNum c || c `elem` " -_.+" )
81
+ parsec = mkUnitId <$> P. munch1 isUnitChar where
82
+ -- https://gitlab.haskell.org/ghc/ghc/issues/17752
83
+ isUnitChar ' -' = True
84
+ isUnitChar ' _' = True
85
+ isUnitChar ' .' = True
86
+ isUnitChar ' +' = True
87
+ isUnitChar c = isAlphaNum c
82
88
83
89
-- | If you need backwards compatibility, consider using 'display'
84
90
-- instead, which is supported by all versions of Cabal.
Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ versionRangeParser digitParser = expr
293
293
factor = parens expr <|> prim
294
294
295
295
prim = do
296
- op <- P. munch1 ( `elem` " <>=^- " ) P. <?> " operator"
296
+ op <- P. munch1 isOpChar P. <?> " operator"
297
297
case op of
298
298
" -" -> anyVersion <$ P. string " any" <|> P. string " none" *> noVersion'
299
299
@@ -325,6 +325,14 @@ versionRangeParser digitParser = expr
325
325
" >" -> pure $ laterVersion v
326
326
_ -> fail $ " Unknown version operator " ++ show op
327
327
328
+ -- https://gitlab.haskell.org/ghc/ghc/issues/17752
329
+ isOpChar ' <' = True
330
+ isOpChar ' =' = True
331
+ isOpChar ' >' = True
332
+ isOpChar ' ^' = True
333
+ isOpChar ' -' = True
334
+ isOpChar _ = False
335
+
328
336
-- Note: There are other features:
329
337
-- && and || since 1.8
330
338
-- x.y.* (wildcard) since 1.6
You can’t perform that action at this time.
0 commit comments