From d9a46fe86a6eeea9baf4aee85f081212417daa9c Mon Sep 17 00:00:00 2001 From: Garrit Franke Date: Thu, 3 Dec 2020 23:18:36 +0100 Subject: [PATCH] Fix tests and comments --- examples/hello_world.fx | 2 ++ src/lexer/tests.rs | 2 +- src/parser/mod.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/hello_world.fx b/examples/hello_world.fx index ea4b419..21fbd38 100644 --- a/examples/hello_world.fx +++ b/examples/hello_world.fx @@ -1,3 +1,5 @@ +// This is a comment + fn main() { return 1; diff --git a/src/lexer/tests.rs b/src/lexer/tests.rs index 8672026..22fc8b3 100644 --- a/src/lexer/tests.rs +++ b/src/lexer/tests.rs @@ -141,7 +141,7 @@ mod tests { Token { len: 6, kind: TokenKind::Comment, - raw: "-- foo".to_owned(), + raw: "// foo".to_owned(), } ); diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 7fbde6e..87fd5d4 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -16,7 +16,7 @@ impl Parser { // FIXME: Fiter without collecting? let tokens_without_whitespace: Vec = tokens .into_iter() - .filter(|token| token.kind != TokenKind::Whitespace) + .filter(|token| token.kind != TokenKind::Whitespace && token.kind != TokenKind::Comment) .collect(); Parser { tokens: tokens_without_whitespace.into_iter().peekable(),