mirror of
https://github.com/zachjs/sv2v.git
synced 2026-09-04 08:45:29 +02:00
improve stmt representation
This commit is contained in:
@@ -22,9 +22,9 @@ convertStmt :: Stmt -> Stmt
|
||||
convertStmt (Foreach x idxs stmt) =
|
||||
(foldl (.) id $ map toLoop $ zip [1..] idxs) stmt
|
||||
where
|
||||
toLoop :: (Int, Maybe Identifier) -> (Stmt -> Stmt)
|
||||
toLoop (_, Nothing) = id
|
||||
toLoop (d, Just i) =
|
||||
toLoop :: (Int, Identifier) -> (Stmt -> Stmt)
|
||||
toLoop (_, "") = id
|
||||
toLoop (d, i) =
|
||||
For (Left [idxDecl]) cmp [incr]
|
||||
where
|
||||
queryFn f = DimFn f (Right $ Ident x) (Number $ show d)
|
||||
|
||||
@@ -255,14 +255,10 @@ traverseSinglyNestedStmtsM fullMapper = cs
|
||||
traverseAssertionStmtsM :: Monad m => MapperM m Stmt -> MapperM m Assertion
|
||||
traverseAssertionStmtsM mapper = assertionMapper
|
||||
where
|
||||
actionBlockMapper (ActionBlockIf stmt) =
|
||||
mapper stmt >>= return . ActionBlockIf
|
||||
actionBlockMapper (ActionBlockElse Nothing stmt) =
|
||||
mapper stmt >>= return . ActionBlockElse Nothing
|
||||
actionBlockMapper (ActionBlockElse (Just s1) s2) = do
|
||||
actionBlockMapper (ActionBlock s1 s2) = do
|
||||
s1' <- mapper s1
|
||||
s2' <- mapper s2
|
||||
return $ ActionBlockElse (Just s1') s2'
|
||||
return $ ActionBlock s1' s2'
|
||||
assertionMapper (Assert e ab) =
|
||||
actionBlockMapper ab >>= return . Assert e
|
||||
assertionMapper (Assume e ab) =
|
||||
|
||||
Reference in New Issue
Block a user