Compare commits

..

No commits in common. "3e829d126ca23f4fff35e8d61ad4482b8663d593" and "9edd5cb4365d39fad864791dd0198f5af1d19c1c" have entirely different histories.

4 changed files with 274 additions and 285 deletions

View file

@ -1,9 +0,0 @@
.PHONY: help
help: ## Show this help.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: format
format:
find . -type f -name "*.hs" ! -path "./dist-newstyle/*" -exec fourmolu -i {} +
cabal-gild --io=haddock2.cabal

View file

@ -46,10 +46,10 @@ test-suite haddock2-test
type: exitcode-stdio-1.0
main-is: Spec.hs
build-depends:
parsec ^>=3.1.18.0,
base >=4.20.1.0,
haddock2:{haddock2-lib},
hspec ^>=2.11.0,
parsec ^>=3.1.18.0,
text ^>=2.1.2,
hs-source-dirs: test

View file

@ -4,8 +4,7 @@ module Lexer (
Token (..),
lexer,
emphasis,
)
where
) where
import Control.Monad (mfilter, void)
import Data.Functor (($>))
@ -18,7 +17,6 @@ import Text.Parsec qualified as Parsec
import Text.Parsec.Pos (updatePosChar)
type Located a = (SourcePos, a)
type LocatedToken = (SourcePos, Token)
type Lexer = Parser [LocatedToken]
@ -175,6 +173,7 @@ anchor = do
x <- located $ between "#" "#" (Anchor <$> anyUntil "#")
pure [x]
moduleNames :: Parser Text
moduleNames = intercalate "." . fmap Text.pack <$> upperId `sepBy1` char '.'
@ -229,7 +228,7 @@ labeledLink = do
labelRes <- located $ Token <$> anyUntil ">"
close <- located $ LabeledLinkClose <$ ">"
pure $
open : linkRes <> [labelRes, close]
open : linkRes <> [ labelRes , close ]
mathMultiline :: Lexer
mathMultiline = delimited "\\[" "\\]" MathMultilineOpen MathMultilineClose
@ -303,7 +302,6 @@ scan ::
Parser Text
scan f initState = do
parserState@State{stateInput = input, statePos = pos} <- Parsec.getParserState
(remaining, finalPos, ct) <- go input initState pos 0
let newState = parserState{stateInput = remaining, statePos = finalPos}
Parsec.setParserState newState $> Text.take ct input

View file

@ -10,8 +10,8 @@ import Types
import Data.String (IsString (..))
import Data.Text (Text)
import GHC.Stack
import Text.Parsec.Pos
import GHC.Stack
main :: IO ()
main = hspec $ do