svlog: fix infinite loop while parsing module
If the body of the loop that parses the items in a module hits the end
of file for some reason, e.g. because it tries to recover from an error,
the loop gets stuck in an infinite loop. Make the loop abort upon
hitting EOF.
@@ -544,7 +544,7 @@ fn parse_module_decl(p: &mut Parser) -> ReportedResult<ModDecl> {
}
// Eat the items in the module.
- while p.peek(0).0 != Keyword(Kw::Endmodule) {
+ while p.peek(0).0 != Keyword(Kw::Endmodule) && p.peek(0).0 != Eof {
match try_hierarchy_item(p) {
Some(Ok(())) => (),
Some(Err(())) => (),
