mirror of https://github.com/zachjs/sv2v.git
fix multiple instantiations on one line
This commit is contained in:
parent
b5b9fdb37e
commit
bddb8ceaff
|
|
@ -124,7 +124,7 @@ parseDTsAsModuleItems tokens =
|
||||||
-- internal; parser for module instantiations
|
-- internal; parser for module instantiations
|
||||||
parseDTsAsIntantiations :: [DeclToken] -> [ModuleItem]
|
parseDTsAsIntantiations :: [DeclToken] -> [ModuleItem]
|
||||||
parseDTsAsIntantiations (DTIdent name : tokens) =
|
parseDTsAsIntantiations (DTIdent name : tokens) =
|
||||||
if not (all isInstance rest)
|
if not (all isInstanceOrComma rest)
|
||||||
then error $ "instantiations mixed with other items: " ++ (show rest)
|
then error $ "instantiations mixed with other items: " ++ (show rest)
|
||||||
else map (uncurry $ Instance name params) instances
|
else map (uncurry $ Instance name params) instances
|
||||||
where
|
where
|
||||||
|
|
@ -132,10 +132,13 @@ parseDTsAsIntantiations (DTIdent name : tokens) =
|
||||||
case head tokens of
|
case head tokens of
|
||||||
DTParams ps -> (ps, tail tokens)
|
DTParams ps -> (ps, tail tokens)
|
||||||
_ -> ([], tokens)
|
_ -> ([], tokens)
|
||||||
instances = map (\(DTInstance inst) -> inst) rest
|
instances =
|
||||||
isInstance :: DeclToken -> Bool
|
map (\(DTInstance inst) -> inst) $
|
||||||
isInstance (DTInstance _) = True
|
filter (DTComma /=) $ rest
|
||||||
isInstance _ = False
|
isInstanceOrComma :: DeclToken -> Bool
|
||||||
|
isInstanceOrComma (DTInstance _) = True
|
||||||
|
isInstanceOrComma DTComma = True
|
||||||
|
isInstanceOrComma _ = False
|
||||||
parseDTsAsIntantiations tokens =
|
parseDTsAsIntantiations tokens =
|
||||||
error $
|
error $
|
||||||
"DeclTokens contain instantiations, but start with non-ident: "
|
"DeclTokens contain instantiations, but start with non-ident: "
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue