def returntype(): ice9_parser_global.logger.debug("Entering returntype") if ice9_parser_global.tok.type == 'ID': foundation_return_type = ice9_parser_global.tok.value return_type = ice9_st_type.get_basic_data_type(foundation_return_type) ice9_parser_global.consume() ice9_parser_global.logger.debug(ice9_parser_global.tok) else: print "Line", ice9_parser_global.tok.lineno, ": on token", ice9_parser_global.tok.value, "expecting id" sys.exit() # Check if return type defined if not return_type: print "Line", ice9_parser_global.tok.lineno, ": on token '" + \ ice9_parser_global.tok.value + "' return type '" + foundation_return_type + \ "' not defined in scope 'GLOBAL'" sys.exit() if return_type not in ice9_st_type.st_type: print "Line", ice9_parser_global.tok.lineno, ": on token '" + \ ice9_parser_global.tok.value + "' return type '" + return_type + \ "' not defined in scope 'GLOBAL'" sys.exit() # Check if foundation_data_type is not an array if ice9_st_type.st_type[foundation_return_type][-1].dimension != 0: print "Line", ice9_parser_global.tok.lineno, ": on token '" + \ ice9_parser_global.tok.value + "'procedure return type '" + foundation_return_type + \ "' cannot be an array" sys.exit() ice9_parser_global.logger.debug("Exiting returntype") return return_type
def set_basic_data_type(self): self.basic_data_type = ice9_st_type.get_basic_data_type(self.foundation_data_type)
def __init__(self, identifier, foundation_data_type, dimension): self.identifier = identifier self.foundation_data_type = foundation_data_type self.basic_data_type = ice9_st_type.get_basic_data_type(foundation_data_type) self.dimension = dimension + ice9_st_type.st_type[self.foundation_data_type][-1].dimension