From c7f014aef2c86d7a17f2642180732a6ba9b2a125 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Fri, 25 Nov 2022 16:33:08 -0600 Subject: ¡Ya hay funciones y (algunas) expresiones! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compilador/parse/decl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'compilador/parse/decl.py') diff --git a/compilador/parse/decl.py b/compilador/parse/decl.py index 93666fc..aa9e23a 100644 --- a/compilador/parse/decl.py +++ b/compilador/parse/decl.py @@ -58,9 +58,13 @@ class ParseDecl: if type(proto) is Error: return proto + init = ParseExpr(self.parser).compound_expr() + if type(init) is Error: + return init + return DeclFunc(ident = ident, prototype = proto, - body = None) + body = init) # Parses a declaration. def decl(self) -> (Decl | Error): -- cgit v1.2.3