@@ -327,13 +327,19 @@ spaces =
327327
328328forcedWS :: IParser String
329329forcedWS =
330− choice
331− [ (++) <$> spaces <*> (concat <$> many nl_space)
332− , concat <$> many1 nl_space
333− ]
334− where
335− nl_space =
336− try ((++) <$> (concat <$> many1 newline) <*> spaces)
330+ do ws <- many1 (spaces <|> newline)
331+ column <- sourceColumn <$> getPosition
332+ if column == 1
333+ then fail badWhiteSpaceMessage
334+ else return (concat ws)
335+
336+
337+badWhiteSpaceMessage :: String
338+badWhiteSpaceMessage =
339+ "I need whitespace, but got stuck on what looks like a new declaration.\n"
340+ ++ "\n"
341+ ++ "You are either missing some stuff in the declaration above or just need to add\n"
342+ ++ "some spaces here:"
337343
338344
339345-- Just eats whitespace until the next meaningful character.