@@ -10,6 +10,7 @@ module Parse.Space
10 , checkAligned
10 , checkAligned
11 , checkFreshLine
11 , checkFreshLine
13 , docComment
14 , docComment
@@ -87,7 +88,7 @@ checkFreshLine toError =
89chompAndCheckIndent :: (E.Space -> Row -> Col -> x) -> (Row -> Col -> x) -> P.Parser x ()
90chompAndCheckIndent :: (E.Space -> Row -> Col -> x) -> (Row -> Col -> x) -> P.Parser x ()
90−chompAndCheckIndent toWhitespaceError toIndentError =
91+chompAndCheckIndent toSpaceError toIndentError =
91 P.Parser $ \(P.State pos end indent row col) cok _ cerr _ ->
92 P.Parser $ \(P.State pos end indent row col) cok _ cerr _ ->
93 (# status, newPos, newRow, newCol #) = eatSpaces pos end row col
94 (# status, newPos, newRow, newCol #) = eatSpaces pos end row col
@@ -105,9 +106,9 @@ chompAndCheckIndent toWhitespaceError toIndentError =
106 cerr row col toIndentError
107 cerr row col toIndentError
108− HasTab -> cerr newRow newCol (toWhitespaceError E.HasTab)
109+ HasTab -> cerr newRow newCol (toSpaceError E.HasTab)
109− EndlessMultiComment -> cerr newRow newCol (toWhitespaceError E.EndlessMultiComment)
110+ EndlessMultiComment -> cerr newRow newCol (toSpaceError E.EndlessMultiComment)
110− UnexpectedDocComment -> cerr newRow newCol (toWhitespaceError E.UnexpectedDocComment)
111+ UnexpectedDocComment -> cerr newRow newCol (toSpaceError E.UnexpectedDocComment)
@@ -240,8 +241,15 @@ eatMultiCommentHelp pos end row col openComments =
240-- DOCUMENTATION COMMENT
241-- DOCUMENTATION COMMENT
246+ { _start :: Ptr Word8
243−docComment :: (Row -> Col -> x) -> (Row -> Col -> x) -> (Row -> Col -> x) -> P.Parser x ()
251+docComment :: (Row -> Col -> x) -> (E.Space -> Row -> Col -> x) -> P.Parser x DocComment
244−docComment toExpectation toTabError toEndlessError =
252+docComment toExpectation toSpaceError =
245 P.Parser $ \(P.State pos end indent row col) cok _ cerr eerr ->
253 P.Parser $ \(P.State pos end indent row col) cok _ cerr eerr ->
247 !pos3 = plusPtr pos 3
255 !pos3 = plusPtr pos 3
@@ -258,11 +266,12 @@ docComment toExpectation toTabError toEndlessError =
258 case status of
266 case status of
259 MultiGood ->
267 MultiGood ->
269+ !comment = DocComment pos3 (plusPtr newPos (-2))
261 !newState = P.State newPos end indent newRow newCol
270 !newState = P.State newPos end indent newRow newCol
263− cok () newState
272+ cok comment newState
265− MultiTab -> cerr newRow newCol toTabError
274+ MultiTab -> cerr newRow newCol (toSpaceError E.HasTab)
266− MultiEndless -> cerr row col toEndlessError
275+ MultiEndless -> cerr row col (toSpaceError E.EndlessMultiComment)
268 eerr row col toExpectation
277 eerr row col toExpectation