yi-language-0.1.0.5: Collection of language-related Yi libraries.

Copyright(c) Don Stewart 2007
LicenseGPL-2
Maintaineryi-devel@googlegroups.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • ScopedTypeVariables
  • DeriveFunctor
  • DeriveTraversable
  • DeriveFoldable
  • ExistentialQuantification
  • ExplicitForAll

Yi.Syntax

Description

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.

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 -> WindowRef -> syntax
 
hlFocus :: Map WindowRef 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) 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

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