projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
767eb82
)
Implement non-decreasing do indentation in the alternative layout rule
author
Ian Lynagh
<igloo@earth.li>
Fri, 27 Nov 2009 01:19:32 +0000
(
01:19
+0000)
committer
Ian Lynagh
<igloo@earth.li>
Fri, 27 Nov 2009 01:19:32 +0000
(
01:19
+0000)
compiler/parser/Lexer.x
patch
|
blob
|
history
diff --git
a/compiler/parser/Lexer.x
b/compiler/parser/Lexer.x
index
de0ccb6
..
e131e96
100644
(file)
--- a/
compiler/parser/Lexer.x
+++ b/
compiler/parser/Lexer.x
@@
-1991,7
+1991,9
@@
alternativeLayoutRuleToken t
setNextToken t
lexTokenAlr
(_, ALRLayout _ col : ls, Just expectingOCurly)
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
do setAlrExpectingOCurly Nothing
setALRContext (ALRLayout expectingOCurly thisCol : context)
setNextToken t
@@
-2089,6
+2091,10
@@
isALRclose ITccurly = True
isALRclose ITcubxparen = True
isALRclose _ = False
isALRclose ITcubxparen = True
isALRclose _ = False
+isNonDecreasingIntentation :: ALRLayout -> Bool
+isNonDecreasingIntentation ALRLayoutDo = True
+isNonDecreasingIntentation _ = False
+
containsCommas :: Token -> Bool
containsCommas IToparen = True
containsCommas ITobrack = True
containsCommas :: Token -> Bool
containsCommas IToparen = True
containsCommas ITobrack = True