on master help sign in
Merge pull request #1278 from defanor/master
42d0138Edwin Brady
src/Idris/CaseSplit.hs+3−1
@@ -280,6 +280,8 @@ replaceSplits l ups = updateRHSs 1 (map (rep (expandBraces l)) ups)
280 nshow t = show t
280 nshow t = show t
281
281
282 -- if there's any {n} replace with {n=n}
282 -- if there's any {n} replace with {n=n}
283+ -- but don't replace it in comments
284+ expandBraces ('{' : '-' : xs) = '{' : '-' : xs
283 expandBraces ('{' : xs)
285 expandBraces ('{' : xs)
284 = let (brace, (_:rest)) = span (/= '}') xs in
286 = let (brace, (_:rest)) = span (/= '}') xs in
285 if (not ('=' `elem` brace))
287 if (not ('=' `elem` brace))
@@ -298,7 +300,7 @@ replaceSplits l ups = updateRHSs 1 (map (rep (expandBraces l)) ups)
298 if (before == n && not (isAlphaNum next))
300 if (before == n && not (isAlphaNum next))
299 then addBrackets tm ++ updatePat False n tm after
301 then addBrackets tm ++ updatePat False n tm after
300 else c : updatePat (not (isAlphaNum c)) n tm rest
302 else c : updatePat (not (isAlphaNum c)) n tm rest
301− updatePat start n tm (c:rest) = c : updatePat (not (isAlpha c)) n tm rest
303+ updatePat start n tm (c:rest) = c : updatePat (not ((isAlphaNum c) || c == '_')) n tm rest
302
304
303 addBrackets tm | ' ' `elem` tm
305 addBrackets tm | ' ' `elem` tm
304 , not (isPrefixOf "(" tm)
306 , not (isPrefixOf "(" tm)