Refactored ASTGenerator #3

Merged
aCompetentBean merged 8 commits from ayrton/refactor into main 2023-11-24 07:34:47 -07:00
Showing only changes of commit e2be922455 - Show all commits

View file

@ -357,20 +357,23 @@ class AstGenerator:
self.current_ast_element = parent self.current_ast_element = parent
def generate_unary(self, op, op_type=ANY_TYPE): def generate_unary(self, op, op_type=ANY_TYPE):
"""
@brief Generate a unary operation
@param op_type: the type of the expression
"""
parent = self.current_ast_element parent = self.current_ast_element
args = [ args = [
("op", op), ("op", op),
("type", op_type), ("type", op_type),
] ]
element = build_xml_element(args, name=GAZ_UNARY_OPERATOR_TAG) self.make_element(GAZ_UNARY_OPERATOR_TAG, args)
self.current_ast_element.append(element)
self.current_ast_element = element
self.generate_xhs(GAZ_RHS_TAG, op_type) self.generate_xhs(GAZ_RHS_TAG, op_type)
self.current_ast_element = parent self.current_ast_element = parent
def generate_routine_call(self): def generate_routine_call(self): # we should generate a test case with arbitrary number of args
pass pass
def generate_conditional(self): def generate_conditional(self):