From 1fc6dcd0e99bf1a7cfcb8184fe031242cd268f2b Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Tue, 21 Aug 2007 17:25:10 +0000 Subject: [PATCH] Add Outdents when reaching the end of a file. This doesn't make a difference for regular programs and headers -- but it does for .inc files containing processes. --- StructureOccam.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/StructureOccam.hs b/StructureOccam.hs index c887665..392b035 100644 --- a/StructureOccam.hs +++ b/StructureOccam.hs @@ -38,7 +38,8 @@ structureOccam ts = analyse 1 firstLine ts analyse :: Int -> Int -> [Token] -> PassM [Token] -- Add extra EndOfLine at the end of the file. - analyse _ _ [] = return [(emptyMeta, EndOfLine)] + analyse prevCol _ [] = return $ (emptyMeta, EndOfLine) : out + where out = replicate (prevCol `div` 2) (emptyMeta, Outdent) analyse prevCol prevLine (t@(m, tokType):ts) = if line /= prevLine then do rest <- analyse col line ts