diff --git a/src/main.cpp b/src/main.cpp index 80b6a9d..91e596a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,6 +59,10 @@ int main() { statements.push_back(std::move(statement.unwrap())); statement = parsing::parse_top_level_statement(stream); } + if (stream.peek().type != token::Type::Eof) { + std::cerr << statement.unwrap_err() << std::endl; + return 1; + } stream.expect(token::Type::Eof); diff --git a/test.c b/test.c index 07a988d..2e8bb87 100644 --- a/test.c +++ b/test.c @@ -1,3 +1,4 @@ int main() { + int a = 5; return 15; } \ No newline at end of file