pandoc
CopyrightCopyright (C) 2021-2024 John MacFarlane
LicenseGNU GPL, version 2 or above
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Stabilityalpha
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Pandoc.Sources

Description

Defines Sources object to be used as input to pandoc parsers and redefines Char parsers so they get source position information from it.

Synopsis

Documentation

newtype Sources Source #

A list of inputs labeled with source positions. It is assumed that the Texts have n line endings.

Constructors

Sources 

Fields

Instances

Instances details
Monoid Sources Source # 
Instance details

Defined in Text.Pandoc.Sources

Semigroup Sources Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

(<>) :: Sources -> Sources -> Sources

sconcat :: NonEmpty Sources -> Sources

stimes :: Integral b => b -> Sources -> Sources

IsString Sources Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

fromString :: String -> Sources

Show Sources Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

showsPrec :: Int -> Sources -> ShowS

show :: Sources -> String

showList :: [Sources] -> ShowS

ToSources Sources Source # 
Instance details

Defined in Text.Pandoc.Sources

UpdateSourcePos Sources Char Source # 
Instance details

Defined in Text.Pandoc.Sources

Monad m => Stream Sources m Char Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

uncons :: Sources -> m (Maybe (Char, Sources)) #

class ToSources a where Source #

Methods

toSources :: a -> Sources Source #

Instances

Instances details
ToSources Sources Source # 
Instance details

Defined in Text.Pandoc.Sources

ToSources Text Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

toSources :: Text -> Sources Source #

ToSources [(FilePath, Text)] Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

toSources :: [(FilePath, Text)] -> Sources Source #

class UpdateSourcePos s c where Source #

Methods

updateSourcePos :: SourcePos -> c -> s -> SourcePos Source #

Instances

Instances details
UpdateSourcePos ByteString Char Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

updateSourcePos :: SourcePos -> Char -> ByteString -> SourcePos Source #

UpdateSourcePos ByteString Char Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

updateSourcePos :: SourcePos -> Char -> ByteString -> SourcePos Source #

UpdateSourcePos Sources Char Source # 
Instance details

Defined in Text.Pandoc.Sources

UpdateSourcePos Text Char Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

updateSourcePos :: SourcePos -> Char -> Text -> SourcePos Source #

UpdateSourcePos [Char] Char Source # 
Instance details

Defined in Text.Pandoc.Sources

Methods

updateSourcePos :: SourcePos -> Char -> [Char] -> SourcePos Source #

initialSourceName :: Sources -> FilePath Source #

Get name of first source in Sources.

addToSources :: forall (m :: Type -> Type) u. Monad m => SourcePos -> Text -> ParsecT Sources u m () Source #

ensureFinalNewlines Source #

Arguments

:: Int

number of trailing newlines

-> Sources 
-> Sources 

addToInput :: forall (m :: Type -> Type) u. Monad m => Text -> ParsecT Sources u m () Source #

Add some text to the beginning of the input sources. This simplifies code that expands macros.

satisfy :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => (Char -> Bool) -> ParsecT s u m Char Source #

takeWhileP :: forall (m :: Type -> Type) u. Monad m => (Char -> Bool) -> ParsecT Sources u m Text Source #

Consume characters while the predicate holds, returning them as a Text. Always succeeds (returning an empty Text if no characters match). Equivalent to pack <$> many (satisfy f) (including source position and error behavior), but faster, because it processes whole chunks of text at a time.

takeWhile1P :: forall (m :: Type -> Type) u. Monad m => (Char -> Bool) -> ParsecT Sources u m Text Source #

Like takeWhileP, but requires at least one matching character. Equivalent to pack <$> many1 (satisfy f).

oneOf :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m Char Source #

noneOf :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m Char Source #

anyChar :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #

char :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => Char -> ParsecT s u m Char Source #

string :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m [Char] Source #

newline :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #

space :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #

spaces :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m () Source #

letter :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #

digit :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #

hexDigit :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #

alphaNum :: forall (m :: Type -> Type) s u. (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char Source #