highlighting-kate-0.6: 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
  - toColor :: a -> Maybe Color
- class FromColor a where
  - fromColor :: Color -> a
- 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 |

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 |
Eq TokenType |
Data TokenType |
Read TokenType |
Show TokenType |

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 |
Read TokenStyle |
Show TokenStyle |

defStyle :: TokenStyle

data Color

Constructors

RGB Word8 Word8 Word8 |

Instances

Data Color |
Read Color |
Show Color |

class ToColor a where

Methods

toColor :: a -> Maybe Color

Instances

ToColor Int |
ToColor String |
ToColor (Double, Double, Double) |
ToColor (Word8, Word8, Word8) |

class FromColor a where

Methods

fromColor :: Color -> a

Instances

FromColor String |
FromColor (Double, Double, Double) |
FromColor (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 |
Read Style |
Show Style |

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 |
Read FormatOptions |
Show FormatOptions |

defaultFormatOpts :: FormatOptions