Commit ae2a6f14 authored by Stian Håklev's avatar Stian Håklev

Ignoring > in front of code lines

Removing dependence on regex, checking that all lines are prefixed by >
parent c324d1a1
...@@ -229,13 +229,23 @@ data EvalOut = EvalOut { ...@@ -229,13 +229,23 @@ data EvalOut = EvalOut {
evalComms :: [CommInfo] evalComms :: [CommInfo]
} }
cleanString :: String -> String
cleanString x = strip $ if allBrackets then clean else x
where
l = lines x
allBrackets = all (fAny [isInfixOf ">", null]) l
fAny fs x = any ($x) fs
clean = unlines $ map removeBracket l
removeBracket (x:xs) = xs
removeBracket [] = []
-- | Evaluate some IPython input code. -- | Evaluate some IPython input code.
evaluate :: KernelState -- ^ The kernel state. evaluate :: KernelState -- ^ The kernel state.
-> String -- ^ Haskell code or other interpreter commands. -> String -- ^ Haskell code or other interpreter commands.
-> (EvaluationResult -> IO ()) -- ^ Function used to publish data outputs. -> (EvaluationResult -> IO ()) -- ^ Function used to publish data outputs.
-> Interpreter KernelState -> Interpreter KernelState
evaluate kernelState code output = do evaluate kernelState code output = do
cmds <- parseString (strip code) cmds <- parseString (cleanString code)
let execCount = getExecutionCounter kernelState let execCount = getExecutionCounter kernelState
when (getLintStatus kernelState /= LintOff) $ liftIO $ do when (getLintStatus kernelState /= LintOff) $ liftIO $ do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment