Skip to content

Commit

Permalink
Fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
anka-213 committed Oct 18, 2021
1 parent ca89521 commit e27c3fb
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions mengwong/mp/src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -437,21 +437,21 @@ data RuleBody = RuleBody { rbaction :: ActionType -- pay(to=Seller, amount=$10
permutations :: [MyToken] -> Parser RuleBody
permutations whos = do
toreturn <- permute ( RuleBody
<$$> pAction
<||> many (preambleBoolRules whos) <* dnl -- WHO xxx, IF yyy
<||> pDeontic
<$$> pAction
<||> many (preambleBoolRules whos) -- WHO xxx, IF yyy
<||> pDeontic <* dnl
<|?> (Nothing , Just <$> pTemporal )
)
myTraceM $ "permutations: about to return"
myTraceM $ show toreturn
return toreturn

newPre :: Text.Text -> AA.Item Text.Text -> AA.Item Text.Text
newPre t (AA.Leaf x) = AA.Leaf x
newPre t (AA.All (AA.Pre p) x) = AA.All (AA.Pre t ) x
newPre t (AA.All (AA.PrePost p pp) x) = AA.All (AA.PrePost t pp) x
newPre t (AA.Any (AA.Pre p) x) = AA.Any (AA.Pre t ) x
newPre t (AA.Any (AA.PrePost p pp) x) = AA.Any (AA.PrePost t pp) x
newPre _ (AA.Leaf x) = AA.Leaf x
newPre t (AA.All (AA.Pre _p) x) = AA.All (AA.Pre t ) x
newPre t (AA.All (AA.PrePost _p pp) x) = AA.All (AA.PrePost t pp) x
newPre t (AA.Any (AA.Pre _p) x) = AA.Any (AA.Pre t ) x
newPre t (AA.Any (AA.PrePost _p pp) x) = AA.Any (AA.PrePost t pp) x

preambleBoolRules :: [MyToken] -> Parser (Preamble, BoolRules)
preambleBoolRules whos = do
Expand All @@ -460,7 +460,9 @@ preambleBoolRules whos = do
checkDepth
depth <- asks callDepth
myTraceM ("preambleBoolRules: passed guard! depth is " ++ show depth)
condWord <- choice (pToken <$> whos)
myTraceM $ "preambleBoolRules: Expecting one of: " ++ show whos
debugPrint "preambleBoolRules"
condWord <- choice (try . pToken <$> whos)
myTraceM ("preambleBoolRules: found condWord: " ++ show condWord)
(ands,rs) <- withDepth leftX dBoolRules -- (foo AND (bar OR baz), [constitutive and regulative sub-rules])
-- let bs = if subForest ands) == 1 -- upgrade the single OR child of the AND group to the top level
Expand Down

0 comments on commit e27c3fb

Please sign in to comment.