skylighting-modding-1.0.0.0: Utilities for modifying Skylighting syntaxes

Safe HaskellNone
LanguageHaskell2010

Skylighting.Modding

Contents

Description

Functions for making alterations to skylighting-core values (SyntaxMap, Syntax, Context, Rule, etc.).

Synopsis

Syntax maps

type SyntaxMap = Map Text Syntax #

A map of syntaxes, keyed by full name.

syntaxMap :: Syntax -> SyntaxMap Source #

Convert a Syntax into a SyntaxMap that contains only that one syntax.

addSyntax :: Syntax -> SyntaxMap -> SyntaxMap Source #

Adds one Syntax to a SyntaxMap, or replaces a context of the same name if one exists.

modifySyntax Source #

Arguments

:: Text

The name of the syntax to modify

-> (Syntax -> Syntax) 
-> SyntaxMap 
-> SyntaxMap 

Modify a SyntaxMap by looking up a particular syntax by name, applying some function to it, and placing the resulting syntax into the map in place of the original syntax.

Syntax fields

modifySyntaxContexts :: (ContextMap -> ContextMap) -> Syntax -> Syntax Source #

Apply a function to the sContexts field of a Syntax.

Context maps

type ContextMap = Map Text Context Source #

A map of contexts, keyed by cName.

This is the type of sContexts.

contextMap :: Context -> ContextMap Source #

Convert a Context into a ContextMap that contains only that one context.

addContext :: Context -> ContextMap -> ContextMap Source #

Adds one Context to a ContextMap, or replaces a context of the same name if one exists.

modifyContext Source #

Arguments

:: Text

The name of the context to modify

-> (Context -> Context) 
-> ContextMap 
-> ContextMap 

Modify a SyntaxMap by looking up a particular syntax by name, applying some function to it, and placing the resulting syntax into the map in place of the original syntax.

Rules

replaceKeywordRule :: Rule -> Context -> Context Source #

Alters a Context by replacing any Rule that looks like a typical keyword rule (as determined by isKeywordRule) with the given rule.

isKeywordRule :: Rule -> Bool Source #

Determines whether a Rule looks like a typical rule for keywords:

  1. rAttribute = KeywordTok
  2. rMatcher is of the Keyword variety