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