fix a few bugs parsing functions

This commit is contained in:
Josh Holtrop 2011-08-31 10:56:23 -04:00
parent e7482b88f6
commit cb8402018f
2 changed files with 4 additions and 3 deletions

View File

@ -49,11 +49,11 @@ class Parser(object):
def p_function(self, p):
'function : type ID LPAREN RPAREN LCURLY function_items RCURLY'
p[0] = FunctionNode(p[2], p[1], None, p[6])
p[0] = FunctionNode(p[2], p[1], None, p[6].children)
def p_function_items(self, p):
'function_items : function_item function_items'
p[0] = Node([p[1] + p[2].children])
p[0] = Node([p[1]] + p[2].children)
def p_function_items_empty(self, p):
'function_items : empty'

View File

@ -27,7 +27,8 @@ class UnitNode(Node):
Node.__init__(self, children)
class FunctionNode(Node):
def __init__(self, name, ret_type, children=None):
def __init__(self, name, ret_type, param_list, children=None):
Node.__init__(self, children)
self.name = name
self.ret_type = ret_type
self.param_list = param_list