Text.Pandoc.Parsing: Export all Parsec functions used in pandoc code.
No other module directly imports Parsec. This will make it easier to change the parsing backend in the future, if we want to.
This commit is contained in:
parent
a4c28ead79
commit
5085962c28
10 changed files with 57 additions and 14 deletions
|
@ -38,7 +38,7 @@ import qualified Text.CSL as CSL ( Cite(..) )
|
|||
import Text.Pandoc.Definition
|
||||
import Text.Pandoc.Generic
|
||||
import Text.Pandoc.Shared (stringify)
|
||||
import Text.Parsec
|
||||
import Text.Pandoc.Parsing
|
||||
import Control.Monad
|
||||
|
||||
-- | Process a 'Pandoc' document by adding citations formatted
|
||||
|
|
|
@ -73,13 +73,64 @@ module Text.Pandoc.Parsing ( (>>~),
|
|||
lookupKeySrc,
|
||||
smartPunctuation,
|
||||
macro,
|
||||
applyMacros' )
|
||||
applyMacros',
|
||||
-- * Re-exports from Text.Pandoc.Parsec
|
||||
Parsec,
|
||||
runParser,
|
||||
parse,
|
||||
anyToken,
|
||||
getInput,
|
||||
setInput,
|
||||
unexpected,
|
||||
char,
|
||||
letter,
|
||||
digit,
|
||||
alphaNum,
|
||||
skipMany,
|
||||
skipMany1,
|
||||
spaces,
|
||||
space,
|
||||
anyChar,
|
||||
satisfy,
|
||||
newline,
|
||||
string,
|
||||
count,
|
||||
eof,
|
||||
noneOf,
|
||||
oneOf,
|
||||
lookAhead,
|
||||
notFollowedBy,
|
||||
many,
|
||||
many1,
|
||||
manyTill,
|
||||
(<|>),
|
||||
(<?>),
|
||||
choice,
|
||||
try,
|
||||
sepBy1,
|
||||
sepBy,
|
||||
sepEndBy,
|
||||
endBy1,
|
||||
option,
|
||||
optional,
|
||||
optionMaybe,
|
||||
getState,
|
||||
setState,
|
||||
updateState,
|
||||
getPosition,
|
||||
setPosition,
|
||||
sourceColumn,
|
||||
sourceLine,
|
||||
newPos,
|
||||
token
|
||||
)
|
||||
where
|
||||
|
||||
import Text.Pandoc.Definition
|
||||
import Text.Pandoc.Generic
|
||||
import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn)
|
||||
import Text.Parsec
|
||||
import Text.Parsec.Pos (newPos)
|
||||
import Data.Char ( toLower, toUpper, ord, isAscii, isAlphaNum, isDigit, isPunctuation )
|
||||
import Data.List ( intercalate, transpose )
|
||||
import Network.URI ( parseURI, URI (..), isAllowedInURI )
|
||||
|
|
|
@ -36,8 +36,6 @@ module Text.Pandoc.Readers.HTML ( readHtml
|
|||
, isCommentTag
|
||||
) where
|
||||
|
||||
import Text.Parsec
|
||||
import Text.Parsec.Pos
|
||||
import Text.HTML.TagSoup
|
||||
import Text.HTML.TagSoup.Match
|
||||
import Text.Pandoc.Definition
|
||||
|
|
|
@ -33,10 +33,9 @@ module Text.Pandoc.Readers.LaTeX ( readLaTeX,
|
|||
handleIncludes
|
||||
) where
|
||||
|
||||
import Text.Parsec hiding ((<|>), space, many, optional)
|
||||
import Text.Pandoc.Definition
|
||||
import Text.Pandoc.Shared
|
||||
import Text.Pandoc.Parsing
|
||||
import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
|
||||
import qualified Text.Pandoc.UTF8 as UTF8
|
||||
import Data.Char ( chr, ord )
|
||||
import Control.Monad
|
||||
|
|
|
@ -43,7 +43,6 @@ import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
|
|||
import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
|
||||
isTextTag, isCommentTag )
|
||||
import Text.Pandoc.XML ( fromEntities )
|
||||
import Text.Parsec
|
||||
import Control.Monad (when, liftM, guard, mzero)
|
||||
import Text.HTML.TagSoup
|
||||
import Text.HTML.TagSoup.Match (tagOpen)
|
||||
|
|
|
@ -33,7 +33,6 @@ module Text.Pandoc.Readers.RST (
|
|||
import Text.Pandoc.Definition
|
||||
import Text.Pandoc.Shared
|
||||
import Text.Pandoc.Parsing
|
||||
import Text.Parsec
|
||||
import Control.Monad ( when, liftM, guard, mzero )
|
||||
import Data.List ( findIndex, intercalate, transpose, sort, deleteFirstsBy )
|
||||
import qualified Data.Map as M
|
||||
|
|
|
@ -60,7 +60,6 @@ import Text.Pandoc.Shared
|
|||
import Text.Pandoc.Parsing
|
||||
import Text.Pandoc.Readers.HTML ( htmlTag, isInlineTag, isBlockTag )
|
||||
import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
|
||||
import Text.Parsec
|
||||
import Text.HTML.TagSoup.Match
|
||||
import Data.Char ( digitToInt, isUpper )
|
||||
import Control.Monad ( guard, liftM )
|
||||
|
|
|
@ -68,7 +68,7 @@ module Text.Pandoc.Templates ( renderTemplate
|
|||
, TemplateTarget
|
||||
, getDefaultTemplate ) where
|
||||
|
||||
import Text.Parsec
|
||||
import Text.Pandoc.Parsing
|
||||
import Control.Monad (liftM, when, forM, mzero)
|
||||
import System.FilePath
|
||||
import Data.List (intercalate, intersperse)
|
||||
|
|
|
@ -40,8 +40,7 @@ module Text.Pandoc.Writers.AsciiDoc (writeAsciiDoc) where
|
|||
import Text.Pandoc.Definition
|
||||
import Text.Pandoc.Templates (renderTemplate)
|
||||
import Text.Pandoc.Shared
|
||||
import Text.Pandoc.Parsing hiding (blankline)
|
||||
import Text.Parsec ( Parsec, runParser )
|
||||
import Text.Pandoc.Parsing hiding (blankline, space)
|
||||
import Data.List ( isPrefixOf, intersperse, intercalate )
|
||||
import Text.Pandoc.Pretty
|
||||
import Control.Monad.State
|
||||
|
|
|
@ -35,8 +35,7 @@ import Text.Pandoc.Definition
|
|||
import Text.Pandoc.Generic
|
||||
import Text.Pandoc.Templates (renderTemplate)
|
||||
import Text.Pandoc.Shared
|
||||
import Text.Pandoc.Parsing hiding (blankline)
|
||||
import Text.Parsec ( Parsec, runParser )
|
||||
import Text.Pandoc.Parsing hiding (blankline, char, space)
|
||||
import Data.List ( group, isPrefixOf, find, intersperse, transpose )
|
||||
import Text.Pandoc.Pretty
|
||||
import Control.Monad.State
|
||||
|
|
Loading…
Reference in a new issue