never executed always true always false
1 module HelVM.HelMA.Automata.Zot.Automaton (
2 evalParams,
3 evalWithFormat,
4 ) where
5
6 import HelVM.HelMA.Automata.Zot.Evaluator
7 import HelVM.HelMA.Automata.Zot.Expression
8 import HelVM.HelMA.Automata.Zot.Parser
9
10 import HelVM.HelMA.Automaton.API.EvalParams
11 import HelVM.HelMA.Automaton.API.IOTypes
12
13 import HelVM.HelMA.Automaton.IO.BusinessIO
14
15 import HelVM.HelMA.Automaton.Types.FormatType
16
17 import HelVM.HelIO.Containers.Extra
18 import HelVM.HelIO.Control.Safe
19
20 import HelVM.HelIO.Digit.Digitable
21 import HelVM.HelIO.Digit.ToDigit
22
23 import HelVM.HelIO.ListLikeExtra
24
25 import Control.Monad.Writer.Lazy
26
27 import qualified Data.Text.Lazy as LT
28
29 evalParams :: BIO m => EvalParams -> m ()
30 evalParams p = wPutStr =<< evalWithFormat (formatType p) (source p) =<< wGetContentsText
31
32 evalWithFormat :: MonadSafe m => FormatType -> Source -> LT.Text -> m Output
33 evalWithFormat BinaryLabel source input = pure $ showFoldable $ evalInternal source input
34 evalWithFormat TextLabel source input = (makeAsciiText28 . convert . evalInternal source) . showExpressionList =<< stringToDL (toString input)
35
36 evalInternal :: Source -> LT.Text -> ExpressionDList
37 evalInternal source input = eval $ fromStrict source <> input
38
39 eval :: LT.Text -> ExpressionDList
40 eval = execWriter . runExpressionList . parse