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:
f9460db
)
Make the alternative layout rule cope with file pragmas
author
Ian Lynagh
<igloo@earth.li>
Sun, 29 Nov 2009 14:58:40 +0000
(14:58 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Sun, 29 Nov 2009 14:58:40 +0000
(14:58 +0000)
compiler/parser/Lexer.x
patch
|
blob
|
history
diff --git
a/compiler/parser/Lexer.x
b/compiler/parser/Lexer.x
index
dca51e4
..
43ddf7c
100644
(file)
--- a/
compiler/parser/Lexer.x
+++ b/
compiler/parser/Lexer.x
@@
-1144,6
+1144,7
@@
setLine code span buf len = do
setFile :: Int -> Action
setFile code span buf len = do
let file = lexemeToFastString (stepOn buf) (len-2)
setFile :: Int -> Action
setFile code span buf len = do
let file = lexemeToFastString (stepOn buf) (len-2)
+ setAlrLastLoc noSrcSpan
setSrcLoc (mkSrcLoc file (srcSpanEndLine span) (srcSpanEndCol span))
_ <- popLexState
pushLexState code
setSrcLoc (mkSrcLoc file (srcSpanEndLine span) (srcSpanEndCol span))
_ <- popLexState
pushLexState code
@@
-1981,7
+1982,8
@@
alternativeLayoutRuleToken t
mExpectingOCurly <- getAlrExpectingOCurly
let thisLoc = getLoc t
thisCol = srcSpanStartCol thisLoc
mExpectingOCurly <- getAlrExpectingOCurly
let thisLoc = getLoc t
thisCol = srcSpanStartCol thisLoc
- newLine = srcSpanStartLine thisLoc > srcSpanEndLine lastLoc
+ newLine = (lastLoc == noSrcSpan)
+ || (srcSpanStartLine thisLoc > srcSpanEndLine lastLoc)
case (unLoc t, context, mExpectingOCurly) of
-- I think our implicit open-curly handling is slightly
-- different to John's, in how it interacts with newlines
case (unLoc t, context, mExpectingOCurly) of
-- I think our implicit open-curly handling is slightly
-- different to John's, in how it interacts with newlines