From 53112c9f9dca5fd84d3b556c1e61b270f8fe1c70 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 30 Oct 2021 17:32:17 -0700 Subject: [PATCH] Fix parser bug --- schala-lang/language/src/parsing/mod.rs | 4 ++++ schala-lang/language/src/symbol_table/test.rs | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/schala-lang/language/src/parsing/mod.rs b/schala-lang/language/src/parsing/mod.rs index a5b9b50..d60387b 100644 --- a/schala-lang/language/src/parsing/mod.rs +++ b/schala-lang/language/src/parsing/mod.rs @@ -324,6 +324,9 @@ macro_rules! delimited { let peek = $self.token_handler.peek(); match peek.get_kind() { $end | EOF => break, + Newline | Semicolon => { + $self.token_handler.next(); continue; + }, _ => (), } if !$strictness { @@ -456,6 +459,7 @@ impl Parser { VariantKind::TupleStruct(tuple_members) }, LCurlyBrace => { + println!("ARAH"); let typed_identifier_list = delimited!(self, LCurlyBrace, typed_identifier, Comma, RCurlyBrace); VariantKind::Record(typed_identifier_list) }, diff --git a/schala-lang/language/src/symbol_table/test.rs b/schala-lang/language/src/symbol_table/test.rs index 3f2c195..eaa667d 100644 --- a/schala-lang/language/src/symbol_table/test.rs +++ b/schala-lang/language/src/symbol_table/test.rs @@ -248,8 +248,6 @@ fn duplicate_modules() { #[test] fn duplicate_struct_members() { - //TODO this is a parser error - /* let source = r#" type Tarak = Tarak { loujet: i32, @@ -257,9 +255,6 @@ fn duplicate_struct_members() { mets: i32, } "#; - */ - - let source = r#" type Tarak = Tarak { loujet: i32, mets: i32, mets: i32 } "#; let (_, output) = add_symbols(source); let errs = output.unwrap_err();