diff --git a/src/schala_lang/parsing.rs b/src/schala_lang/parsing.rs index 97b4b7b..a6dc304 100644 --- a/src/schala_lang/parsing.rs +++ b/src/schala_lang/parsing.rs @@ -435,8 +435,18 @@ pub enum Expression { indexers: Vec, }, IfExpression(Box, Vec, Option>), + MatchExpression(Box, Vec) } +#[derive(Debug, PartialEq)] +pub struct MatchArm { + pat: Pattern, + expr: Expression, +} + +#[derive(Debug, PartialEq)] +pub struct Pattern(String); + #[derive(Debug, PartialEq)] pub struct Operation(Rc); @@ -717,7 +727,11 @@ impl Parser { expect!(self, LCurlyBrace, "Expected '{'"); let body = self.match_body()?; expect!(self, RCurlyBrace, "Expected '}'"); - unimplementd!() + Ok(Expression::MatchExpression(Box::new(expr), body)) + }); + + parse_method!(match_body(&mut self) -> ParseResult> { + Ok(vec!()) }); parse_method!(identifier(&mut self) -> ParseResult> {