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(),