X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FLexer.x;h=d0ea5cea574e268acf2b2f7e4238cb00c24cfbe7;hp=7594079ff1d0f422fdb85e0a5f5012f54a7d93e9;hb=d305c6b68e06368c2a8d89900a2123388fc39ae1;hpb=59300a7161f44b3a2afe381a6ccd914043a32c4f diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 7594079..d0ea5ce 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -1985,6 +1985,14 @@ alternativeLayoutRuleToken t newLine = (lastLoc == noSrcSpan) || (srcSpanStartLine thisLoc > srcSpanEndLine lastLoc) case (unLoc t, context, mExpectingOCurly) of + -- This case handles a GHC extension to the original H98 + -- layout rule... + (ITocurly, _, Just _) -> + do setAlrExpectingOCurly Nothing + setALRContext (ALRNoLayout (containsCommas ITocurly) : context) + return t + -- ...and makes this case unnecessary + {- -- I think our implicit open-curly handling is slightly -- different to John's, in how it interacts with newlines -- and "in" @@ -1992,6 +2000,7 @@ alternativeLayoutRuleToken t do setAlrExpectingOCurly Nothing setNextToken t lexTokenAlr + -} (_, ALRLayout _ col : ls, Just expectingOCurly) | (thisCol > col) || (thisCol == col && @@ -2100,6 +2109,10 @@ isNonDecreasingIntentation _ = False containsCommas :: Token -> Bool containsCommas IToparen = True containsCommas ITobrack = True +-- John doesn't have {} as containing commas, but records contain them, +-- which caused a problem parsing Cabal's Distribution.Simple.InstallDirs +-- (defaultInstallDirs). +containsCommas ITocurly = True -- GHC Extensions: containsCommas IToubxparen = True containsCommas _ = False