Browse Source

Fix tests and comments

github-actions
Garrit Franke 3 years ago
parent
commit
d9a46fe86a
  1. 2
      examples/hello_world.fx
  2. 2
      src/lexer/tests.rs
  3. 2
      src/parser/mod.rs

2
examples/hello_world.fx

@ -1,3 +1,5 @@
// This is a comment
fn main() { fn main() {
return 1; return 1;

2
src/lexer/tests.rs

@ -141,7 +141,7 @@ mod tests {
Token { Token {
len: 6, len: 6,
kind: TokenKind::Comment, kind: TokenKind::Comment,
raw: "-- foo".to_owned(), raw: "// foo".to_owned(),
} }
); );

2
src/parser/mod.rs

@ -16,7 +16,7 @@ impl Parser {
// FIXME: Fiter without collecting? // FIXME: Fiter without collecting?
let tokens_without_whitespace: Vec<Token> = tokens let tokens_without_whitespace: Vec<Token> = tokens
.into_iter() .into_iter()
.filter(|token| token.kind != TokenKind::Whitespace) .filter(|token| token.kind != TokenKind::Whitespace && token.kind != TokenKind::Comment)
.collect(); .collect();
Parser { Parser {
tokens: tokens_without_whitespace.into_iter().peekable(), tokens: tokens_without_whitespace.into_iter().peekable(),

Loading…
Cancel
Save