From 3c79cd70f4d21042627eb5165037da94f79e955d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 11:21:17 -0300 Subject: [PATCH 01/16] Add union declaration --- crates/concrete_ast/src/enums.rs | 12 ++++++++++++ crates/concrete_ast/src/lib.rs | 1 + crates/concrete_ast/src/modules.rs | 2 ++ crates/concrete_ir/src/lowering.rs | 1 + crates/concrete_ir/src/lowering/prepass.rs | 2 ++ 5 files changed, 18 insertions(+) create mode 100644 crates/concrete_ast/src/enums.rs diff --git a/crates/concrete_ast/src/enums.rs b/crates/concrete_ast/src/enums.rs new file mode 100644 index 0000000..d49404c --- /dev/null +++ b/crates/concrete_ast/src/enums.rs @@ -0,0 +1,12 @@ +use crate::{ + common::{GenericParam, Ident, Span}, + structs::Field, +}; + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct UnionDecl { + pub name: Ident, + pub generics: Vec, + pub variants: Vec, + pub span: Span, +} diff --git a/crates/concrete_ast/src/lib.rs b/crates/concrete_ast/src/lib.rs index 6b7c36c..a767ea0 100644 --- a/crates/concrete_ast/src/lib.rs +++ b/crates/concrete_ast/src/lib.rs @@ -2,6 +2,7 @@ use modules::Module; pub mod common; pub mod constants; +pub mod enums; pub mod expressions; pub mod functions; pub mod imports; diff --git a/crates/concrete_ast/src/modules.rs b/crates/concrete_ast/src/modules.rs index 5ed22cf..eb5bef8 100644 --- a/crates/concrete_ast/src/modules.rs +++ b/crates/concrete_ast/src/modules.rs @@ -1,6 +1,7 @@ use crate::{ common::{DocString, Ident, Span}, constants::ConstantDef, + enums::UnionDecl, functions::FunctionDef, imports::ImportStmt, structs::StructDecl, @@ -21,6 +22,7 @@ pub enum ModuleDefItem { Constant(ConstantDef), Function(FunctionDef), Struct(StructDecl), + Union(UnionDecl), Type(TypeDecl), Module(Module), } diff --git a/crates/concrete_ir/src/lowering.rs b/crates/concrete_ir/src/lowering.rs index 5d28668..34707fe 100644 --- a/crates/concrete_ir/src/lowering.rs +++ b/crates/concrete_ir/src/lowering.rs @@ -122,6 +122,7 @@ fn lower_module(mut ctx: BuildCtx, module: &Module, id: DefId) -> Result { /* already processed */ } + ModuleDefItem::Union(_) => todo!(), } } diff --git a/crates/concrete_ir/src/lowering/prepass.rs b/crates/concrete_ir/src/lowering/prepass.rs index 51f9942..78f317c 100644 --- a/crates/concrete_ir/src/lowering/prepass.rs +++ b/crates/concrete_ir/src/lowering/prepass.rs @@ -95,6 +95,7 @@ pub fn prepass_module( .insert(info.name.name.clone(), next_id); current_module.modules.insert(next_id); } + ast::modules::ModuleDefItem::Union(_) => todo!(), } } @@ -195,6 +196,7 @@ pub fn prepass_sub_module( .insert(info.name.name.clone(), next_id); submodule.modules.insert(next_id); } + ast::modules::ModuleDefItem::Union(_) => todo!(), } } From 4b91e1154d689a37aa17d232dc1ae319e629f9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 11:33:01 -0300 Subject: [PATCH 02/16] Add KeywordUnion --- crates/concrete_parser/src/tokens.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/concrete_parser/src/tokens.rs b/crates/concrete_parser/src/tokens.rs index 1781db7..00fd41a 100644 --- a/crates/concrete_parser/src/tokens.rs +++ b/crates/concrete_parser/src/tokens.rs @@ -33,6 +33,8 @@ pub enum Token { KeywordReturn, #[token("struct")] KeywordStruct, + #[token("union")] + KeywordUnion, #[token("if")] KeywordIf, #[token("else")] From 2305724561d876498391874f65104ba3366c0592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 11:35:18 -0300 Subject: [PATCH 03/16] Add grammar definition for union --- crates/concrete_parser/src/grammar.lalrpop | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/concrete_parser/src/grammar.lalrpop b/crates/concrete_parser/src/grammar.lalrpop index 36a372b..807360a 100644 --- a/crates/concrete_parser/src/grammar.lalrpop +++ b/crates/concrete_parser/src/grammar.lalrpop @@ -18,6 +18,7 @@ extern { "fn" => Token::KeywordFn, "return" => Token::KeywordReturn, "struct" => Token::KeywordStruct, + "union" => Token::KeywordUnion, "if" => Token::KeywordIf, "else" => Token::KeywordElse, "while" => Token::KeywordWhile, @@ -238,6 +239,9 @@ pub(crate) ModuleDefItem: ast::modules::ModuleDefItem = { => { ast::modules::ModuleDefItem::Struct(<>) }, + => { + ast::modules::ModuleDefItem::Union(<>) + }, => { ast::modules::ModuleDefItem::Function(<>) }, @@ -312,6 +316,16 @@ pub(crate) StructDef: ast::structs::StructDecl = { } } + +pub(crate) UnionDef: ast::enums::UnionDecl = { + "union" "{" > "}" => ast::enums::UnionDecl { + name, + variants, + generics: generics.unwrap_or(vec![]), + span: Span::new(lo, hi), + } +} + pub(crate) StructInitField: (ast::common::Ident, ast::expressions::StructInitField) = { ":" => (name, ast::expressions::StructInitField { value, From 05eeedfff94fa7d706ba44d7918af0f0c91d59b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 12:49:20 -0300 Subject: [PATCH 04/16] Add union declaration test --- crates/concrete_parser/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index 2881a4a..73e0e17 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -150,6 +150,19 @@ mod ModuleName { fn parse_empty_fn() { let source = r##"mod MyMod { fn hello() {} +}"##; + let lexer = Lexer::new(source); + let parser = grammar::ProgramParser::new(); + parser.parse(lexer).unwrap(); + } + + #[test] + fn parse_union_declaration() { + let source = r##"mod MyMod { + union Foo { + bar: i32, + baz: i64, + } }"##; let lexer = Lexer::new(source); let parser = grammar::ProgramParser::new(); From 7bd87564a7156e9a643719705dcc835b2b016983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 13:01:28 -0300 Subject: [PATCH 05/16] Add enum declaration --- crates/concrete_ast/src/enums.rs | 14 ++++++++++++++ crates/concrete_ast/src/modules.rs | 3 ++- crates/concrete_ir/src/lowering.rs | 1 + crates/concrete_ir/src/lowering/prepass.rs | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/crates/concrete_ast/src/enums.rs b/crates/concrete_ast/src/enums.rs index d49404c..1b46604 100644 --- a/crates/concrete_ast/src/enums.rs +++ b/crates/concrete_ast/src/enums.rs @@ -10,3 +10,17 @@ pub struct UnionDecl { pub variants: Vec, pub span: Span, } + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct EnumDecl { + pub name: Ident, + pub generics: Vec, + pub variants: Vec, + pub span: Span, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct EnumVariant { + pub name: Ident, + pub span: Span, +} diff --git a/crates/concrete_ast/src/modules.rs b/crates/concrete_ast/src/modules.rs index eb5bef8..93c99af 100644 --- a/crates/concrete_ast/src/modules.rs +++ b/crates/concrete_ast/src/modules.rs @@ -1,7 +1,7 @@ use crate::{ common::{DocString, Ident, Span}, constants::ConstantDef, - enums::UnionDecl, + enums::{EnumDecl, UnionDecl}, functions::FunctionDef, imports::ImportStmt, structs::StructDecl, @@ -23,6 +23,7 @@ pub enum ModuleDefItem { Function(FunctionDef), Struct(StructDecl), Union(UnionDecl), + Enum(EnumDecl), Type(TypeDecl), Module(Module), } diff --git a/crates/concrete_ir/src/lowering.rs b/crates/concrete_ir/src/lowering.rs index 34707fe..5af11f7 100644 --- a/crates/concrete_ir/src/lowering.rs +++ b/crates/concrete_ir/src/lowering.rs @@ -123,6 +123,7 @@ fn lower_module(mut ctx: BuildCtx, module: &Module, id: DefId) -> Result { /* already processed */ } ModuleDefItem::Union(_) => todo!(), + ModuleDefItem::Enum(_) => todo!(), } } diff --git a/crates/concrete_ir/src/lowering/prepass.rs b/crates/concrete_ir/src/lowering/prepass.rs index 78f317c..c73df67 100644 --- a/crates/concrete_ir/src/lowering/prepass.rs +++ b/crates/concrete_ir/src/lowering/prepass.rs @@ -96,6 +96,7 @@ pub fn prepass_module( current_module.modules.insert(next_id); } ast::modules::ModuleDefItem::Union(_) => todo!(), + ast::modules::ModuleDefItem::Enum(_) => todo!(), } } @@ -197,6 +198,7 @@ pub fn prepass_sub_module( submodule.modules.insert(next_id); } ast::modules::ModuleDefItem::Union(_) => todo!(), + ast::modules::ModuleDefItem::Enum(_) => todo!(), } } From a988fdfe585ec83b3bba8fe52ce0e29c26307f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 13:03:47 -0300 Subject: [PATCH 06/16] Add enum token --- crates/concrete_parser/src/tokens.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/concrete_parser/src/tokens.rs b/crates/concrete_parser/src/tokens.rs index 00fd41a..f6288af 100644 --- a/crates/concrete_parser/src/tokens.rs +++ b/crates/concrete_parser/src/tokens.rs @@ -35,6 +35,8 @@ pub enum Token { KeywordStruct, #[token("union")] KeywordUnion, + #[token("enum")] + KeywordEnum, #[token("if")] KeywordIf, #[token("else")] From be4733fb5eb6048c28f24dc3d68fc2731930f4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 13:23:45 -0300 Subject: [PATCH 07/16] Add enum parsing --- crates/concrete_parser/src/grammar.lalrpop | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/concrete_parser/src/grammar.lalrpop b/crates/concrete_parser/src/grammar.lalrpop index 807360a..8dccae0 100644 --- a/crates/concrete_parser/src/grammar.lalrpop +++ b/crates/concrete_parser/src/grammar.lalrpop @@ -19,6 +19,7 @@ extern { "return" => Token::KeywordReturn, "struct" => Token::KeywordStruct, "union" => Token::KeywordUnion, + "enum" => Token::KeywordEnum, "if" => Token::KeywordIf, "else" => Token::KeywordElse, "while" => Token::KeywordWhile, @@ -242,6 +243,9 @@ pub(crate) ModuleDefItem: ast::modules::ModuleDefItem = { => { ast::modules::ModuleDefItem::Union(<>) }, + => { + ast::modules::ModuleDefItem::Enum(<>) + }, => { ast::modules::ModuleDefItem::Function(<>) }, @@ -326,6 +330,23 @@ pub(crate) UnionDef: ast::enums::UnionDecl = { } } +pub(crate) EnumDef: ast::enums::EnumDecl = { + "enum" "{" > "}" => ast::enums::EnumDecl { + name, + variants, + generics: generics.unwrap_or(vec![]), + span: Span::new(lo, hi), + } +} + + +pub(crate) EnumVariant: ast::enums::EnumVariant = { + => ast::enums::EnumVariant { + name, + span: Span::new(lo, hi), + } +} + pub(crate) StructInitField: (ast::common::Ident, ast::expressions::StructInitField) = { ":" => (name, ast::expressions::StructInitField { value, From daa01d57e075c1c55de8be2eac9e4493408afe32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 13:23:58 -0300 Subject: [PATCH 08/16] Add parse_enum test --- crates/concrete_parser/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index 73e0e17..91f5dcd 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -163,6 +163,19 @@ mod ModuleName { bar: i32, baz: i64, } +}"##; + let lexer = Lexer::new(source); + let parser = grammar::ProgramParser::new(); + parser.parse(lexer).unwrap(); + } + + #[test] + fn parse_enum() { + let source = r##"mod MyMod { + enum Foo { + Bar, + Baz, + } }"##; let lexer = Lexer::new(source); let parser = grammar::ProgramParser::new(); From 79e89592aad8b2e53b8e11b3d0798f2184129a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 13:24:01 -0300 Subject: [PATCH 09/16] Add enum example --- examples/enum.con | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 examples/enum.con diff --git a/examples/enum.con b/examples/enum.con new file mode 100644 index 0000000..6dbdac0 --- /dev/null +++ b/examples/enum.con @@ -0,0 +1,6 @@ +mod EnumExample { + enum Foo { + Bar, + Baz, + } +} From 82b4bfc03bb601604ee44bec718479b6ac3f321f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 14:38:08 -0300 Subject: [PATCH 10/16] Add enum instantiation to enum example --- examples/enum.con | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/enum.con b/examples/enum.con index 6dbdac0..68f6d74 100644 --- a/examples/enum.con +++ b/examples/enum.con @@ -3,4 +3,13 @@ mod EnumExample { Bar, Baz, } + + fn main() -> i32 { + let mut foo: Foo = Foo.Bar; + + match foo { + Foo.Bar -> return 1;, + Foo.Baz -> return 2;, + } + } } From e3d7058c482b484968d450fd522026a3e402a591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 14:42:37 -0300 Subject: [PATCH 11/16] Add instantiation to parse enum test --- crates/concrete_parser/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index 91f5dcd..cbaf122 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -176,6 +176,10 @@ mod ModuleName { Bar, Baz, } + + fn main() -> i32 { + let mut foo: Foo = Foo.Bar; + } }"##; let lexer = Lexer::new(source); let parser = grammar::ProgramParser::new(); From 82a8fbbd9d1097596bee48cb629f4b172c3f0386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 15:29:54 -0300 Subject: [PATCH 12/16] Add support for struct variants in enum --- crates/concrete_ast/src/enums.rs | 1 + crates/concrete_parser/src/grammar.lalrpop | 3 ++- crates/concrete_parser/src/lib.rs | 2 +- examples/enum.con | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/concrete_ast/src/enums.rs b/crates/concrete_ast/src/enums.rs index 1b46604..4c0cac1 100644 --- a/crates/concrete_ast/src/enums.rs +++ b/crates/concrete_ast/src/enums.rs @@ -22,5 +22,6 @@ pub struct EnumDecl { #[derive(Clone, Debug, Eq, PartialEq)] pub struct EnumVariant { pub name: Ident, + pub fields: Vec, pub span: Span, } diff --git a/crates/concrete_parser/src/grammar.lalrpop b/crates/concrete_parser/src/grammar.lalrpop index 8dccae0..708644e 100644 --- a/crates/concrete_parser/src/grammar.lalrpop +++ b/crates/concrete_parser/src/grammar.lalrpop @@ -341,8 +341,9 @@ pub(crate) EnumDef: ast::enums::EnumDecl = { pub(crate) EnumVariant: ast::enums::EnumVariant = { - => ast::enums::EnumVariant { + > "}")?> => ast::enums::EnumVariant { name, + fields: fields.unwrap_or_default(), span: Span::new(lo, hi), } } diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index cbaf122..7cbb5d4 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -174,7 +174,7 @@ mod ModuleName { let source = r##"mod MyMod { enum Foo { Bar, - Baz, + Baz { n1: i32, n2: i32 }, } fn main() -> i32 { diff --git a/examples/enum.con b/examples/enum.con index 68f6d74..ce1252d 100644 --- a/examples/enum.con +++ b/examples/enum.con @@ -1,7 +1,7 @@ mod EnumExample { enum Foo { Bar, - Baz, + Baz { n1: i32, n2: i32 }, } fn main() -> i32 { From e13cf087a1f3e43839db0dc8416a2340ec9dc4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 16:00:40 -0300 Subject: [PATCH 13/16] Add support for explicit discriminant --- crates/concrete_ast/src/enums.rs | 2 ++ crates/concrete_parser/src/grammar.lalrpop | 3 ++- crates/concrete_parser/src/lib.rs | 1 + examples/enum.con | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/concrete_ast/src/enums.rs b/crates/concrete_ast/src/enums.rs index 4c0cac1..a24e433 100644 --- a/crates/concrete_ast/src/enums.rs +++ b/crates/concrete_ast/src/enums.rs @@ -1,5 +1,6 @@ use crate::{ common::{GenericParam, Ident, Span}, + expressions::Expression, structs::Field, }; @@ -23,5 +24,6 @@ pub struct EnumDecl { pub struct EnumVariant { pub name: Ident, pub fields: Vec, + pub discriminant: Option, pub span: Span, } diff --git a/crates/concrete_parser/src/grammar.lalrpop b/crates/concrete_parser/src/grammar.lalrpop index 708644e..0872e6d 100644 --- a/crates/concrete_parser/src/grammar.lalrpop +++ b/crates/concrete_parser/src/grammar.lalrpop @@ -341,9 +341,10 @@ pub(crate) EnumDef: ast::enums::EnumDecl = { pub(crate) EnumVariant: ast::enums::EnumVariant = { - > "}")?> => ast::enums::EnumVariant { + > "}")?> )?> => ast::enums::EnumVariant { name, fields: fields.unwrap_or_default(), + discriminant, span: Span::new(lo, hi), } } diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index 7cbb5d4..accf1f9 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -175,6 +175,7 @@ mod ModuleName { enum Foo { Bar, Baz { n1: i32, n2: i32 }, + Qux = 3, } fn main() -> i32 { diff --git a/examples/enum.con b/examples/enum.con index ce1252d..1f3e187 100644 --- a/examples/enum.con +++ b/examples/enum.con @@ -2,6 +2,7 @@ mod EnumExample { enum Foo { Bar, Baz { n1: i32, n2: i32 }, + Qux = 3, } fn main() -> i32 { @@ -10,6 +11,7 @@ mod EnumExample { match foo { Foo.Bar -> return 1;, Foo.Baz -> return 2;, + Foo.Qux -> return 3;, } } } From 77ed4f02d9d9d35208454cc244b8fba01ea4552c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 16:27:47 -0300 Subject: [PATCH 14/16] Add union example --- examples/union.con | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 examples/union.con diff --git a/examples/union.con b/examples/union.con new file mode 100644 index 0000000..2c7d8f5 --- /dev/null +++ b/examples/union.con @@ -0,0 +1,13 @@ +mod UnionExample { + union Foo { + bar: i32, + baz: i64, + } + + fn main() -> i32 { + let mut foo: Foo = Foo { bar: 1 }; + + // unsafe! + let bar: i32 = foo.bar; + } +} From 041d8b57f1a9455dd8684ddfffb6b4c4d2661234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Wed, 10 Apr 2024 16:31:28 -0300 Subject: [PATCH 15/16] Add creation and indexing of union in tests --- crates/concrete_parser/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index accf1f9..377e7f2 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -163,6 +163,13 @@ mod ModuleName { bar: i32, baz: i64, } + + fn main() -> i32 { + let mut foo: Foo = Foo { bar: 1 }; + + // unsafe! + let bar: i32 = foo.bar; + } }"##; let lexer = Lexer::new(source); let parser = grammar::ProgramParser::new(); From d5b051470154eaf71f99220cb5c08db1b60f296e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Mon, 22 Apr 2024 10:42:57 -0300 Subject: [PATCH 16/16] Fix merge error --- crates/concrete_parser/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/concrete_parser/src/lib.rs b/crates/concrete_parser/src/lib.rs index 4ff3732..7b26a7b 100644 --- a/crates/concrete_parser/src/lib.rs +++ b/crates/concrete_parser/src/lib.rs @@ -169,12 +169,14 @@ mod ModuleName { // unsafe! let bar: i32 = foo.bar; + } }"##; let lexer = Lexer::new(source); let parser = grammar::ProgramParser::new(); parser.parse(lexer).unwrap(); } + #[test] fn parse_for() { let source = r##"mod MyMod { fn hello() { @@ -203,12 +205,14 @@ mod ModuleName { fn main() -> i32 { let mut foo: Foo = Foo.Bar; + } }"##; let lexer = Lexer::new(source); let parser = grammar::ProgramParser::new(); parser.parse(lexer).unwrap(); } + #[test] fn parse_for_while() { let source = r##"mod MyMod { fn hello() {