Copyright | Copyright (C) 2021-2024 John MacFarlane |
---|---|
License | GNU GPL, version 2 or above |
Maintainer | John MacFarlane <jgm@berkeley.edu> |
Stability | alpha |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Defines Sources object to be used as input to pandoc parsers and redefines Char parsers so they get source position information from it.
Synopsis
- newtype Sources = Sources {}
- class ToSources a where
- class UpdateSourcePos s c where
- updateSourcePos :: SourcePos -> c -> s -> SourcePos
- sourcesToText :: Sources -> Text
- initialSourceName :: Sources -> FilePath
- addToSources :: Monad m => SourcePos -> Text -> ParsecT Sources u m ()
- ensureFinalNewlines :: Int -> Sources -> Sources
- addToInput :: Monad m => Text -> ParsecT Sources u m ()
- satisfy :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => (Char -> Bool) -> ParsecT s u m Char
- oneOf :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m Char
- noneOf :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m Char
- anyChar :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
- char :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => Char -> ParsecT s u m Char
- string :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m [Char]
- newline :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
- space :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
- spaces :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m ()
- letter :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
- digit :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
- hexDigit :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
- alphaNum :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => ParsecT s u m Char
Documentation
A list of inputs labeled with source positions. It is assumed
that the Text
s have n
line endings.
Instances
IsString Sources Source # | |
Defined in Text.Pandoc.Sources fromString :: String -> Sources # | |
Monoid Sources Source # | |
Semigroup Sources Source # | |
Show Sources Source # | |
ToSources Sources Source # | |
UpdateSourcePos Sources Char Source # | |
Defined in Text.Pandoc.Sources | |
Monad m => Stream Sources m Char Source # | |
class UpdateSourcePos s c where Source #
updateSourcePos :: SourcePos -> c -> s -> SourcePos Source #
Instances
UpdateSourcePos ByteString Char Source # | |
Defined in Text.Pandoc.Sources updateSourcePos :: SourcePos -> Char -> ByteString -> SourcePos Source # | |
UpdateSourcePos ByteString Char Source # | |
Defined in Text.Pandoc.Sources updateSourcePos :: SourcePos -> Char -> ByteString -> SourcePos Source # | |
UpdateSourcePos Sources Char Source # | |
Defined in Text.Pandoc.Sources | |
UpdateSourcePos Text Char Source # | |
Defined in Text.Pandoc.Sources | |
UpdateSourcePos [Char] Char Source # | |
Defined in Text.Pandoc.Sources |
sourcesToText :: Sources -> Text Source #
addToInput :: 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 :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => (Char -> Bool) -> ParsecT s u m Char Source #
oneOf :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m Char Source #
noneOf :: (Monad m, Stream s m Char, UpdateSourcePos s Char) => [Char] -> ParsecT s u m Char Source #