diff --git a/schala-lang/src/parsing.rs b/schala-lang/src/parsing.rs index 68a0a81..ef50460 100644 --- a/schala-lang/src/parsing.rs +++ b/schala-lang/src/parsing.rs @@ -169,6 +169,8 @@ pub enum Statement { Declaration(Declaration), } +type Block = Vec; + type ParamName = Rc; type InterfaceName = Rc; //should be a singleton I think?? type FormalParam = (ParamName, Option); @@ -176,7 +178,7 @@ type FormalParam = (ParamName, Option); #[derive(Debug, PartialEq, Clone)] pub enum Declaration { FuncSig(Signature), - FuncDecl(Signature, Vec), + FuncDecl(Signature, Block), TypeDecl(TypeSingletonName, TypeBody), //should have TypeSingletonName in it TypeAlias(Rc, Rc), //should have TypeSingletonName in it, or maybe just String, not sure Binding { @@ -249,12 +251,12 @@ pub enum ExpressionType { indexee: Box, indexers: Vec, }, - IfExpression(Box, Vec, Option>), + IfExpression(Box, Block, Option), MatchExpression(Box, Vec), ForExpression, Lambda { params: Vec, - body: Vec, + body: Block, }, ListLiteral(Vec), } @@ -702,7 +704,7 @@ impl Parser { Ok(Expression(ExpressionType::IfExpression(bx!(condition), then_clause, else_clause), None)) }); - parse_method!(else_clause(&mut self) -> ParseResult>> { + parse_method!(else_clause(&mut self) -> ParseResult> { Ok(if let Keyword(Kw::Else) = self.peek() { self.next(); Some(self.block()?) @@ -711,7 +713,7 @@ impl Parser { }) }); - parse_method!(block(&mut self) -> ParseResult> { + parse_method!(block(&mut self) -> ParseResult { Ok(delimited!(self, LCurlyBrace, '{', statement, Newline | Semicolon, RCurlyBrace, '}', nonstrict)) });