docvim-0.3.1.2: Documentation generator for Vim plug-ins

Safe HaskellNone
LanguageHaskell2010

Text.Docvim.AST

Synopsis

Documentation

data Node Source #

Instances

Eq Node Source # 

Methods

(==) :: Node -> Node -> Bool #

(/=) :: Node -> Node -> Bool #

Data Node Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Node -> c Node #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Node #

toConstr :: Node -> Constr #

dataTypeOf :: Node -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Node) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Node) #

gmapT :: (forall b. Data b => b -> b) -> Node -> Node #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Node -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Node -> r #

gmapQ :: (forall d. Data d => d -> u) -> Node -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Node -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Node -> m Node #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Node -> m Node #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Node -> m Node #

Show Node Source # 

Methods

showsPrec :: Int -> Node -> ShowS #

show :: Node -> String #

showList :: [Node] -> ShowS #

Plated Node Source # 

data ArgumentList Source #

Constructors

ArgumentList [Argument] 

Instances

Eq ArgumentList Source # 
Data ArgumentList Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ArgumentList -> c ArgumentList #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ArgumentList #

toConstr :: ArgumentList -> Constr #

dataTypeOf :: ArgumentList -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c ArgumentList) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgumentList) #

gmapT :: (forall b. Data b => b -> b) -> ArgumentList -> ArgumentList #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ArgumentList -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ArgumentList -> r #

gmapQ :: (forall d. Data d => d -> u) -> ArgumentList -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ArgumentList -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ArgumentList -> m ArgumentList #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgumentList -> m ArgumentList #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgumentList -> m ArgumentList #

Show ArgumentList Source # 

data Argument Source #

Constructors

Argument String 

Instances

Eq Argument Source # 
Data Argument Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Argument -> c Argument #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Argument #

toConstr :: Argument -> Constr #

dataTypeOf :: Argument -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Argument) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Argument) #

gmapT :: (forall b. Data b => b -> b) -> Argument -> Argument #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Argument -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Argument -> r #

gmapQ :: (forall d. Data d => d -> u) -> Argument -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Argument -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Argument -> m Argument #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Argument -> m Argument #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Argument -> m Argument #

Show Argument Source # 

walk :: Monoid a => (Node -> a) -> a -> Node -> a Source #

Walks an AST node calling the supplied visitor function.

This is an in-order traversal.

For example, to implement a visitor which counts all nodes:

 import Data.Monoid
 count = getSum $ walk (\_ -> 1) (Sum 0) tree

For comparison, here is a (probably inefficient) alternative way using Plated instead of walk:

import Control.Lens.Operators
import Control.Lens.Plated
import Data.Data.Lens
count = length $ tree ^.. cosmosOf uniplate

Another example; accumulating SubheadingAnnotation nodes into a list:

 accumulator node@(SubheadingAnnotation _) = [node]
 accumulator _ = [] -- skip everything else
 nodes = walk accumulator [] tree

Again, for comparison, the same without walk, this time using a list comprehension:

import Control.Lens.Operators
import Control.Lens.Plated
import Data.Data.Lens
[n | n@(SubheadingAnnotation _) <- tree ^.. cosmosOf uniplate]

sanitizeAnchor :: String -> String Source #

Sanitizes a link target similar to the way that GitHub does:

  • Downcase.
  • Filter, keeping only letter, number, space, hyphen.
  • Change spaces to hyphens.
  • Uniquify by appending "-1", "-2", "-3" etc (not yet implemented).

We use this both for generating GitHub friendly link targets, and for auto-generating new link targets for use inside Vim help files.

Source: https://gist.github.com/asabaylus/3071099#gistcomment-1593627

invalidNode :: forall t. t Source #