highlighting-kate-0.5.3.9: Syntax highlighting

Portability | portable
Stability | alpha
Maintainer | John MacFarlane <jgm@berkeley.edu>
Safe Haskell | Safe-Inferred

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
  - synStCaseSensitive :: Bool
  - synStKeywordCaseSensitive :: Bool
  - synStCaptures :: [String]
  }
- type Token = (TokenType, String)
- data TokenType
  - = KeywordTok
  - | DataTypeTok
  - | DecValTok
  - | BaseNTok
  - | FloatTok
  - | CharTok
  - | StringTok
  - | CommentTok
  - | OtherTok
  - | AlertTok
  - | FunctionTok
  - | RegionMarkerTok
  - | 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 synStCaseSensitive :: Bool Language is case-sensitive synStKeywordCaseSensitive :: Bool Keywords are case-sensitive synStCaptures :: [String] List of regex captures from last capturing match

Instances

Read SyntaxState |
Show SyntaxState |

type Token = (TokenType, String)

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

data TokenType

Constructors

KeywordTok |
DataTypeTok |
DecValTok |
BaseNTok |
FloatTok |
CharTok |
StringTok |
CommentTok |
OtherTok |
AlertTok |
FunctionTok |
RegionMarkerTok |
ErrorTok |
NormalTok |

Instances

Enum TokenType |
Eq 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

Read TokenStyle |
Show TokenStyle |

defStyle :: TokenStyle

data Color

Constructors

RGB Word8 Word8 Word8 |

Instances

Read Color |
Show Color |

class ToColor a where

Methods

toColor :: a -> Maybe Color

Instances

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

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