From 0a3ade868b783912b80af6238bfe6f055c68228e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sat, 2 Sep 2023 15:42:38 +0200 Subject: [PATCH] fix: parse entity and architecture only at beginning The file parser treated entity and architecture keywords at beginning and end of architecture equally, and expected an identifier afterwards. This identifier is not required. The change made the parser always go past the end of the entity or architecture declaration. --- src/file_parser.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/file_parser.rs b/src/file_parser.rs index b6ba062..f1f8d78 100644 --- a/src/file_parser.rs +++ b/src/file_parser.rs @@ -155,6 +155,9 @@ impl FileParser { } } + stream.skip_until(|k| k == Kind::Architecture)?; + stream.skip_until(|k| k == Kind::SemiColon)?; + let architecture = ParsedArchitecture { name: architecture_name, entity_name, @@ -205,6 +208,10 @@ impl FileParser { stream.expect_kind(Kind::Entity)?; let name = Self::parse_identifier(stream)?; + + stream.skip_until(|k| k == Kind::Entity)?; + stream.skip_until(|k| k == Kind::SemiColon)?; + Ok(ParsedEntity { name, architecture: None, -- 2.48.1