Text.Highlighting.Kate.Types

highlighting-kate-0.6.3: Syntax highlighting

Copyright | Copyright (C) 2008 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Text.Highlighting.Kate.Types

Description

Definitions for data structures needed by highlighting-kate.

Synopsis

- type Context = (String, String)
- type ContextStack = [Context]
- data SyntaxState = SyntaxState {
  - synStContexts :: ContextStack
  - synStLineNumber :: Int
  - synStPrevChar :: Char
  - synStPrevNonspace :: Bool
  - synStContinuation :: Bool
  - synStCaseSensitive :: Bool
  - synStKeywordCaseSensitive :: Bool
  - synStCaptures :: [String]
  }
- defaultSyntaxState :: SyntaxState
- type Token = (TokenType, String)
- data TokenType
  - = KeywordTok
  - | DataTypeTok
  - | DecValTok
  - | BaseNTok
  - | FloatTok
  - | ConstantTok
  - | CharTok
  - | SpecialCharTok
  - | StringTok
  - | VerbatimStringTok
  - | SpecialStringTok
  - | ImportTok
  - | CommentTok
  - | DocumentationTok
  - | AnnotationTok
  - | CommentVarTok
  - | OtherTok
  - | FunctionTok
  - | VariableTok
  - | ControlFlowTok
  - | OperatorTok
  - | BuiltInTok
  - | ExtensionTok
  - | PreprocessorTok
  - | AttributeTok
  - | RegionMarkerTok
  - | InformationTok
  - | WarningTok
  - | AlertTok
  - | ErrorTok
  - | NormalTok
- type SourceLine = [Token]
- type KateParser = GenParser Char SyntaxState
- data TokenStyle = TokenStyle {
  - tokenColor :: Maybe Color
  - tokenBackground :: Maybe Color
  - tokenBold :: Bool
  - tokenItalic :: Bool
  - tokenUnderline :: Bool
  }
- defStyle :: TokenStyle
- data Color = RGB Word8 Word8 Word8
- class ToColor a where
- class FromColor a where
- data Style = Style {
  - tokenStyles :: [(TokenType, TokenStyle)]
  - defaultColor :: Maybe Color
  - backgroundColor :: Maybe Color
  - lineNumberColor :: Maybe Color
  - lineNumberBackgroundColor :: Maybe Color
  }
- data FormatOptions = FormatOptions {
  - numberLines :: Bool
  - startNumber :: Int
  - lineAnchors :: Bool
  - titleAttributes :: Bool
  - codeClasses :: [String]
  - containerClasses :: [String]
  }
- defaultFormatOpts :: FormatOptions

# Documentation

type Context = (String, String) #

A context: pair of syntax name and context name.

type ContextStack = [Context] #

A stack of contexts. (Language-specific context stacks must be maintained because of IncludeRules.)

data SyntaxState #

State for syntax parser.

Constructors

SyntaxState |
Fields synStContexts :: ContextStack Stack of contexts synStLineNumber :: Int Number of current line synStPrevChar :: Char Last character parsed synStPrevNonspace :: Bool True if we've parsed a nonspace synStContinuation :: Bool True if last thing parsed is a LineContinue synStCaseSensitive :: Bool Language is case-sensitive synStKeywordCaseSensitive :: Bool Keywords are case-sensitive synStCaptures :: [String] List of regex captures from last capturing match

Instances

Show SyntaxState # |
Methods showsPrec :: Int -> SyntaxState -> ShowS # show :: SyntaxState -> String # showList :: [SyntaxState] -> ShowS #

defaultSyntaxState :: SyntaxState #

type Token = (TokenType, String) #

A pair consisting of a list of attributes and some text.

data TokenType #

Constructors

KeywordTok |
DataTypeTok |
DecValTok |
BaseNTok |
FloatTok |
ConstantTok |
CharTok |
SpecialCharTok |
StringTok |
VerbatimStringTok |
SpecialStringTok |
ImportTok |
CommentTok |
DocumentationTok |
AnnotationTok |
CommentVarTok |
OtherTok |
FunctionTok |
VariableTok |
ControlFlowTok |
OperatorTok |
BuiltInTok |
ExtensionTok |
PreprocessorTok |
AttributeTok |
RegionMarkerTok |
InformationTok |
WarningTok |
AlertTok |
ErrorTok |
NormalTok |

Instances

Enum TokenType # |
Methods succ :: TokenType -> TokenType # pred :: TokenType -> TokenType # toEnum :: Int -> TokenType # fromEnum :: TokenType -> Int # enumFrom :: TokenType -> [TokenType] # enumFromThen :: TokenType -> TokenType -> [TokenType] # enumFromTo :: TokenType -> TokenType -> [TokenType] # enumFromThenTo :: TokenType -> TokenType -> TokenType -> [TokenType] #
Eq TokenType # |
Methods (==) :: TokenType -> TokenType -> Bool # (/=) :: TokenType -> TokenType -> Bool #
Data TokenType # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TokenType -> c TokenType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TokenType # toConstr :: TokenType -> Constr # dataTypeOf :: TokenType -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TokenType) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenType) # gmapT :: (forall b. Data b => b -> b) -> TokenType -> TokenType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TokenType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TokenType -> r # gmapQ :: (forall d. Data d => d -> u) -> TokenType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TokenType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TokenType -> m TokenType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenType -> m TokenType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenType -> m TokenType #
Read TokenType # |
Methods readsPrec :: Int -> ReadS TokenType # readList :: ReadS [TokenType] # readPrec :: ReadPrec TokenType # readListPrec :: ReadPrec [TokenType] #
Show TokenType # |
Methods showsPrec :: Int -> TokenType -> ShowS # show :: TokenType -> String # showList :: [TokenType] -> ShowS #

type SourceLine = [Token] #

A line of source, list of labeled source items.

type KateParser = GenParser Char SyntaxState #

data TokenStyle #

Constructors

TokenStyle |
Fields tokenColor :: Maybe Color tokenBackground :: Maybe Color tokenBold :: Bool tokenItalic :: Bool tokenUnderline :: Bool

Instances

Data TokenStyle # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TokenStyle -> c TokenStyle # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TokenStyle # toConstr :: TokenStyle -> Constr # dataTypeOf :: TokenStyle -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TokenStyle) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TokenStyle) # gmapT :: (forall b. Data b => b -> b) -> TokenStyle -> TokenStyle # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TokenStyle -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TokenStyle -> r # gmapQ :: (forall d. Data d => d -> u) -> TokenStyle -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TokenStyle -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TokenStyle -> m TokenStyle # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenStyle -> m TokenStyle # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TokenStyle -> m TokenStyle #
Read TokenStyle # |
Methods readsPrec :: Int -> ReadS TokenStyle # readList :: ReadS [TokenStyle] # readPrec :: ReadPrec TokenStyle # readListPrec :: ReadPrec [TokenStyle] #
Show TokenStyle # |
Methods showsPrec :: Int -> TokenStyle -> ShowS # show :: TokenStyle -> String # showList :: [TokenStyle] -> ShowS #

defStyle :: TokenStyle #

data Color #

Constructors

RGB Word8 Word8 Word8 |

Instances

Data Color # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Color -> c Color # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Color # toConstr :: Color -> Constr # dataTypeOf :: Color -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Color) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Color) # gmapT :: (forall b. Data b => b -> b) -> Color -> Color # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Color -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Color -> r # gmapQ :: (forall d. Data d => d -> u) -> Color -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Color -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Color -> m Color # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Color -> m Color # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Color -> m Color #
Read Color # |
Methods readsPrec :: Int -> ReadS Color # readList :: ReadS [Color] # readPrec :: ReadPrec Color # readListPrec :: ReadPrec [Color] #
Show Color # |
Methods showsPrec :: Int -> Color -> ShowS # show :: Color -> String # showList :: [Color] -> ShowS #

class ToColor a where #

Minimal complete definition

toColor

Methods

toColor :: a -> Maybe Color #

Instances

ToColor Int # |
Methods toColor :: Int -> Maybe Color #
ToColor String # |
Methods toColor :: String -> Maybe Color #
ToColor (Double, Double, Double) # |
Methods toColor :: (Double, Double, Double) -> Maybe Color #
ToColor (Word8, Word8, Word8) # |
Methods toColor :: (Word8, Word8, Word8) -> Maybe Color #

class FromColor a where #

Minimal complete definition

fromColor

Methods

fromColor :: Color -> a #

Instances

FromColor String # |
Methods fromColor :: Color -> String #
FromColor (Double, Double, Double) # |
Methods fromColor :: Color -> (Double, Double, Double) #
FromColor (Word8, Word8, Word8) # |
Methods fromColor :: Color -> (Word8, Word8, Word8) #

data Style #

Constructors

Style |
Fields tokenStyles :: [(TokenType, TokenStyle)] defaultColor :: Maybe Color backgroundColor :: Maybe Color lineNumberColor :: Maybe Color lineNumberBackgroundColor :: Maybe Color

Instances

Data Style # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Style -> c Style # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Style # toConstr :: Style -> Constr # dataTypeOf :: Style -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Style) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Style) # gmapT :: (forall b. Data b => b -> b) -> Style -> Style # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Style -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Style -> r # gmapQ :: (forall d. Data d => d -> u) -> Style -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Style -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Style -> m Style # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Style -> m Style # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Style -> m Style #
Read Style # |
Methods readsPrec :: Int -> ReadS Style # readList :: ReadS [Style] # readPrec :: ReadPrec Style # readListPrec :: ReadPrec [Style] #
Show Style # |
Methods showsPrec :: Int -> Style -> ShowS # show :: Style -> String # showList :: [Style] -> ShowS #

data FormatOptions #

Options for formatting source code.

Constructors

FormatOptions |
Fields numberLines :: Bool Number lines startNumber :: Int Number of first line lineAnchors :: Bool Anchors on each line number titleAttributes :: Bool Html titles with token types codeClasses :: [String] Additional classes for Html code tag containerClasses :: [String] Additional classes for Html container tag (pre or table depending on numberLines)

Instances

Eq FormatOptions # |
Methods (==) :: FormatOptions -> FormatOptions -> Bool # (/=) :: FormatOptions -> FormatOptions -> Bool #
Read FormatOptions # |
Methods readsPrec :: Int -> ReadS FormatOptions # readList :: ReadS [FormatOptions] # readPrec :: ReadPrec FormatOptions # readListPrec :: ReadPrec [FormatOptions] #
Show FormatOptions # |
Methods showsPrec :: Int -> FormatOptions -> ShowS # show :: FormatOptions -> String # showList :: [FormatOptions] -> ShowS #

defaultFormatOpts :: FormatOptions #