From 8fe7c85b00a2cdf326fbf8264db5a203d0307d65 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Sep 2017 06:22:19 -0700 Subject: [PATCH] return keyword + idea for how to use it in for --- src/schala_lang/parsing.rs | 2 ++ test.schala | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/schala_lang/parsing.rs b/src/schala_lang/parsing.rs index de69a49..50304ab 100644 --- a/src/schala_lang/parsing.rs +++ b/src/schala_lang/parsing.rs @@ -38,6 +38,7 @@ pub enum Kw { For, Match, Var, Const, Let, In, + Return, Alias, Type, SelfType, SelfIdent, Trait, Impl, True, False @@ -56,6 +57,7 @@ lazy_static! { "const" => Kw::Const, "let" => Kw::Let, "in" => Kw::In, + "return" => Kw::Return, "alias" => Kw::Alias, "type" => Kw::Type, "Self" => Kw::SelfType, diff --git a/test.schala b/test.schala index 72a2283..d223eff 100644 --- a/test.schala +++ b/test.schala @@ -42,17 +42,20 @@ fn main() { #iteration over a variable for i <- [1..1000] { - } + } #return type is return type of block #while loop for a != 3 || fuckTard() { break - } + } #return type is return type of block #monadic decomposition - for a <- maybeInt(); s <- foo() { + for { + a <- maybeInt(); + s <- foo() + } return { a + s - } + } #return type is Monad # let statements too!! for (a = 20