Copyright | (c) Don Stewart 2007 |
---|---|
License | GPL-2 |
Maintainer | yi-devel@googlegroups.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
This module defines a common interface for syntax-awareness.
There have been many tens of wasted hours in this and lexer modules. This note is to commemorate those who have fallen in battle.
- data Highlighter cache syntax = SynHL {}
- data Cache state result
- data Scanner st a = Scanner {
- scanInit :: st
- scanLooked :: st -> Point
- scanEmpty :: a
- scanRun :: st -> [(st, a)]
- data ExtHL syntax = forall cache . ExtHL (Highlighter cache syntax)
- noHighlighter :: Highlighter () syntax
- mkHighlighter :: forall state result. Show state => (Scanner Point Char -> Scanner state result) -> Highlighter (Cache state result) result
- skipScanner :: Int -> Scanner st a -> Scanner st a
- emptyFileScan :: Scanner Point Char
- newtype Point = Point {}
- newtype Size = Size {}
- type Length = Int
- type Stroke = Span StyleName
- data Span a = Span {
- spanBegin :: !Point
- spanContents :: !a
- spanEnd :: !Point
Documentation
data Highlighter cache syntax Source
The main type of syntax highlighters. This record type combines all the required functions, and is parametrized on the type of the internal state.
SynHL | |
|
Scanner | |
|
forall cache . ExtHL (Highlighter cache syntax) |
noHighlighter :: Highlighter () syntax Source
mkHighlighter :: forall state result. Show state => (Scanner Point Char -> Scanner state result) -> Highlighter (Cache state result) result Source
This takes as input a scanner that returns the "full" result at each element in the list; perhaps in a different form for the purpose of incremental-lazy eval.
skipScanner :: Int -> Scanner st a -> Scanner st a Source
A point in a buffer
Size of a buffer region