Commit fc9999ae by Zachary Snow

support implied port directions

parent 4b3b09d2
......@@ -105,10 +105,22 @@ parseDTsAsPortDecls pieces =
length pieces == length commaIdxs + length identIdxs
simpleIdents = map extractIdent $ filter isIdent pieces
declarations = parseDTsAsDecls pieces
declarations = propagateDirections Input $ parseDTsAsDecls pieces
extractIdent = \(DTIdent _ x) -> x
propagateDirections :: Direction -> [Decl] -> [Decl]
propagateDirections dir (decl @ (Variable _ InterfaceT{} _ _ _) : decls) =
decl : propagateDirections dir decls
propagateDirections lastDir (Variable currDir t x a me : decls) =
decl : propagateDirections dir decls
where
decl = Variable dir t x a me
dir = if currDir == Local then lastDir else currDir
propagateDirections dir (decl : decls) =
decl : propagateDirections dir decls
propagateDirections _ [] = []
portNames :: [Decl] -> [Identifier]
portNames items = mapMaybe portName items
portName :: Decl -> Maybe Identifier
......
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