summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-03-02 20:58:15 +0000
committerIan Lynagh <igloo@earth.li>2010-03-02 20:58:15 +0000
commit4bba92f93b88e15f0e0f23732d2cfa540acb737b (patch)
treeb9daf462f0553a7bb81eb764c1b5b9af7cad26c1
parent8dbd52c7606588ab7fc7ffd3a54641b7cadc4431 (diff)
downloadhaskell-4bba92f93b88e15f0e0f23732d2cfa540acb737b.tar.gz
Add handling for | to the transitional alternative layout rule
-rw-r--r--compiler/parser/Lexer.x12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index 5df5e4ea25..6cb2c3b7ca 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -2054,6 +2054,18 @@ alternativeLayoutRuleToken t
-- Note that we use lastLoc, as we may need to close
-- more layouts, or give a semicolon
return (L lastLoc ITccurly)
+ -- This next case is to handle a transitional issue:
+ (ITvbar, ALRLayout _ col : ls, _)
+ | newLine && thisCol == col && transitional ->
+ do addWarning Opt_WarnAlternativeLayoutRuleTransitional
+ thisLoc
+ (transitionalAlternativeLayoutWarning
+ "`|' at the same depth as implicit layout block")
+ setALRContext ls
+ setNextToken t
+ -- Note that we use lastLoc, as we may need to close
+ -- more layouts, or give a semicolon
+ return (L lastLoc ITccurly)
(_, ALRLayout _ col : ls, _)
| newLine && thisCol == col ->
do setNextToken t