From e618498881e91f1053273726d986d895ef46499e Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Thu, 11 Nov 2021 23:44:26 -0800 Subject: [PATCH] Modules --- schala-lang/language/src/parsing/new.rs | 4 +++- schala-lang/language/src/parsing/test.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/schala-lang/language/src/parsing/new.rs b/schala-lang/language/src/parsing/new.rs index ca10053..9cd32cf 100644 --- a/schala-lang/language/src/parsing/new.rs +++ b/schala-lang/language/src/parsing/new.rs @@ -37,8 +37,10 @@ peg::parser! { __ expr:expression() { StatementKind::Expression(expr) } rule declaration() -> Declaration = - binding() / type_decl() / annotation() / func() / interface() / implementation() + binding() / type_decl() / annotation() / func() / interface() / implementation() / module() + rule module() -> Declaration = + "module" _ name:identifier() _ items:block() { Declaration::Module { name: rc_string(name), items } } rule implementation() -> Declaration = "impl" _ interface:type_singleton_name() _ "for" _ type_name:type_identifier() _ block:decl_block() { diff --git a/schala-lang/language/src/parsing/test.rs b/schala-lang/language/src/parsing/test.rs index 5496f87..b25e511 100644 --- a/schala-lang/language/src/parsing/test.rs +++ b/schala-lang/language/src/parsing/test.rs @@ -1026,7 +1026,7 @@ fn annotations() { #[test] fn modules() { - assert_ast! { + assert_ast2! { r#" module ephraim { let mut a = 10