diff --git a/src/schala_lang/parsing.rs b/src/schala_lang/parsing.rs index 36d52a1..2e55c30 100644 --- a/src/schala_lang/parsing.rs +++ b/src/schala_lang/parsing.rs @@ -375,9 +375,16 @@ pub enum Statement { Declaration(Declaration), } +type ParamName = Rc; +type TypeName = Rc; +type FormalParamList = Vec<(ParamName, Option)>; + #[derive(Debug, PartialEq)] pub enum Declaration { - FuncDecl, + FuncDecl { + name: Rc, + params: FormalParamList, + }, TypeDecl(Rc, TypeBody), TypeAlias(Rc, Rc) } @@ -475,12 +482,16 @@ impl Parser { expect!(self, Keyword(Func), "Expected 'fn'"); let name = self.identifier()?; expect!(self, LParen, "Expected '('"); - let params = self.param_list(); + let params = self.param_list()?; expect!(self, RParen, "Expected ')'"); - Ok(Declaration::FuncDecl) + let decl = Declaration::FuncDecl { + name: name, + params: params + }; + Ok(decl) } - fn param_list(&mut self) -> ParseResult>> { + fn param_list(&mut self) -> ParseResult { Ok(vec!()) }