@@ -206,8 +206,9 @@ pKeepTerminator
206 <|> do c <- indent; l <- last_indent
206 <|> do c <- indent; l <- last_indent
207 if (c <= l) then return ()
207 if (c <= l) then return ()
208 else fail "Not a terminator"
208 else fail "Not a terminator"
209− <|> do i <- getInput; if (take 1 i == "}") then return ()
209+ <|> do i <- getInput; let h = take 1 i
210+ if (h == "}" || h == ")") then return ()
210− else fail "Not a terminator"
211+ else fail "Not a terminator"
211 <|> lookAhead eof
212 <|> lookAhead eof
213notEndApp = do c <- indent; l <- last_indent
214notEndApp = do c <- indent; l <- last_indent
@@ -219,7 +220,7 @@ notEndBlock = do ist <- getState
219 case brace_stack ist of
220 case brace_stack ist of
220 Just lvl : xs -> do i <- indent
221 Just lvl : xs -> do i <- indent
221 inp <- getInput
222 inp <- getInput
222− if (i < lvl || take 1 inp == ")")
223+ if (i < lvl || take 1 inp == ")")
223 then fail "End of block"
224 then fail "End of block"
224 else return ()
225 else return ()
225 _ -> return ()
226 _ -> return ()
@@ -805,7 +806,8 @@ pComprehension syn
805pDoBlock syn
806pDoBlock syn
806 = do reserved "do"; open_block
807 = do reserved "do"; open_block
807 push_indent
808 push_indent
809+ ds <- many1 (do notEndBlock
808− ds <- many1 (do notEndBlock; x <- pDo syn; pKeepTerminator; return x)
810+ x <- pDo syn; pKeepTerminator; return x)
809 pop_indent
811 pop_indent
810 close_block
812 close_block
811 return (PDoBlock ds)
813 return (PDoBlock ds)