From d20bf1656dbaecc9e24acd88793dcea3cd0056e7 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Wed, 25 Apr 2007 18:14:21 +0000 Subject: [PATCH] Handle tabs in indentation --- fco2/Indentation.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fco2/Indentation.hs b/fco2/Indentation.hs index c4f875a..0aae77b 100644 --- a/fco2/Indentation.hs +++ b/fco2/Indentation.hs @@ -5,7 +5,6 @@ import Data.List -- FIXME this doesn't handle multi-line strings -- FIXME or VALOF processes --- FIXME or tabs -- FIXME or continuation lines... indentMarker = "__indent" @@ -13,6 +12,8 @@ outdentMarker = "__outdent" eolMarker = "__eol" countIndent :: String -> Int +-- Tabs are 8 spaces. +countIndent ('\t':cs) = 4 + (countIndent cs) countIndent (' ':' ':cs) = 1 + (countIndent cs) countIndent (' ':cs) = error "Bad indentation" countIndent _ = 0