From 0a02c21e70e72a41d1b4a89ca96bd804ea6215b3 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 24 Jun 2018 02:15:08 -0700 Subject: [PATCH] Some more Patterns work -at first brush, a pattern is like a single Variant with a list of free vars --- schala-lang/src/ast.rs | 3 ++- schala-lang/src/parsing.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/schala-lang/src/ast.rs b/schala-lang/src/ast.rs index b1e728a..e04d7fb 100644 --- a/schala-lang/src/ast.rs +++ b/schala-lang/src/ast.rs @@ -132,7 +132,8 @@ pub struct Guard { #[derive(Debug, PartialEq, Clone)] pub struct Pattern { - + pub free_vars: Vec>, + pub var: Variant, } #[derive(Debug, PartialEq, Clone)] diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index 429cc42..4972016 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -678,7 +678,10 @@ impl Parser { parse_method!(pattern(&mut self) -> ParseResult { let identifier = self.identifier()?; - Ok(Pattern { }) + Ok(Pattern { + free_vars: vec![], + var: Variant::UnitStruct(identifier) + }) }); parse_method!(block(&mut self) -> ParseResult {