From 65c2cd521b6a5b1e317d4a229c3cfac8dccea9e1 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 11 Jul 2018 20:40:55 -0700 Subject: [PATCH] Mutable types This bit of syntax is meant for extendable enum types --- schala-lang/src/parsing.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index 658bf25..bdb3762 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -27,7 +27,7 @@ declaration := type_declaration | func_declaration | binding_declaration | impl_ /* Declarations - Types */ type_declaration := 'type' type_declaration_body -type_declaration_body := 'alias' type_alias | type_singleton_name '=' type_body +type_declaration_body := 'alias' type_alias | 'mut'? type_singleton_name '=' type_body type_alias := IDENTIFIER '=' type_name type_body := variant_specifier ('|' variant_specifier)* variant_specifier := IDENTIFIER | IDENTIFIER '{' typed_identifier_list '}' | IDENTIFIER '(' type_name* ')' @@ -316,6 +316,10 @@ impl Parser { if let Keyword(Alias) = self.peek() { self.type_alias() } else { + if let Keyword(Mut) = self.peek() { + self.next(); + //TODO make this part of the type + } let name = self.type_singleton_name()?; expect!(self, Operator(ref c) if **c == "="); let body = self.type_body()?;