-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | syntax highlighting library
--   
--   Skylighting is a syntax highlighting library with support for over one
--   hundred languages. It derives its tokenizers from XML syntax
--   definitions used by KDE's KSyntaxHighlighting framework, so any syntax
--   supported by that framework can be added. An optional command-line
--   program is provided. Skylighting is intended to be the successor to
--   highlighting-kate.
@package skylighting
@version 0.1.1.5

module Skylighting.Regex

-- | A compiled regular expression
data Regex :: *
data RegexException
data RE
RE :: ByteString -> Maybe Regex -> Bool -> RE
[reString] :: RE -> ByteString
[reCompiled] :: RE -> Maybe Regex
[reCaseSensitive] :: RE -> Bool

-- | Compile a PCRE regex. If the first parameter is True, the regex is
--   case-sensitive, otherwise caseless. The regex is compiled from a
--   bytestring interpreted as UTF-8. If the regex cannot be compiled, a
--   <a>RegexException</a> is thrown.
compileRegex :: Bool -> ByteString -> Regex
matchRegex :: Regex -> ByteString -> Maybe [ByteString]

-- | Convert octal escapes to the form pcre wants. Note: need at least pcre
--   8.34 for the form o{dddd}. So we prefer ddd or x{...}.
convertOctalEscapes :: String -> String
instance GHC.Generics.Generic Skylighting.Regex.RegexException
instance GHC.Show.Show Skylighting.Regex.RegexException
instance GHC.Exception.Exception Skylighting.Regex.RegexException
instance GHC.Show.Show Skylighting.Regex.RE

module Skylighting.Types

-- | Full name of a context: the first member of the pair is the full
--   syntax name, the second the context name within that syntax.
type ContextName = (Text, Text)
data KeywordAttr
KeywordAttr :: Bool -> Set Char -> KeywordAttr
[keywordCaseSensitive] :: KeywordAttr -> Bool
[keywordDelims] :: KeywordAttr -> Set Char
data WordSet a
CaseSensitiveWords :: (Set a) -> WordSet a
CaseInsensitiveWords :: (Set (CI a)) -> WordSet a

-- | A set of words to match (either case-sensitive or case-insensitive).
makeWordSet :: (FoldCase a, Ord a) => Bool -> [a] -> WordSet a
data Matcher
DetectChar :: Char -> Matcher
Detect2Chars :: Char -> Char -> Matcher
AnyChar :: [Char] -> Matcher
RangeDetect :: Char -> Char -> Matcher
StringDetect :: Text -> Matcher
WordDetect :: Text -> Matcher
RegExpr :: RE -> Matcher
Keyword :: KeywordAttr -> (WordSet Text) -> Matcher
Int :: Matcher
Float :: Matcher
HlCOct :: Matcher
HlCHex :: Matcher
HlCStringChar :: Matcher
HlCChar :: Matcher
LineContinue :: Matcher
IncludeRules :: ContextName -> Matcher
DetectSpaces :: Matcher
DetectIdentifier :: Matcher

-- | A rule corresponds to one of the elements of a Kate syntax
--   highlighting "context."
data Rule
Rule :: Matcher -> TokenType -> Bool -> Bool -> Bool -> [Rule] -> Bool -> Bool -> Maybe Int -> [ContextSwitch] -> Rule
[rMatcher] :: Rule -> Matcher
[rAttribute] :: Rule -> TokenType
[rIncludeAttribute] :: Rule -> Bool
[rDynamic] :: Rule -> Bool
[rCaseSensitive] :: Rule -> Bool
[rChildren] :: Rule -> [Rule]
[rLookahead] :: Rule -> Bool
[rFirstNonspace] :: Rule -> Bool
[rColumn] :: Rule -> Maybe Int
[rContextSwitch] :: Rule -> [ContextSwitch]

-- | A Context corresponds to a context element in a Kate syntax
--   description.
data Context
Context :: Text -> Text -> [Rule] -> TokenType -> [ContextSwitch] -> [ContextSwitch] -> [ContextSwitch] -> Bool -> [ContextSwitch] -> Bool -> Context
[cName] :: Context -> Text
[cSyntax] :: Context -> Text
[cRules] :: Context -> [Rule]
[cAttribute] :: Context -> TokenType
[cLineEmptyContext] :: Context -> [ContextSwitch]
[cLineEndContext] :: Context -> [ContextSwitch]
[cLineBeginContext] :: Context -> [ContextSwitch]
[cFallthrough] :: Context -> Bool
[cFallthroughContext] :: Context -> [ContextSwitch]
[cDynamic] :: Context -> Bool
data ContextSwitch
Pop :: ContextSwitch
Push :: ContextName -> ContextSwitch

-- | A syntax corresponds to a complete Kate syntax description. The
--   <a>sShortname</a> field is derived from the filename.
data Syntax
Syntax :: Text -> String -> Text -> Map Text Context -> Text -> Text -> Text -> [String] -> Text -> Syntax
[sName] :: Syntax -> Text
[sFilename] :: Syntax -> String
[sShortname] :: Syntax -> Text
[sContexts] :: Syntax -> Map Text Context
[sAuthor] :: Syntax -> Text
[sVersion] :: Syntax -> Text
[sLicense] :: Syntax -> Text
[sExtensions] :: Syntax -> [String]
[sStartingContext] :: Syntax -> Text

-- | A map of syntaxes, keyed by full name.
type SyntaxMap = Map Text Syntax

-- | A pair consisting of a list of attributes and some text.
type Token = (TokenType, Text)

-- | <a>KeywordTok</a> corresponds to <tt>dsKeyword</tt> in Kate syntax
--   descriptions, and so on.
data TokenType
KeywordTok :: TokenType
DataTypeTok :: TokenType
DecValTok :: TokenType
BaseNTok :: TokenType
FloatTok :: TokenType
ConstantTok :: TokenType
CharTok :: TokenType
SpecialCharTok :: TokenType
StringTok :: TokenType
VerbatimStringTok :: TokenType
SpecialStringTok :: TokenType
ImportTok :: TokenType
CommentTok :: TokenType
DocumentationTok :: TokenType
AnnotationTok :: TokenType
CommentVarTok :: TokenType
OtherTok :: TokenType
FunctionTok :: TokenType
VariableTok :: TokenType
ControlFlowTok :: TokenType
OperatorTok :: TokenType
BuiltInTok :: TokenType
ExtensionTok :: TokenType
PreprocessorTok :: TokenType
AttributeTok :: TokenType
RegionMarkerTok :: TokenType
InformationTok :: TokenType
WarningTok :: TokenType
AlertTok :: TokenType
ErrorTok :: TokenType
NormalTok :: TokenType

-- | A line of source: a list of labeled tokens.
type SourceLine = [Token]

-- | A <a>TokenStyle</a> determines how a token is to be rendered.
data TokenStyle
TokenStyle :: Maybe Color -> Maybe Color -> Bool -> Bool -> Bool -> TokenStyle
[tokenColor] :: TokenStyle -> Maybe Color
[tokenBackground] :: TokenStyle -> Maybe Color
[tokenBold] :: TokenStyle -> Bool
[tokenItalic] :: TokenStyle -> Bool
[tokenUnderline] :: TokenStyle -> Bool

-- | Default style.
defStyle :: TokenStyle
data Color
RGB :: Word8 -> Word8 -> Word8 -> Color
class ToColor a
toColor :: ToColor a => a -> Maybe Color
class FromColor a
fromColor :: FromColor a => Color -> a

-- | A rendering style. This determines how each kind of token is to be
--   rendered, and sets a default color and background color for normal
--   tokens. Line numbers can have a different color and background color.
data Style
Style :: [(TokenType, TokenStyle)] -> Maybe Color -> Maybe Color -> Maybe Color -> Maybe Color -> Style
[tokenStyles] :: Style -> [(TokenType, TokenStyle)]
[defaultColor] :: Style -> Maybe Color
[backgroundColor] :: Style -> Maybe Color
[lineNumberColor] :: Style -> Maybe Color
[lineNumberBackgroundColor] :: Style -> Maybe Color

-- | Options for formatting source code.
data FormatOptions
FormatOptions :: Bool -> Int -> Bool -> Bool -> [Text] -> [Text] -> FormatOptions

-- | Number lines
[numberLines] :: FormatOptions -> Bool

-- | Number of first line
[startNumber] :: FormatOptions -> Int

-- | Anchors on each line number
[lineAnchors] :: FormatOptions -> Bool

-- | Html titles with token types
[titleAttributes] :: FormatOptions -> Bool

-- | Additional classes for Html code tag
[codeClasses] :: FormatOptions -> [Text]

-- | Additional classes for Html container tag (pre or table depending on
--   numberLines)
[containerClasses] :: FormatOptions -> [Text]
defaultFormatOpts :: FormatOptions
instance GHC.Read.Read Skylighting.Types.FormatOptions
instance GHC.Show.Show Skylighting.Types.FormatOptions
instance GHC.Classes.Eq Skylighting.Types.FormatOptions
instance Data.Data.Data Skylighting.Types.Style
instance GHC.Classes.Ord Skylighting.Types.Style
instance GHC.Classes.Eq Skylighting.Types.Style
instance GHC.Show.Show Skylighting.Types.Style
instance GHC.Read.Read Skylighting.Types.Style
instance Data.Data.Data Skylighting.Types.TokenStyle
instance GHC.Classes.Eq Skylighting.Types.TokenStyle
instance GHC.Classes.Ord Skylighting.Types.TokenStyle
instance GHC.Read.Read Skylighting.Types.TokenStyle
instance GHC.Show.Show Skylighting.Types.TokenStyle
instance Data.Data.Data Skylighting.Types.Color
instance GHC.Classes.Eq Skylighting.Types.Color
instance GHC.Classes.Ord Skylighting.Types.Color
instance GHC.Read.Read Skylighting.Types.Color
instance GHC.Show.Show Skylighting.Types.Color
instance GHC.Show.Show Skylighting.Types.Syntax
instance GHC.Show.Show Skylighting.Types.Context
instance GHC.Show.Show Skylighting.Types.Rule
instance Data.Data.Data Skylighting.Types.TokenType
instance GHC.Enum.Enum Skylighting.Types.TokenType
instance GHC.Classes.Ord Skylighting.Types.TokenType
instance GHC.Classes.Eq Skylighting.Types.TokenType
instance GHC.Show.Show Skylighting.Types.TokenType
instance GHC.Read.Read Skylighting.Types.TokenType
instance GHC.Show.Show Skylighting.Types.ContextSwitch
instance GHC.Show.Show Skylighting.Types.Matcher
instance GHC.Show.Show Skylighting.Types.KeywordAttr
instance GHC.Show.Show a => GHC.Show.Show (Skylighting.Types.WordSet a)
instance Data.Aeson.Types.FromJSON.FromJSON Skylighting.Types.TokenType
instance Data.Aeson.Types.FromJSON.FromJSON Skylighting.Types.TokenStyle
instance Skylighting.Types.ToColor GHC.Base.String
instance Skylighting.Types.ToColor GHC.Types.Int
instance Skylighting.Types.ToColor (GHC.Word.Word8, GHC.Word.Word8, GHC.Word.Word8)
instance Skylighting.Types.ToColor (GHC.Types.Double, GHC.Types.Double, GHC.Types.Double)
instance Data.Aeson.Types.FromJSON.FromJSON Skylighting.Types.Color
instance Skylighting.Types.FromColor GHC.Base.String
instance Skylighting.Types.FromColor (GHC.Types.Double, GHC.Types.Double, GHC.Types.Double)
instance Skylighting.Types.FromColor (GHC.Word.Word8, GHC.Word.Word8, GHC.Word.Word8)
instance Data.Aeson.Types.FromJSON.FromJSON Skylighting.Types.Style

module Skylighting.Tokenizer

-- | Tokenize some text using <a>Syntax</a>.
tokenize :: TokenizerConfig -> Syntax -> Text -> Either String [SourceLine]

-- | Configuration options for <a>tokenize</a>.
data TokenizerConfig
TokenizerConfig :: SyntaxMap -> Bool -> TokenizerConfig

-- | Syntax map to use
[syntaxMap] :: TokenizerConfig -> SyntaxMap

-- | Generate trace output for debugging
[traceOutput] :: TokenizerConfig -> Bool
instance GHC.Show.Show Skylighting.Tokenizer.TokenizerConfig
instance GHC.Show.Show Skylighting.Tokenizer.TokenizerState
instance GHC.Show.Show Skylighting.Tokenizer.ContextStack

module Skylighting.Parser

-- | Parses a file containing a Kate XML syntax definition into a
--   <a>Syntax</a> description.
parseSyntaxDefinition :: String -> IO (Either String Syntax)

-- | Adds a syntax definition to a syntax map, replacing any existing
--   definition with the same name.
addSyntaxDefinition :: Syntax -> SyntaxMap -> SyntaxMap

-- | Scan a list of <a>Syntax</a>s and make sure that <a>IncludeRules</a>
--   never asks for a syntax not in this list. Produces a list of pairs
--   where the first element is the including syntax name and the second
--   element is the (missing) included syntax name. This is intended for
--   sanity checks to avoid run-time errors.
missingIncludes :: [Syntax] -> [(Text, Text)]

module Skylighting.Styles

-- | Parse a KDE theme JSON document into a skylighting Style.
parseTheme :: ByteString -> Either String Style

-- | Style based on kate's default colors.
kate :: Style

-- | Style from the breeze-dark KDE syntax highlighting theme.
breezeDark :: Style

-- | Style based on pygments's default colors.
pygments :: Style

-- | Style based on ultraviolet's espresso_libre.css (dark background).
espresso :: Style

-- | Style based on pygments's tango colors.
tango :: Style

-- | Style based on haddock's source highlighting.
haddock :: Style

-- | Style with no colors.
monochrome :: Style

-- | Style based on the popular zenburn vim color scheme
zenburn :: Style

module Skylighting.Format.HTML

-- | Format tokens using HTML spans inside <tt>code</tt> tags. For example,
--   A <tt>KeywordTok</tt> is rendered as a span with class <tt>kw</tt>.
--   Short class names correspond to <a>TokenType</a>s as follows:
--   <a>KeywordTok</a> = <tt>kw</tt>, <a>DataTypeTok</a> = <tt>dt</tt>,
--   <a>DecValTok</a> = <tt>dv</tt>, <a>BaseNTok</a> = <tt>bn</tt>,
--   <a>FloatTok</a> = <tt>fl</tt>, <a>CharTok</a> = <tt>ch</tt>,
--   <a>StringTok</a> = <tt>st</tt>, <a>CommentTok</a> = <tt>co</tt>,
--   <a>OtherTok</a> = <tt>ot</tt>, <a>AlertTok</a> = <tt>al</tt>,
--   <a>FunctionTok</a> = <tt>fu</tt>, <a>RegionMarkerTok</a> =
--   <tt>re</tt>, <a>ErrorTok</a> = <tt>er</tt>, <a>ConstantTok</a> =
--   <tt>cn</tt>, <a>SpecialCharTok</a> = <tt>sc</tt>,
--   <a>VerbatimStringTok</a> = <tt>vs</tt>, <a>SpecialStringTok</a> =
--   <tt>ss</tt>, <a>ImportTok</a> = <tt>im</tt>, <a>DocumentationTok</a> =
--   <tt>do</tt>, <a>AnnotationTok</a> = <tt>an</tt>, <a>CommentVarTok</a>
--   = <tt>cv</tt>, <a>VariableTok</a> = <tt>va</tt>, <a>ControlFlowTok</a>
--   = <tt>cf</tt>, <a>OperatorTok</a> = <tt>op</tt>, <a>BuiltInTok</a> =
--   <tt>bu</tt>, <a>ExtensionTok</a> = <tt>ex</tt>, <a>PreprocessorTok</a>
--   = <tt>pp</tt>, <a>AttributeTok</a> = <tt>at</tt>,
--   <a>InformationTok</a> = <tt>in</tt>, <a>WarningTok</a> = <tt>wa</tt>.
--   A <a>NormalTok</a> is not marked up at all.
formatHtmlInline :: FormatOptions -> [SourceLine] -> Html

-- | Format tokens as an HTML <tt>pre</tt> block. If line numbering is
--   selected, this is put into a table row with line numbers in the left
--   cell. The whole code block is wrapped in a <tt>div</tt> element to aid
--   styling (e.g. the overflow-x property). See the documentation for
--   <a>formatHtmlInline</a> for information about how tokens are encoded.
formatHtmlBlock :: FormatOptions -> [SourceLine] -> Html

-- | Returns CSS for styling highlighted code according to the given style.
styleToCss :: Style -> String

module Skylighting.Format.LaTeX

-- | Formats tokens as LaTeX using custom commands inside <tt>|</tt>
--   characters. Assumes that <tt>|</tt> is defined as a short verbatim
--   command by the macros produced by <a>styleToLaTeX</a>. A
--   <tt>KeywordTok</tt> is rendered using <tt>\KeywordTok{..}</tt>, and so
--   on.
formatLaTeXInline :: FormatOptions -> [SourceLine] -> Text

-- | Format tokens as a LaTeX <tt>Highlighting</tt> environment inside a
--   <tt>Shaded</tt> environment. <tt>Highlighting</tt> and <tt>Shaded</tt>
--   are defined by the macros produced by <a>styleToLaTeX</a>.
--   <tt>Highlighting</tt> is a verbatim environment using
--   <tt>fancyvrb</tt>; <tt>\</tt>, <tt>{</tt>, and <tt>}</tt> have their
--   normal meanings inside this environment, so that formatting commands
--   work. <tt>Shaded</tt> is either nothing (if the style's background
--   color is default) or a <tt>snugshade</tt> environment from
--   <tt>framed</tt>, providing a background color for the whole code
--   block, even if it spans multiple pages.
formatLaTeXBlock :: FormatOptions -> [SourceLine] -> Text

-- | Converts a <a>Style</a> to a set of LaTeX macro definitions, which
--   should be placed in the document's preamble. Note: default LaTeX setup
--   doesn't allow boldface typewriter font. To make boldface work in
--   styles, you need to use a different typewriter font. This will work
--   for computer modern:
--   
--   <pre>
--   \DeclareFontShape{OT1}{cmtt}{bx}{n}{&lt;5&gt;&lt;6&gt;&lt;7&gt;&lt;8&gt;&lt;9&gt;&lt;10&gt;&lt;10.95&gt;&lt;12&gt;&lt;14.4&gt;&lt;17.28&gt;&lt;20.74&gt;&lt;24.88&gt;cmttb10}{}
--   </pre>
--   
--   Or, with xelatex:
--   
--   <pre>
--   \usepackage{fontspec}
--   \setmainfont[SmallCapsFont={* Caps}]{Latin Modern Roman}
--   \setsansfont{Latin Modern Sans}
--   \setmonofont[SmallCapsFont={Latin Modern Mono Caps}]{Latin Modern Mono Light}
--   </pre>
styleToLaTeX :: Style -> Text

module Skylighting.Syntax
defaultSyntaxMap :: SyntaxMap

module Skylighting

-- | Lookup syntax by (in order) full name (case insensitive), short name
--   (case insensitive), extension.
lookupSyntax :: Text -> SyntaxMap -> Maybe Syntax

-- | Lookup a syntax by full name (case insensitive).
syntaxByName :: SyntaxMap -> Text -> Maybe Syntax

-- | Lookup a syntax by short name (case insensitive).
syntaxByShortName :: SyntaxMap -> Text -> Maybe Syntax

-- | Returns a list of syntaxes appropriate for the given file extension.
syntaxesByExtension :: SyntaxMap -> String -> [Syntax]

-- | Returns a list of syntaxes appropriate for the given filename.
syntaxesByFilename :: SyntaxMap -> String -> [Syntax]
