commonmark-0.2.6.1: Pure Haskell commonmark parser.

Safe Haskell | None
Language | Haskell2010

Commonmark.Tokens

Synopsis

- data Tok = Tok {
  - tokType :: !TokType
  - tokPos :: !SourcePos
  - tokContents :: !Text
  }
- data TokType
  - = Spaces
  - | UnicodeSpace
  - | LineEnd
  - | WordChars
  - | Symbol !Char
- data SourcePos
- tokenize :: String -> Text -> [Tok]
- untokenize :: [Tok] -> Text

# Documentation

data Tok Source #

Constructors

Tok |

Fields

- tokType :: !TokType
- tokPos :: !SourcePos
- tokContents :: !Text

#### Instances

Instances details

Data Tok Source # |

Instance details

Defined in Commonmark.Tokens

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tok -> c Tok Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Tok Source #

toConstr :: Tok -> Constr Source #

dataTypeOf :: Tok -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Tok) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Tok) Source #

gmapT :: (forall b. Data b => b -> b) -> Tok -> Tok Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tok -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tok -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Tok -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Tok -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tok -> m Tok Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tok -> m Tok Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tok -> m Tok Source #

Show Tok Source # |
Instance details Defined in Commonmark.Tokens Methods showsPrec :: Int -> Tok -> ShowS Source # show :: Tok -> String Source # showList :: [Tok] -> ShowS Source #
Eq Tok Source # |
Instance details Defined in Commonmark.Tokens Methods (==) :: Tok -> Tok -> Bool Source # (/=) :: Tok -> Tok -> Bool Source #

data TokType Source #

Constructors

Spaces |
UnicodeSpace |
LineEnd |
WordChars |
Symbol !Char |

#### Instances

Instances details

Data TokType Source # |

Instance details

Defined in Commonmark.Tokens

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TokType -> c TokType Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TokType Source #

toConstr :: TokType -> Constr Source #

dataTypeOf :: TokType -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TokType) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokType) Source #

gmapT :: (forall b. Data b => b -> b) -> TokType -> TokType Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TokType -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TokType -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> TokType -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TokType -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TokType -> m TokType Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TokType -> m TokType Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TokType -> m TokType Source #

Show TokType Source # |
Instance details Defined in Commonmark.Tokens Methods showsPrec :: Int -> TokType -> ShowS Source # show :: TokType -> String Source # showList :: [TokType] -> ShowS Source #
Eq TokType Source # |
Instance details Defined in Commonmark.Tokens Methods (==) :: TokType -> TokType -> Bool Source # (/=) :: TokType -> TokType -> Bool Source #
Ord TokType Source # |
Instance details Defined in Commonmark.Tokens Methods compare :: TokType -> TokType -> Ordering Source # (<) :: TokType -> TokType -> Bool Source # (<=) :: TokType -> TokType -> Bool Source # (>) :: TokType -> TokType -> Bool Source # (>=) :: TokType -> TokType -> Bool Source # max :: TokType -> TokType -> TokType Source # min :: TokType -> TokType -> TokType Source #

data SourcePos Source #

The abstract data type `SourcePos` represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. `SourcePos` is an instance of the `Show`, `Eq` and `Ord` class.

#### Instances

Instances details

Data SourcePos |

Instance details

Defined in Text.Parsec.Pos

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos Source #

toConstr :: SourcePos -> Constr Source #

dataTypeOf :: SourcePos -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) Source #

gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos Source #

Show SourcePos |
Instance details Defined in Text.Parsec.Pos Methods showsPrec :: Int -> SourcePos -> ShowS Source # show :: SourcePos -> String Source # showList :: [SourcePos] -> ShowS Source #
Eq SourcePos |
Instance details Defined in Text.Parsec.Pos Methods (==) :: SourcePos -> SourcePos -> Bool Source # (/=) :: SourcePos -> SourcePos -> Bool Source #
Ord SourcePos |
Instance details Defined in Text.Parsec.Pos Methods compare :: SourcePos -> SourcePos -> Ordering Source # (<) :: SourcePos -> SourcePos -> Bool Source # (<=) :: SourcePos -> SourcePos -> Bool Source # (>) :: SourcePos -> SourcePos -> Bool Source # (>=) :: SourcePos -> SourcePos -> Bool Source # max :: SourcePos -> SourcePos -> SourcePos Source # min :: SourcePos -> SourcePos -> SourcePos Source #

tokenize :: String -> Text -> [Tok] Source #

Convert a `Text` into a list of `Tok`. The first parameter species the source name.

untokenize :: [Tok] -> Text Source #

Reverses `tokenize`. `untokenize . tokenize` should be the identity.