Fix another duplicated desc bug

pull/8/head
Lennart Spitzner 2020-06-10 12:04:21 +02:00
parent c29ef0cce2
commit c23c53fe25
1 changed files with 7 additions and 4 deletions

View File

@ -1024,8 +1024,6 @@ runCmdParserAExt mTopLevel inputInitial cmdParser =
++ " with remaining input: " ++ " with remaining input: "
++ show input ++ show input
] ]
mSet $ StackBottom mempty
failureCurrentShallowRerun
processParsedParts $ nextF monadMisuseError processParsedParts $ nextF monadMisuseError
continueOrMisuse :: Maybe p -> m (CmdParser f out a) continueOrMisuse :: Maybe p -> m (CmdParser f out a)
continueOrMisuse = maybe monadMisuseError (processParsedParts . nextF) continueOrMisuse = maybe monadMisuseError (processParsedParts . nextF)
@ -1145,7 +1143,12 @@ runCmdParserAExt mTopLevel inputInitial cmdParser =
mModify (descStackAdd desc) mModify (descStackAdd desc)
nextF =<< iterM processCmdShallow alt nextF =<< iterM processCmdShallow alt
failureCurrentShallowRerun -- currently unused; was previously used during failure in
-- processParsedParts. Using this leads to duplicated descs, but I fear
-- that not using it also leads to certain problems (missing children?).
-- Probably want to re-write into proper two-phase 1) obtain desc 2) run
-- parser, like the applicative approach.
_failureCurrentShallowRerun
:: ( m ~ MultiRWSS.MultiRWST r w s m0 :: ( m ~ MultiRWSS.MultiRWST r w s m0
, MonadMultiState (CmdParser f out ()) m , MonadMultiState (CmdParser f out ()) m
, MonadMultiState (CommandDesc out) m , MonadMultiState (CommandDesc out) m
@ -1153,7 +1156,7 @@ runCmdParserAExt mTopLevel inputInitial cmdParser =
, Monad m0 , Monad m0
) )
=> m () => m ()
failureCurrentShallowRerun = do _failureCurrentShallowRerun = do
parser :: CmdParser f out () <- mGet parser :: CmdParser f out () <- mGet
cmd :: CommandDesc out <- cmd :: CommandDesc out <-
MultiRWSS.withMultiStateS emptyCommandDesc MultiRWSS.withMultiStateS emptyCommandDesc