diff options
author | Ian Lynagh <igloo@earth.li> | 2010-11-24 22:05:07 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2010-11-24 22:05:07 +0000 |
commit | 5fa086c51816f09d03fb1a089dde64df6bd2d8a3 (patch) | |
tree | d95a22a9f35ade44c894bf027557c494ccbe017b /compiler/parser | |
parent | 04a12a3d4ee3eb098b1fed40195b27095a31c5ec (diff) | |
download | haskell-5fa086c51816f09d03fb1a089dde64df6bd2d8a3.tar.gz |
Separate NondecreasingIndentation out into its own extension
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Lexer.x | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 823fc6dbc9..6b73981350 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -1120,8 +1120,8 @@ new_layout_context strict span _buf _len = do (AI l _) <- getInput let offset = srcLocCol l ctx <- getContext - relaxed <- extension relaxedLayout - let strict' = strict || not relaxed + nondecreasing <- extension nondecreasingIndentation + let strict' = strict || not nondecreasing case ctx of Layout prev_off : _ | (strict' && prev_off >= offset || @@ -1778,6 +1778,8 @@ alternativeLayoutRuleBit :: Int alternativeLayoutRuleBit = 23 relaxedLayoutBit :: Int relaxedLayoutBit = 24 +nondecreasingIndentationBit :: Int +nondecreasingIndentationBit = 25 always :: Int -> Bool always _ = True @@ -1823,6 +1825,8 @@ alternativeLayoutRule :: Int -> Bool alternativeLayoutRule flags = testBit flags alternativeLayoutRuleBit relaxedLayout :: Int -> Bool relaxedLayout flags = testBit flags relaxedLayoutBit +nondecreasingIndentation :: Int -> Bool +nondecreasingIndentation flags = testBit flags nondecreasingIndentationBit -- PState for parsing options pragmas -- @@ -1877,6 +1881,7 @@ mkPState flags buf loc = .|. newQualOpsBit `setBitIf` xopt Opt_NewQualifiedOperators flags .|. alternativeLayoutRuleBit `setBitIf` xopt Opt_AlternativeLayoutRule flags .|. relaxedLayoutBit `setBitIf` xopt Opt_RelaxedLayout flags + .|. nondecreasingIndentationBit `setBitIf` xopt Opt_NondecreasingIndentation flags -- setBitIf :: Int -> Bool -> Int b `setBitIf` cond | cond = bit b |