return (L (mkSrcSpan loc end) (ITprimchar ch))
_other ->
return (L (mkSrcSpan loc end) (ITchar ch))
- else do
+ else do
return (L (mkSrcSpan loc end) (ITchar ch))
lex_char :: Char -> AlexInput -> P Char
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"
do setAlrExpectingOCurly Nothing
setNextToken t
lexTokenAlr
+ -}
(_, ALRLayout _ col : ls, Just expectingOCurly)
| (thisCol > col) ||
(thisCol == col &&
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