Alan Zimmerman pushed to branch wip/az/ghc-cpp at Glasgow Haskell Compiler / GHC
Commits:
-
c88a8a4b
by Alan Zimmerman at 2025-04-23T18:18:57+01:00
1 changed file:
Changes:
... | ... | @@ -73,8 +73,8 @@ module GHC.Parser.Lexer ( |
73 | 73 | ExtBits(..),
|
74 | 74 | xtest, xunset, xset,
|
75 | 75 | disableHaddock,
|
76 | - enableGhcCpp,
|
|
77 | - ghcCppEnabled,
|
|
76 | + enableGhcCpp, ghcCppEnabled,
|
|
77 | + enableExtBit, disableExtBit, extBitEnabled,
|
|
78 | 78 | lexTokenStream,
|
79 | 79 | mkParensEpToks,
|
80 | 80 | mkParensLocs,
|
... | ... | @@ -3152,12 +3152,23 @@ disableHaddock opts = upd_bitmap (xunset HaddockBit) |
3152 | 3152 | upd_bitmap f = opts { pExtsBitmap = f (pExtsBitmap opts) }
|
3153 | 3153 | |
3154 | 3154 | enableGhcCpp :: ParserOpts -> ParserOpts
|
3155 | -enableGhcCpp opts = upd_bitmap (xset GhcCppBit)
|
|
3155 | +enableGhcCpp = enableExtBit GhcCppBit
|
|
3156 | + |
|
3157 | +ghcCppEnabled :: ParserOpts -> Bool
|
|
3158 | +ghcCppEnabled = extBitEnabled GhcCppBit
|
|
3159 | + |
|
3160 | +enableExtBit :: ExtBits -> ParserOpts -> ParserOpts
|
|
3161 | +enableExtBit bit opts = upd_bitmap (xset bit)
|
|
3156 | 3162 | where
|
3157 | 3163 | upd_bitmap f = opts { pExtsBitmap = f (pExtsBitmap opts) }
|
3158 | 3164 | |
3159 | -ghcCppEnabled :: ParserOpts -> Bool
|
|
3160 | -ghcCppEnabled opts = xtest GhcCppBit (pExtsBitmap opts)
|
|
3165 | +disableExtBit :: ExtBits -> ParserOpts -> ParserOpts
|
|
3166 | +disableExtBit bit opts = upd_bitmap (xunset bit)
|
|
3167 | + where
|
|
3168 | + upd_bitmap f = opts { pExtsBitmap = f (pExtsBitmap opts) }
|
|
3169 | + |
|
3170 | +extBitEnabled :: ExtBits -> ParserOpts -> Bool
|
|
3171 | +extBitEnabled bit opts = xtest bit (pExtsBitmap opts)
|
|
3161 | 3172 | |
3162 | 3173 | -- | Set parser options for parsing OPTIONS pragmas
|
3163 | 3174 | initPragState :: p -> ParserOpts -> StringBuffer -> RealSrcLoc -> PState p
|