Skylighting.Loader

skylighting-core-0.14.6: syntax highlighting library

Safe Haskell | None
Language | Haskell2010

Skylighting.Loader

Description

This module provides routines to load syntax definitions from disk files.

Synopsis

- loadSyntaxFromFile :: FilePath -> IO (Either String Syntax)
- loadSyntaxesFromDir :: FilePath -> IO (Either String SyntaxMap)
- loadValidSyntaxesFromDir :: FilePath -> IO (LoadErrMap, SyntaxMap)

# Documentation

loadSyntaxFromFile :: FilePath -> IO (Either String Syntax) #

Loads a syntax definition from the specified file path. The file path must refer to a file containing an XML Kate syntax definition.

loadSyntaxesFromDir :: FilePath -> IO (Either String SyntaxMap) #

Loads all syntax definitions from the specified directory by looking for files with an ".xml" extension. This function assumes such files are Kate XML syntax definitions, so XML files with unexpected contents will cause a parsing error returned as a `Left` and syntax parsing will be aborted.

loadValidSyntaxesFromDir :: FilePath -> IO (LoadErrMap, SyntaxMap) #

Loads all valid syntax definitions from the specified directory by looking for files with an ".xml" extension. Any files that are not valid Kate XML syntax definitions will have an entry in the resulting error map; the returned SyntaxMap will be made up of only the files that could successfully be loaded and parsed.