From 1094204640cf1b12de751651c00b78f18d047429 Mon Sep 17 00:00:00 2001 From: bringert Date: Tue, 6 Dec 2005 16:19:29 +0000 Subject: Transfer: Fixed BNFC's layout resolver to not insert semicolon at end of line if there is one already. --- src/Transfer/Syntax/Layout.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Transfer/Syntax') diff --git a/src/Transfer/Syntax/Layout.hs b/src/Transfer/Syntax/Layout.hs index d5eae2010..de5c99870 100644 --- a/src/Transfer/Syntax/Layout.hs +++ b/src/Transfer/Syntax/Layout.hs @@ -109,8 +109,11 @@ resolveLayout tp = res Nothing [if tl then Implicit 1 else Explicit] res (Just t) (Explicit:bs) [] | null bs = [] | otherwise = res (Just t) bs [] - -- If we are using top-level layout, insert a semicolon after the last token - res (Just t) [Implicit n] [] = addToken (nextPos t) layoutSep [] + -- If we are using top-level layout, insert a semicolon after + -- the last token, if there isn't one already + res (Just t) [Implicit n] [] + | isTokenIn [layoutSep] t = [] + | otherwise = addToken (nextPos t) layoutSep [] -- At EOF in an implicit, non-top-level block: close the block res (Just t) (Implicit n:bs) [] = -- cgit v1.2.3