Fix too-shallow descs for "siblings"

pull/5/head
Lennart Spitzner 2018-12-02 14:08:09 +01:00
parent 6e70709e67
commit 593d903a53
1 changed files with 17 additions and 14 deletions

View File

@ -732,11 +732,9 @@ runCmdParserAExt mTopLevel inputInitial cmdParser =
Just $ (Just name, child, act, vis, InputArgs strr)
(Nothing, _) -> Just $ (Nothing, child, act, vis, input)
_ -> Nothing
case mRest of
Nothing -> do -- a child not matching what we have in the input
combined_child_list `forM_` \(child_name, (vis, child, _)) -> do
let initialDesc :: CommandDesc out = emptyCommandDesc
-- get the shallow desc for the child in a separate env.
combined_child_list `forM_` \(child_name, (vis, child, _)) -> do
let (subCmd, subStack) =
runIdentity
$ MultiRWSS.runMultiRWSTNil
@ -747,13 +745,18 @@ runCmdParserAExt mTopLevel inputInitial cmdParser =
( child_name
, postProcessCmd subStack subCmd { _cmd_visibility = vis }
)
case mRest of
Nothing -> do -- a child not matching what we have in the input
-- get the shallow desc for the child in a separate env.
-- proceed regularly on the same layer
processMain $ restCmdParser
Just (name, vis, child, act, rest) -> do -- matching child -> descend
-- process all remaining stuff on the same layer shallowly,
-- including the current node. This will be replaced later.
-- including the current node. This will walk over the child
-- definition(s) again, but that is harmless because we do not
-- overwrite them.
iterM processCmdShallow f
-- so the descend
-- do the descend
cmd <- do
c :: CommandDesc out <- mGet
prevStack :: CmdDescStack <- mGet