projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
91d25cf
)
Add a GHC layout extension to the alternative layout rule
author
Ian Lynagh
<igloo@earth.li>
Thu, 3 Dec 2009 15:57:08 +0000
(15:57 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Thu, 3 Dec 2009 15:57:08 +0000
(15:57 +0000)
compiler/parser/Lexer.x
patch
|
blob
|
history
diff --git
a/compiler/parser/Lexer.x
b/compiler/parser/Lexer.x
index
c6457a4
..
d0ea5ce
100644
(file)
--- 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
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"
-- 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
do setAlrExpectingOCurly Nothing
setNextToken t
lexTokenAlr
+ -}
(_, ALRLayout _ col : ls, Just expectingOCurly)
| (thisCol > col) ||
(thisCol == col &&
(_, ALRLayout _ col : ls, Just expectingOCurly)
| (thisCol > col) ||
(thisCol == col &&