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:
John MacFarlane 2012-07-20 14:41:44 -07:00
parent a4c28ead79
commit 5085962c28
10 changed files with 57 additions and 14 deletions

View file

@ -38,7 +38,7 @@ import qualified Text.CSL as CSL ( Cite(..) )
import Text.Pandoc.Definition import Text.Pandoc.Definition
import Text.Pandoc.Generic import Text.Pandoc.Generic
import Text.Pandoc.Shared (stringify) import Text.Pandoc.Shared (stringify)
import Text.Parsec import Text.Pandoc.Parsing
import Control.Monad import Control.Monad
-- | Process a 'Pandoc' document by adding citations formatted -- | Process a 'Pandoc' document by adding citations formatted

View file

@ -73,13 +73,64 @@ module Text.Pandoc.Parsing ( (>>~),
lookupKeySrc, lookupKeySrc,
smartPunctuation, smartPunctuation,
macro, 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 where
import Text.Pandoc.Definition import Text.Pandoc.Definition
import Text.Pandoc.Generic import Text.Pandoc.Generic
import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn) import qualified Text.Pandoc.UTF8 as UTF8 (putStrLn)
import Text.Parsec import Text.Parsec
import Text.Parsec.Pos (newPos)
import Data.Char ( toLower, toUpper, ord, isAscii, isAlphaNum, isDigit, isPunctuation ) import Data.Char ( toLower, toUpper, ord, isAscii, isAlphaNum, isDigit, isPunctuation )
import Data.List ( intercalate, transpose ) import Data.List ( intercalate, transpose )
import Network.URI ( parseURI, URI (..), isAllowedInURI ) import Network.URI ( parseURI, URI (..), isAllowedInURI )

View file

@ -36,8 +36,6 @@ module Text.Pandoc.Readers.HTML ( readHtml
, isCommentTag , isCommentTag
) where ) where
import Text.Parsec
import Text.Parsec.Pos
import Text.HTML.TagSoup import Text.HTML.TagSoup
import Text.HTML.TagSoup.Match import Text.HTML.TagSoup.Match
import Text.Pandoc.Definition import Text.Pandoc.Definition

View file

@ -33,10 +33,9 @@ module Text.Pandoc.Readers.LaTeX ( readLaTeX,
handleIncludes handleIncludes
) where ) where
import Text.Parsec hiding ((<|>), space, many, optional)
import Text.Pandoc.Definition import Text.Pandoc.Definition
import Text.Pandoc.Shared import Text.Pandoc.Shared
import Text.Pandoc.Parsing import Text.Pandoc.Parsing hiding ((<|>), many, optional, space)
import qualified Text.Pandoc.UTF8 as UTF8 import qualified Text.Pandoc.UTF8 as UTF8
import Data.Char ( chr, ord ) import Data.Char ( chr, ord )
import Control.Monad import Control.Monad

View file

@ -43,7 +43,6 @@ import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag, import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag,
isTextTag, isCommentTag ) isTextTag, isCommentTag )
import Text.Pandoc.XML ( fromEntities ) import Text.Pandoc.XML ( fromEntities )
import Text.Parsec
import Control.Monad (when, liftM, guard, mzero) import Control.Monad (when, liftM, guard, mzero)
import Text.HTML.TagSoup import Text.HTML.TagSoup
import Text.HTML.TagSoup.Match (tagOpen) import Text.HTML.TagSoup.Match (tagOpen)

View file

@ -33,7 +33,6 @@ module Text.Pandoc.Readers.RST (
import Text.Pandoc.Definition import Text.Pandoc.Definition
import Text.Pandoc.Shared import Text.Pandoc.Shared
import Text.Pandoc.Parsing import Text.Pandoc.Parsing
import Text.Parsec
import Control.Monad ( when, liftM, guard, mzero ) import Control.Monad ( when, liftM, guard, mzero )
import Data.List ( findIndex, intercalate, transpose, sort, deleteFirstsBy ) import Data.List ( findIndex, intercalate, transpose, sort, deleteFirstsBy )
import qualified Data.Map as M import qualified Data.Map as M

View file

@ -60,7 +60,6 @@ import Text.Pandoc.Shared
import Text.Pandoc.Parsing import Text.Pandoc.Parsing
import Text.Pandoc.Readers.HTML ( htmlTag, isInlineTag, isBlockTag ) import Text.Pandoc.Readers.HTML ( htmlTag, isInlineTag, isBlockTag )
import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock ) import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock )
import Text.Parsec
import Text.HTML.TagSoup.Match import Text.HTML.TagSoup.Match
import Data.Char ( digitToInt, isUpper ) import Data.Char ( digitToInt, isUpper )
import Control.Monad ( guard, liftM ) import Control.Monad ( guard, liftM )

View file

@ -68,7 +68,7 @@ module Text.Pandoc.Templates ( renderTemplate
, TemplateTarget , TemplateTarget
, getDefaultTemplate ) where , getDefaultTemplate ) where
import Text.Parsec import Text.Pandoc.Parsing
import Control.Monad (liftM, when, forM, mzero) import Control.Monad (liftM, when, forM, mzero)
import System.FilePath import System.FilePath
import Data.List (intercalate, intersperse) import Data.List (intercalate, intersperse)

View file

@ -40,8 +40,7 @@ module Text.Pandoc.Writers.AsciiDoc (writeAsciiDoc) where
import Text.Pandoc.Definition import Text.Pandoc.Definition
import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Templates (renderTemplate)
import Text.Pandoc.Shared import Text.Pandoc.Shared
import Text.Pandoc.Parsing hiding (blankline) import Text.Pandoc.Parsing hiding (blankline, space)
import Text.Parsec ( Parsec, runParser )
import Data.List ( isPrefixOf, intersperse, intercalate ) import Data.List ( isPrefixOf, intersperse, intercalate )
import Text.Pandoc.Pretty import Text.Pandoc.Pretty
import Control.Monad.State import Control.Monad.State

View file

@ -35,8 +35,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Generic import Text.Pandoc.Generic
import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Templates (renderTemplate)
import Text.Pandoc.Shared import Text.Pandoc.Shared
import Text.Pandoc.Parsing hiding (blankline) import Text.Pandoc.Parsing hiding (blankline, char, space)
import Text.Parsec ( Parsec, runParser )
import Data.List ( group, isPrefixOf, find, intersperse, transpose ) import Data.List ( group, isPrefixOf, find, intersperse, transpose )
import Text.Pandoc.Pretty import Text.Pandoc.Pretty
import Control.Monad.State import Control.Monad.State