Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ginger parser.
- parseGinger :: forall m. Monad m => IncludeResolver m -> Maybe SourceName -> Source -> m (Either ParserError (Template SourcePos))
- parseGingerFile :: forall m. Monad m => IncludeResolver m -> SourceName -> m (Either ParserError (Template SourcePos))
- parseGinger' :: Monad m => ParserOptions m -> Source -> m (Either ParserError (Template SourcePos))
- parseGingerFile' :: Monad m => ParserOptions m -> SourceName -> m (Either ParserError (Template SourcePos))
- data ParserError = ParserError {}
- data ParserOptions m = ParserOptions {}
- mkParserOptions :: Monad m => IncludeResolver m -> ParserOptions m
- formatParserError :: Maybe String -> ParserError -> String
- type IncludeResolver m = SourceName -> m (Maybe Source)
- type Source = String
- type SourceName = String
- data SourcePos :: *
- sourceLine :: SourcePos -> Line
- sourceColumn :: SourcePos -> Column
- sourceName :: SourcePos -> SourceName
Documentation
parseGinger :: forall m. Monad m => IncludeResolver m -> Maybe SourceName -> Source -> m (Either ParserError (Template SourcePos)) Source #
Parse Ginger source from memory.
parseGingerFile :: forall m. Monad m => IncludeResolver m -> SourceName -> m (Either ParserError (Template SourcePos)) Source #
Parse Ginger source from a file.
parseGinger' :: Monad m => ParserOptions m -> Source -> m (Either ParserError (Template SourcePos)) Source #
Parse Ginger source from memory.
parseGingerFile' :: Monad m => ParserOptions m -> SourceName -> m (Either ParserError (Template SourcePos)) Source #
Parse Ginger source from a file.
data ParserError Source #
Error information for Ginger parser errors.
ParserError | |
|
data ParserOptions m Source #
mkParserOptions :: Monad m => IncludeResolver m -> ParserOptions m Source #
formatParserError :: Maybe String -> ParserError -> String Source #
type IncludeResolver m = SourceName -> m (Maybe Source) Source #
Used to resolve includes. Ginger will call this function whenever it
encounters an {% include %}, {% import %}, or {% extends %} directive.
If the required source code is not available, the resolver should return
Nothing
, else Just
the source.
type SourceName = String #
sourceLine :: SourcePos -> Line #
Extracts the line number from a source position.
sourceColumn :: SourcePos -> Column #
Extracts the column number from a source position.
sourceName :: SourcePos -> SourceName #
Extracts the name of the source from a source position.