summaryrefslogtreecommitdiff
path: root/crates/parser/src/lib.rs
diff options
context:
space:
mode:
authorHenry <mail@henrygressmann.de>2026-05-02 21:14:02 +0200
committerHenry <mail@henrygressmann.de>2026-05-02 21:19:54 +0200
commitba1cf56464f8e5c3c7bcc2dc75f10aad2cd56e6b (patch)
treedd0bef203b31c494f48e72c1169f2f50ae7b6d21 /crates/parser/src/lib.rs
parentd3c6b705a3b1035adda66a92131e9ddf59fb46ab (diff)
chore: add more tests, fix issues with import types, cleanup doom example
Signed-off-by: Henry <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/lib.rs')
-rw-r--r--crates/parser/src/lib.rs20
1 files changed, 19 insertions, 1 deletions
diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs
index c4f6ff7..c6ae326 100644
--- a/crates/parser/src/lib.rs
+++ b/crates/parser/src/lib.rs
@@ -283,7 +283,25 @@ impl Parser {
continue;
}
- if eof || reader.end_reached {
+ if reader.end_reached {
+ if !buffer.is_empty() {
+ return Err(ParseError::Other("trailing bytes after end of module".into()));
+ }
+
+ if !eof {
+ let read_bytes = Self::read_more(&mut stream, &mut buffer, 1)?;
+ eof = read_bytes == 0;
+
+ if !eof {
+ return Err(ParseError::Other("trailing bytes after end of module".into()));
+ }
+ }
+
+ reader.process_pending_functions(&self.options)?;
+ return reader.into_module(&self.options);
+ }
+
+ if eof {
reader.process_pending_functions(&self.options)?;
return reader.into_module(&self.options);
}