From 83984ea719f1e613a6382c7e1052738ee94858de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 11 Jan 2021 03:16:55 +0100 Subject: newlines end expressions --- src/compiler.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compiler.rs b/src/compiler.rs index 80230d0..a096947 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -321,7 +321,6 @@ impl Compiler { self.eat(); self.expression(block); block.add(Op::Print, self.line()); - expect!(self, Token::Newline, "Expect newline after expression."); } else if let [ Token::Identifier(name), Token::Identifier(typ), @@ -335,7 +334,6 @@ impl Compiler { } else { error!(self, format!("Failed to parse type '{}'.", typ)); } - expect!(self, Token::Newline, "Expect newline after expression."); } else if let [ Token::Identifier(name), Token::ColonEqual @@ -343,12 +341,11 @@ impl Compiler { self.eat(); self.eat(); self.define_variable(&name, Type::UnkownType, block); - expect!(self, Token::Newline, "Expect newline after expression."); } else { self.expression(block); block.add(Op::Pop, self.line()); - expect!(self, Token::Newline, "Expect newline after expression."); } + expect!(self, Token::Newline, "Expect newline after expression."); } pub fn compile(&mut self, name: &str, file: &Path) -> Result> { -- cgit v1.2.1