| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hpp
Description
Front-end interface to the pre-processor.
Synopsis
- preprocess :: Monad m => [ByteString] -> HppT m ()
- runHpp :: MonadIO m => HppState -> HppT m a -> ExceptT Error m (HppOutput, HppState)
- streamHpp :: MonadIO m => HppState -> ([ByteString] -> m ()) -> HppT m a -> ExceptT Error m ([FilePath], HppState)
- expand :: HppState -> HppT (State ([ByteString] -> [ByteString])) a -> Except Error (HppOutput, HppState)
- data HppState
- emptyHppState :: HppState
- initHppState :: Config -> Env -> HppState
- parseDefinition :: ByteString -> ByteString -> Maybe (ByteString, Macro)
- addDefinition :: ByteString -> ByteString -> HppState -> Maybe HppState
- data HppT m a
- data HppOutput = HppOutput {
- hppFilesRead :: [FilePath]
- hppOutput :: [ByteString]
Running the Preprocessor
preprocess :: Monad m => [ByteString] -> HppT m () Source #
Preprocess lines of input.
runHpp :: MonadIO m => HppState -> HppT m a -> ExceptT Error m (HppOutput, HppState) Source #
Run a preprocessor action with some initial state. Returns the result of preprocessing as well as an updated preprocessor state representation.
streamHpp :: MonadIO m => HppState -> ([ByteString] -> m ()) -> HppT m a -> ExceptT Error m ([FilePath], HppState) Source #
streamHpp state sink action runs a preprocessor action with
some initial state. Output is streamed to the caller-provided
output sink as it is generated. The list of files read during
preprocessing is returned along with an updated preprocessor state
representation.
expand :: HppState -> HppT (State ([ByteString] -> [ByteString])) a -> Except Error (HppOutput, HppState) Source #
Like runHpp, but does not access the filesystem. Run a
preprocessor action with some initial state. Returns the result of
preprocessing as well as an updated preprocessor state
representation. Since this operation performs no IO, #include
directives are ignored in terms of the generated output lines, but
the files named in those directive are available in the HppOutput
value returned.
Preprocessor State
Dynamic state of the preprocessor engine.
Adding Definitions
parseDefinition :: ByteString -> ByteString -> Maybe (ByteString, Macro) Source #
Lower level parsing of macro definitions. Will typically be used
with insertPair for manual construction of a Env binding
environment.
addDefinition :: ByteString -> ByteString -> HppState -> Maybe HppState Source #
addDefinition name expression adds a binding of name to
expression in the preprocessor’s internal state.
Core Types
The type of preprocessor actions. Created with preprocess and
executed with runHpp or streamHpp.
The result of running hpp
Constructors
| HppOutput | |
Fields
| |