yi-0.6.2.4: The Haskell-Scriptable Editor

Yi.Syntax

Description

This module defines a common interface for syntax-awareness.

Synopsis

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.

Constructors

SynHL 

Fields

hlStartState :: cache

The start state for the highlighter.

hlRun :: Scanner Point Char -> Point -> cache -> cache
 
hlGetTree :: cache -> Int -> syntax
 
hlFocus :: Map Int Region -> cache -> cache

focus at a given point, and return the coresponding node. (hint -- the root can always be returned, at the cost of performance.)

data Cache state result Source

data Scanner st a Source

Constructors

Scanner 

Fields

scanInit :: st

Initial state

scanLooked :: st -> Point

How far did the scanner look to produce this intermediate state? The state can be reused as long as nothing changes before that point.

scanEmpty :: a
 
scanRun :: st -> [(st, a)]

Running function returns a list of results and intermediate states. Note: the state is the state before producing the result in the second component.

Instances

data ExtHL syntax Source

Constructors

forall cache . ExtHL (Highlighter cache syntax) 

mkHighlighter :: forall state result. Show state => (Scanner Point Char -> Scanner state result) -> Highlighter (Cache state result) resultSource

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.

newtype Point Source

A point in a buffer

Constructors

Point 

Fields

fromPoint :: Int
 

newtype Size Source

Size of a buffer region

Constructors

Size 

Fields

fromSize :: Int
 

data Span a Source

Constructors

Span 

Fields

spanBegin :: !Point
 
spanContents :: !a
 
spanEnd :: !Point