-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parser for Commonmark (markdown) -- -- See README @package comark-parser @version 0.1.0 module Comark.ParserCombinators.Prim data Position Position :: Int -> Int -> Int -> Position [line] :: Position -> Int [column] :: Position -> Int [point] :: Position -> Int data Parser a runParser :: Parser a -> Text -> Either ParseError a data ParserState data ParseError ParseError :: Position -> String -> ParseError [parseErrorPosition] :: ParseError -> Position [parseErrorReason] :: ParseError -> String -- | Returns the text that was consumed by a parser alongside with its -- result withConsumed :: Parser a -> Parser (a, Text) consumedBy :: Parser a -> Parser Text string :: Text -> Parser Text () :: Parser a -> String -> Parser a infixl 5 runParserWithUnconsumed :: Parser a -> Text -> Either ParseError (a, Text) getPosition :: Parser Position setPosition :: Position -> Parser () satisfy :: (Char -> Bool) -> Parser Char -- | Get the next character without consuming it. peekChar :: Parser (Maybe Char) -- | Get the last consumed character. peekLastChar :: Parser (Maybe Char) -- | Takes a parser that returns a Text, runs that parser consuming -- some input and then prepends the result to the rest of subject. replacing :: Parser Text -> Parser () endOfInput :: Parser () takeWhile :: (Char -> Bool) -> Parser Text takeWhile1 :: (Char -> Bool) -> Parser Text -- | Consumes all the available input (until endOfInput) and returns it. untilTheEnd :: Parser Text skip :: (Char -> Bool) -> Parser () skipWhile :: (Char -> Bool) -> Parser () skipWhile1 :: (Char -> Bool) -> Parser () stringCaseless :: Text -> Parser Text scan :: s -> (s -> Char -> Maybe s) -> Parser Text lookAhead :: Parser a -> Parser a notFollowedBy :: Parser a -> Parser () instance GHC.Show.Show Comark.ParserCombinators.Prim.ParseError instance GHC.Classes.Eq Comark.ParserCombinators.Prim.Position instance GHC.Classes.Ord Comark.ParserCombinators.Prim.Position instance GHC.Show.Show Comark.ParserCombinators.Prim.Position instance GHC.Base.Functor Comark.ParserCombinators.Prim.Parser instance GHC.Base.Applicative Comark.ParserCombinators.Prim.Parser instance GHC.Base.Alternative Comark.ParserCombinators.Prim.Parser instance GHC.Base.Monad Comark.ParserCombinators.Prim.Parser instance GHC.Base.MonadPlus Comark.ParserCombinators.Prim.Parser instance a ~ Data.Text.Internal.Text => Data.String.IsString (Comark.ParserCombinators.Prim.Parser a) module Comark.ParserCombinators data Position Position :: Int -> Int -> Int -> Position [line] :: Position -> Int [column] :: Position -> Int [point] :: Position -> Int data Parser a data ParseError ParseError :: Position -> String -> ParseError [parseErrorPosition] :: ParseError -> Position [parseErrorReason] :: ParseError -> String runParser :: Parser a -> Text -> Either ParseError a runParserWithUnconsumed :: Parser a -> Text -> Either ParseError (a, Text) () :: Parser a -> String -> Parser a infixl 5 satisfy :: (Char -> Bool) -> Parser Char -- | Returns the text that was consumed by a parser alongside with its -- result withConsumed :: Parser a -> Parser (a, Text) consumedBy :: Parser a -> Parser Text -- | Get the next character without consuming it. peekChar :: Parser (Maybe Char) -- | Get the last consumed character. peekLastChar :: Parser (Maybe Char) notAfter :: (Char -> Bool) -> Parser () inClass :: String -> Char -> Bool notInClass :: String -> Char -> Bool endOfInput :: Parser () char :: Char -> Parser Char anyChar :: Parser Char getPosition :: Parser Position setPosition :: Position -> Parser () takeWhile :: (Char -> Bool) -> Parser Text takeTill :: (Char -> Bool) -> Parser Text takeWhile1 :: (Char -> Bool) -> Parser Text -- | Consumes all the available input (until endOfInput) and returns it. untilTheEnd :: Parser Text skip :: (Char -> Bool) -> Parser () skipWhile :: (Char -> Bool) -> Parser () skipWhile1 :: (Char -> Bool) -> Parser () -- | Takes a parser that returns a Text, runs that parser consuming -- some input and then prepends the result to the rest of subject. replacing :: Parser Text -> Parser () string :: Text -> Parser Text stringCaseless :: Text -> Parser Text scan :: s -> (s -> Char -> Maybe s) -> Parser Text lookAhead :: Parser a -> Parser a notFollowedBy :: Parser a -> Parser () option :: Alternative f => a -> f a -> f a foldP :: (b -> Parser (Maybe b)) -> b -> Parser b manyTill :: Alternative f => f a -> f b -> f [a] someTill :: Alternative f => f a -> f b -> f [a] sepBy1 :: Alternative f => f a -> f s -> f [a] sepEndBy1 :: Alternative f => f a -> f s -> f [a] sepStartEndBy1 :: Alternative f => f a -> f s -> f [a] skipMany :: Alternative f => f a -> f () skipMany1 :: Alternative f => f a -> f () discardOpt :: Alternative f => f a -> f () -- | Parse and decode an unsigned decimal number. decimal :: Integral a => Parser a hexadecimal :: (Integral a, Bits a) => Parser a module Comark.Parser.Options data ParserOption -- | Consolidate adjacent text nodes. Normalize :: ParserOption -- | Predefine link reference defenitions. -- -- References are represented with a mapping from a link text to a -- pair of a link destination and an optional link title. -- -- During parsing the link references defined in a document would be -- collected into additional mapping. When link references are being -- mapping defined in options takes precedence over mapping found in the -- document. -- -- TODO: Examples LinkReferences :: (Text -> Maybe (Text, Maybe Text)) -> ParserOption data ParserOptions parserOptions :: [ParserOption] -> ParserOptions _poNormalize :: ParserOptions -> Bool _poLinkReferences :: ParserOptions -> Text -> Maybe (Text, Maybe Text) _poParseEmphasis :: ParserOptions -> Bool instance GHC.Base.Monoid Comark.Parser.Options.ParserOptions -- | Code and data types for parsing emphasis and links module Comark.Parser.Inline.EmphLink type DelimStack = Seq Token data EmphDelim EmphDelim :: EmphIndicator -> Int -> Bool -> Bool -> EmphDelim [emphIndicator] :: EmphDelim -> EmphIndicator [emphLength] :: EmphDelim -> Int [emphCanOpen] :: EmphDelim -> Bool [emphCanClose] :: EmphDelim -> Bool unEmphDelim :: EmphDelim -> Inlines Text data LinkOpen LinkOpen :: OpenerType -> Bool -> Maybe Text -> Inlines Text -> LinkOpen [linkOpenerType] :: LinkOpen -> OpenerType [linkActive] :: LinkOpen -> Bool [linkLabel] :: LinkOpen -> Maybe Text [linkContent] :: LinkOpen -> Inlines Text unLinkOpen :: LinkOpen -> Inlines Text data Token InlineToken :: (Inlines Text) -> Token EmphDelimToken :: EmphDelim -> Token LinkOpenToken :: LinkOpen -> Token unToken :: Token -> Inlines Text isLinkOpener :: Token -> Bool isEmphDelim :: Token -> Bool data EmphIndicator AsteriskIndicator :: EmphIndicator UnderscoreIndicator :: EmphIndicator isAsterisk :: EmphIndicator -> Bool indicatorChar :: EmphIndicator -> Char data OpenerType LinkOpener :: OpenerType ImageOpener :: OpenerType deactivate :: Token -> Token addInline :: DelimStack -> Inline Text -> DelimStack addInlines :: DelimStack -> Inlines Text -> DelimStack instance GHC.Classes.Eq Comark.Parser.Inline.EmphLink.Token instance GHC.Show.Show Comark.Parser.Inline.EmphLink.Token instance GHC.Classes.Eq Comark.Parser.Inline.EmphLink.LinkOpen instance GHC.Show.Show Comark.Parser.Inline.EmphLink.LinkOpen instance GHC.Classes.Eq Comark.Parser.Inline.EmphLink.OpenerType instance GHC.Show.Show Comark.Parser.Inline.EmphLink.OpenerType instance GHC.Classes.Eq Comark.Parser.Inline.EmphLink.EmphDelim instance GHC.Show.Show Comark.Parser.Inline.EmphLink.EmphDelim instance GHC.Classes.Eq Comark.Parser.Inline.EmphLink.EmphIndicator instance GHC.Show.Show Comark.Parser.Inline.EmphLink.EmphIndicator module Comark.Parser.Inline parseInlines :: ParserOptions -> Text -> Inlines Text pReference :: Parser (Text, Text, Maybe Text) parseInfoString :: Text -> Text module Comark.Parser -- | Parses Commonmark document. Any sequence of characters is a valid -- Commonmark document. -- -- At the moment no sanitizations are performed besides the ones defined -- in the spec. parse :: [ParserOption] -> Text -> Doc Text data ParserOption -- | Consolidate adjacent text nodes. Normalize :: ParserOption -- | Predefine link reference defenitions. -- -- References are represented with a mapping from a link text to a -- pair of a link destination and an optional link title. -- -- During parsing the link references defined in a document would be -- collected into additional mapping. When link references are being -- mapping defined in options takes precedence over mapping found in the -- document. -- -- TODO: Examples LinkReferences :: (Text -> Maybe (Text, Maybe Text)) -> ParserOption instance GHC.Show.Show Comark.Parser.Elt instance GHC.Classes.Eq Comark.Parser.ContainerType instance GHC.Show.Show Comark.Parser.ContainerType instance GHC.Base.Functor Comark.Parser.GenLeaf instance GHC.Show.Show t => GHC.Show.Show (Comark.Parser.GenLeaf t) instance GHC.Show.Show Comark.Parser.Container instance GHC.Show.Show Comark.Parser.Condition instance GHC.Classes.Eq Comark.Parser.Condition