From bfe31a74f469b0e2c1a7360358698dcc32af9f5a Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Thu, 2 May 2019 23:39:41 +0300 Subject: Comment C, which clarifies why e.g. ReadP is not enough --- haddock-api/src/Haddock/Interface/ParseModuleHeader.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'haddock-api/src') diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs index 32411e9e..37813d16 100644 --- a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs +++ b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs @@ -85,6 +85,13 @@ parseModuleHeader dflags pkgName str0 = -- the value will be "this is a .. description" and the rest will begin -- at "The module comment". +-- | 'C' is a 'Char' carrying its column. +-- +-- This let us make an indentation-aware parser, as we know current indentation. +-- by looking at the next character in the stream ('curInd'). +-- +-- Thus we can munch all spaces but only not-spaces which are indented. +-- data C = C {-# UNPACK #-} !Int Char newtype P a = P { unP :: [C] -> Maybe ([C], a) } -- cgit v1.2.3