trifecta-1.6.2.1: A modern parser combinator library with convenient diagnostics

Copyright | (C) 2011-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell2010

Text.Trifecta.Highlight

Description

Synopsis

- data Highlight :: *
- data HighlightedRope = HighlightedRope !(IntervalMap Delta Highlight) !Rope
- class HasHighlightedRope c where
- withHighlight :: Highlight -> Doc -> Doc
- data HighlightDoc = HighlightDoc String String HighlightedRope
- class HasHighlightDoc c where
- doc :: String -> HighlightedRope -> HighlightDoc

# Documentation

data Highlight :: * #

Tags used by the `TokenParsing` `highlight` combinator.

Instances

Bounded Highlight |
Methods minBound :: Highlight # maxBound :: Highlight #
Enum Highlight |
Methods succ :: Highlight -> Highlight # pred :: Highlight -> Highlight # toEnum :: Int -> Highlight # fromEnum :: Highlight -> Int # enumFrom :: Highlight -> [Highlight] # enumFromThen :: Highlight -> Highlight -> [Highlight] # enumFromTo :: Highlight -> Highlight -> [Highlight] # enumFromThenTo :: Highlight -> Highlight -> Highlight -> [Highlight] #
Eq Highlight |
Methods (==) :: Highlight -> Highlight -> Bool # (/=) :: Highlight -> Highlight -> Bool #
Ord Highlight |
Methods compare :: Highlight -> Highlight -> Ordering # (<) :: Highlight -> Highlight -> Bool # (<=) :: Highlight -> Highlight -> Bool # (>) :: Highlight -> Highlight -> Bool # (>=) :: Highlight -> Highlight -> Bool # max :: Highlight -> Highlight -> Highlight # min :: Highlight -> Highlight -> Highlight #
Read Highlight |
Methods readsPrec :: Int -> ReadS Highlight # readList :: ReadS [Highlight] # readPrec :: ReadPrec Highlight # readListPrec :: ReadPrec [Highlight] #
Show Highlight |
Methods showsPrec :: Int -> Highlight -> ShowS # show :: Highlight -> String # showList :: [Highlight] -> ShowS #

data HighlightedRope #

A `HighlightedRope` is a `Rope` with an associated `IntervalMap` full of highlighted regions.

Constructors

HighlightedRope !(IntervalMap Delta Highlight) !Rope |

Instances

Semigroup HighlightedRope # |
Methods (<>) :: HighlightedRope -> HighlightedRope -> HighlightedRope # sconcat :: NonEmpty HighlightedRope -> HighlightedRope # stimes :: Integral b => b -> HighlightedRope -> HighlightedRope #
Monoid HighlightedRope # |
Methods mempty :: HighlightedRope # mappend :: HighlightedRope -> HighlightedRope -> HighlightedRope # mconcat :: [HighlightedRope] -> HighlightedRope #
Pretty HighlightedRope # |
Methods pretty :: HighlightedRope -> Doc # prettyList :: [HighlightedRope] -> Doc #
ToMarkup HighlightedRope # |
Methods toMarkup :: HighlightedRope -> Markup # preEscapedToMarkup :: HighlightedRope -> Markup #
HasDelta HighlightedRope # |
Methods delta :: HighlightedRope -> Delta #
HasBytes HighlightedRope # |
Methods bytes :: HighlightedRope -> Int64 #
HasHighlightedRope HighlightedRope # |
Methods highlightedRope :: Lens' HighlightedRope HighlightedRope # ropeContent :: Lens' HighlightedRope Rope # ropeHighlights :: Lens' HighlightedRope (IntervalMap Delta Highlight) #

class HasHighlightedRope c where #

Minimal complete definition

highlightedRope

Methods

highlightedRope :: Lens' c HighlightedRope #

ropeContent :: Lens' c Rope #

ropeHighlights :: Lens' c (IntervalMap Delta Highlight) #

Instances

HasHighlightedRope HighlightedRope # |
Methods highlightedRope :: Lens' HighlightedRope HighlightedRope # ropeContent :: Lens' HighlightedRope Rope # ropeHighlights :: Lens' HighlightedRope (IntervalMap Delta Highlight) #

withHighlight :: Highlight -> Doc -> Doc #

Convert a `Highlight` into a coloration on a `Doc`.

data HighlightDoc #

Represents a source file like an HsColour rendered document

Constructors

HighlightDoc String String HighlightedRope |

Instances

ToMarkup HighlightDoc # |
Methods toMarkup :: HighlightDoc -> Markup # preEscapedToMarkup :: HighlightDoc -> Markup #
HasHighlightDoc HighlightDoc # |
Methods highlightDoc :: Lens' HighlightDoc HighlightDoc # docContent :: Lens' HighlightDoc HighlightedRope # docCss :: Lens' HighlightDoc String # docTitle :: Lens' HighlightDoc String #

class HasHighlightDoc c where #

Minimal complete definition

highlightDoc

Methods

highlightDoc :: Lens' c HighlightDoc #

docContent :: Lens' c HighlightedRope #

docCss :: Lens' c String #

docTitle :: Lens' c String #

Instances

HasHighlightDoc HighlightDoc # |
Methods highlightDoc :: Lens' HighlightDoc HighlightDoc # docContent :: Lens' HighlightDoc HighlightedRope # docCss :: Lens' HighlightDoc String # docTitle :: Lens' HighlightDoc String #

doc :: String -> HighlightedRope -> HighlightDoc #

Generate an HTML document from a title and a `HighlightedRope`.