Fix parser bug

This commit is contained in:
Greg Shuflin 2021-10-30 17:32:17 -07:00
parent e7308485df
commit 53112c9f9d
2 changed files with 4 additions and 5 deletions

View File

@ -324,6 +324,9 @@ macro_rules! delimited {
let peek = $self.token_handler.peek(); let peek = $self.token_handler.peek();
match peek.get_kind() { match peek.get_kind() {
$end | EOF => break, $end | EOF => break,
Newline | Semicolon => {
$self.token_handler.next(); continue;
},
_ => (), _ => (),
} }
if !$strictness { if !$strictness {
@ -456,6 +459,7 @@ impl Parser {
VariantKind::TupleStruct(tuple_members) VariantKind::TupleStruct(tuple_members)
}, },
LCurlyBrace => { LCurlyBrace => {
println!("ARAH");
let typed_identifier_list = delimited!(self, LCurlyBrace, typed_identifier, Comma, RCurlyBrace); let typed_identifier_list = delimited!(self, LCurlyBrace, typed_identifier, Comma, RCurlyBrace);
VariantKind::Record(typed_identifier_list) VariantKind::Record(typed_identifier_list)
}, },

View File

@ -248,8 +248,6 @@ fn duplicate_modules() {
#[test] #[test]
fn duplicate_struct_members() { fn duplicate_struct_members() {
//TODO this is a parser error
/*
let source = r#" let source = r#"
type Tarak = Tarak { type Tarak = Tarak {
loujet: i32, loujet: i32,
@ -257,9 +255,6 @@ fn duplicate_struct_members() {
mets: i32, mets: i32,
} }
"#; "#;
*/
let source = r#" type Tarak = Tarak { loujet: i32, mets: i32, mets: i32 } "#;
let (_, output) = add_symbols(source); let (_, output) = add_symbols(source);
let errs = output.unwrap_err(); let errs = output.unwrap_err();