Commit d784bdeb authored by thomie's avatar thomie Committed by Ben Gamari

Lexer: support consecutive references to Haddock chunks (#10398)

Reviewers: austin, bgamari, Fuuzetsu

Reviewed By: bgamari

Subscribers: thomie, bgamari

Differential Revision: https://phabricator.haskell.org/D1025

GHC Trac Issues: #10398
parent 98512751
......@@ -1012,7 +1012,7 @@ withLexedDocType lexDocComment = do
case prevChar buf ' ' of
'|' -> lexDocComment input ITdocCommentNext False
'^' -> lexDocComment input ITdocCommentPrev False
'$' -> lexDocComment input ITdocCommentNamed False
'$' -> lexDocComment input ITdocCommentNamed True
'*' -> lexDocSection 1 input
'#' -> lexDocComment input ITdocOptionsOld False
_ -> panic "withLexedDocType: Bad doc type"
......
module Foo
(
-- The reference to chunk2 should show up in the -ddump-parsed output.
-- $chunk1
-- $chunk2
foo,
-- $chunk3
bar
)
where
{- $chunk1
This is chunk 1.
-}
{- $chunk2
This is chunk 2.
-}
{- $chunk3
This is chunk 3.
-}
foo = 3
bar = 7
==================== Parser ====================
module Foo (
<IEDocNamed: chunk1>, <IEDocNamed: chunk2>, foo,
<IEDocNamed: chunk3>, bar
) where
<document comment>
<document comment>
<document comment>
foo = 3
bar = 7
......@@ -31,3 +31,4 @@ test('haddockA030', normal, compile, ['-haddock -ddump-parsed'])
test('haddockA031', normal, compile, ['-haddock -ddump-parsed -XExistentialQuantification'])
test('haddockA032', normal, compile, ['-haddock -ddump-parsed'])
test('haddockA033', normal, compile, ['-haddock -ddump-parsed'])
test('T10398', normal, compile, ['-haddock -ddump-parsed'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment