From 935185ed929a848e596243f1ef40da8fb56638b8 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 12 Jan 2016 03:29:03 -0800 Subject: [PATCH] more parsing --- src/parser.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 77d3a49..d0f951c 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -10,7 +10,7 @@ pub enum ASTNode { #[derive(Debug, Clone)] pub struct Function { pub prototype: Prototype, - pub body: Vec, + pub body: Vec, } #[derive(Debug, Clone)] @@ -127,9 +127,9 @@ impl Parser { use tokenizer::Token::*; expect!(self, Fn, "Expected 'fn'"); let prototype = try!(self.prototype()); - let body = try!(self.body()); + let body: Vec = try!(self.body()); expect!(self, Keyword(Kw::End), "Expected 'end'"); - Ok(ASTNode::FuncNode(Function { prototype: prototype, body: vec!(ASTNode::ExprNode(body))} )) + Ok(ASTNode::FuncNode(Function { prototype: prototype, body: body } )) } fn prototype(&mut self) -> ParseResult { @@ -166,10 +166,10 @@ impl Parser { Ok(args) } - fn body(&mut self) -> ParseResult { + fn body(&mut self) -> ParseResult> { use tokenizer::Token::*; self.next(); - Ok(Expression::Number(101.01)) + Ok(vec!(Expression::Number(101.01))) } fn expression(&mut self) -> ParseResult {