Compare commits
No commits in common. "4e494062868935db5d7d91fdc5f443b4888e59c4" and "f4912d3339dad16dd29ffc6cd15023a94d14fb96" have entirely different histories.
4e49406286
...
f4912d3339
4 changed files with 274 additions and 285 deletions
9
Makefile
9
Makefile
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
@ -46,10 +46,10 @@ test-suite haddock2-test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
main-is: Spec.hs
|
main-is: Spec.hs
|
||||||
build-depends:
|
build-depends:
|
||||||
|
parsec ^>=3.1.18.0,
|
||||||
base >=4.20.1.0,
|
base >=4.20.1.0,
|
||||||
haddock2:{haddock2-lib},
|
haddock2:{haddock2-lib},
|
||||||
hspec ^>=2.11.0,
|
hspec ^>=2.11.0,
|
||||||
parsec ^>=3.1.18.0,
|
|
||||||
text ^>=2.1.2,
|
text ^>=2.1.2,
|
||||||
|
|
||||||
hs-source-dirs: test
|
hs-source-dirs: test
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ module Lexer (
|
||||||
Token (..),
|
Token (..),
|
||||||
lexer,
|
lexer,
|
||||||
emphasis,
|
emphasis,
|
||||||
)
|
) where
|
||||||
where
|
|
||||||
|
|
||||||
import Control.Monad (mfilter, void)
|
import Control.Monad (mfilter, void)
|
||||||
import Data.Functor (($>))
|
import Data.Functor (($>))
|
||||||
|
|
@ -18,7 +17,6 @@ import Text.Parsec qualified as Parsec
|
||||||
import Text.Parsec.Pos (updatePosChar)
|
import Text.Parsec.Pos (updatePosChar)
|
||||||
|
|
||||||
type Located a = (SourcePos, a)
|
type Located a = (SourcePos, a)
|
||||||
|
|
||||||
type LocatedToken = (SourcePos, Token)
|
type LocatedToken = (SourcePos, Token)
|
||||||
|
|
||||||
type Lexer = Parser [LocatedToken]
|
type Lexer = Parser [LocatedToken]
|
||||||
|
|
@ -175,6 +173,7 @@ anchor = do
|
||||||
x <- located $ between "#" "#" (Anchor <$> anyUntil "#")
|
x <- located $ between "#" "#" (Anchor <$> anyUntil "#")
|
||||||
pure [x]
|
pure [x]
|
||||||
|
|
||||||
|
|
||||||
moduleNames :: Parser Text
|
moduleNames :: Parser Text
|
||||||
moduleNames = intercalate "." . fmap Text.pack <$> upperId `sepBy1` char '.'
|
moduleNames = intercalate "." . fmap Text.pack <$> upperId `sepBy1` char '.'
|
||||||
|
|
||||||
|
|
@ -229,7 +228,7 @@ labeledLink = do
|
||||||
labelRes <- located $ Token <$> anyUntil ">"
|
labelRes <- located $ Token <$> anyUntil ">"
|
||||||
close <- located $ LabeledLinkClose <$ ">"
|
close <- located $ LabeledLinkClose <$ ">"
|
||||||
pure $
|
pure $
|
||||||
open : linkRes <> [labelRes, close]
|
open : linkRes <> [ labelRes , close ]
|
||||||
|
|
||||||
mathMultiline :: Lexer
|
mathMultiline :: Lexer
|
||||||
mathMultiline = delimited "\\[" "\\]" MathMultilineOpen MathMultilineClose
|
mathMultiline = delimited "\\[" "\\]" MathMultilineOpen MathMultilineClose
|
||||||
|
|
@ -303,7 +302,6 @@ scan ::
|
||||||
Parser Text
|
Parser Text
|
||||||
scan f initState = do
|
scan f initState = do
|
||||||
parserState@State{stateInput = input, statePos = pos} <- Parsec.getParserState
|
parserState@State{stateInput = input, statePos = pos} <- Parsec.getParserState
|
||||||
|
|
||||||
(remaining, finalPos, ct) <- go input initState pos 0
|
(remaining, finalPos, ct) <- go input initState pos 0
|
||||||
let newState = parserState{stateInput = remaining, statePos = finalPos}
|
let newState = parserState{stateInput = remaining, statePos = finalPos}
|
||||||
Parsec.setParserState newState $> Text.take ct input
|
Parsec.setParserState newState $> Text.take ct input
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import Types
|
||||||
|
|
||||||
import Data.String (IsString (..))
|
import Data.String (IsString (..))
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import GHC.Stack
|
|
||||||
import Text.Parsec.Pos
|
import Text.Parsec.Pos
|
||||||
|
import GHC.Stack
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = hspec $ do
|
main = hspec $ do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue