From: Ian Lynagh Date: Fri, 27 Nov 2009 01:19:32 +0000 (+0000) Subject: Implement non-decreasing do indentation in the alternative layout rule X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=aa9682ccc5521d367d76ae7abba7af03bfee3a68;hp=767eb8299091381d0193337116ec3c7a3a5e5eef Implement non-decreasing do indentation in the alternative layout rule --- diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index de0ccb6..e131e96 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -1991,7 +1991,9 @@ alternativeLayoutRuleToken t setNextToken t lexTokenAlr (_, ALRLayout _ col : ls, Just expectingOCurly) - | thisCol > col -> + | (thisCol > col) || + (thisCol == col && + isNonDecreasingIntentation expectingOCurly) -> do setAlrExpectingOCurly Nothing setALRContext (ALRLayout expectingOCurly thisCol : context) setNextToken t @@ -2089,6 +2091,10 @@ isALRclose ITccurly = True isALRclose ITcubxparen = True isALRclose _ = False +isNonDecreasingIntentation :: ALRLayout -> Bool +isNonDecreasingIntentation ALRLayoutDo = True +isNonDecreasingIntentation _ = False + containsCommas :: Token -> Bool containsCommas IToparen = True containsCommas ITobrack = True