sutori-0.2.4: Sutori language compiler

Safe HaskellSafe
LanguageHaskell2010

Sutori.Monad

Description

 

Synopsis

Documentation

type SutMonad a = ReaderT Options (StateT SutState (WriterT SutLogger (Except (SutError, SutLog)))) a Source #

The Sutori monad. Composes state, logging and exception handling

data SutState Source #

Monadic Lexer/Parser current state.

Constructors

SutState

Current error code, if any

Fields

runSutMonad :: SutMonad a -> Options -> SutState -> Except (SutError, SutLog) ((a, SutState), SutLogger) Source #

Run the monad with a given action

parserCurrentScope :: SutState -> Scope Source #

Get the current open scope

setErrorCode :: SutError -> SutMonad () Source #

Set the current error code for the compilation

initialSutoriState :: SutState Source #

Initial state of a Sutori parsescanrun

insertScope :: SutMonad () Source #

Inserts a new scope into the parse

  • Inserts the scope into the open scopes set.
  • Pushes the scope into the open scopes stack.
  • Saves the current offset to return to it once the scope is closed.

removeScope :: SutMonad () Source #

Removes last scope from the parse

  • Pops closing scope from stack of open scopes.
  • Removes closing scope from set of open scopes.
  • Recovers previous offset to write new data over just-closed scope

whenVerbose :: SutMonad () -> SutMonad () Source #

Run a monadic action only if verbose if turned on