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.
This commit is contained in:
Adam Sampson 2007-08-21 17:25:10 +00:00
parent 3d66a7634b
commit 1fc6dcd0e9

View File

@ -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