def visit_simple_expression(self, node): """ Visits a singe simple rhs which consists of a string literal and updates the type. :param node: a simple rhs containing a string literal :type node: ast_simple_expression """ node.type = PredefinedTypes.get_string_type() node.type.referenced_object = node
def visit_simple_expression(self, node): """ Visits a singe simple rhs which consists of a string literal and updates the type. :param node: a simple rhs containing a string literal :type node: ast_simple_expression """ node.type = PredefinedTypes.get_string_type() node.type.referenced_object = node
def __register_logger_warning_function(cls): """ Registers the logger warning method. """ params = list() params.append(PredefinedTypes.get_string_type()) # the argument symbol = FunctionSymbol(name=cls.LOGGER_WARNING, param_types=params, return_type=PredefinedTypes.get_void_type(), element_reference=None, is_predefined=True) cls.name2function[cls.LOGGER_WARNING] = symbol
def __register_logger_info_function(cls): """ Registers the logger info method into the scope. """ params = list() params.append(PredefinedTypes.get_string_type()) # the argument symbol = FunctionSymbol(name=cls.LOGGER_INFO, param_types=params, return_type=PredefinedTypes.get_void_type(), element_reference=None, is_predefined=True) cls.name2function[cls.LOGGER_INFO] = symbol
def __register_print_ln_function(cls): """ Registers the print-line function. """ params = list() params.append(PredefinedTypes.get_string_type()) symbol = FunctionSymbol(name=cls.PRINTLN, param_types=params, return_type=PredefinedTypes.get_void_type(), element_reference=None, is_predefined=True) cls.name2function[cls.PRINTLN] = symbol
def __register_logger_warning_function(cls): """ Registers the logger warning method. """ params = list() params.append(PredefinedTypes.get_string_type()) # the argument symbol = FunctionSymbol(name=cls.LOGGER_WARNING, param_types=params, return_type=PredefinedTypes.get_void_type(), element_reference=None, is_predefined=True) cls.name2function[cls.LOGGER_WARNING] = symbol
def __register_logger_info_function(cls): """ Registers the logger info method into the scope. """ params = list() params.append(PredefinedTypes.get_string_type()) # the argument symbol = FunctionSymbol(name=cls.LOGGER_INFO, param_types=params, return_type=PredefinedTypes.get_void_type(), element_reference=None, is_predefined=True) cls.name2function[cls.LOGGER_INFO] = symbol
def __register_print_function(cls): """ Registers the print function. """ params = list() params.append(PredefinedTypes.get_string_type()) symbol = FunctionSymbol(name=cls.PRINT, param_types=params, return_type=PredefinedTypes.get_void_type(), element_reference=None, is_predefined=True) cls.name2function[cls.PRINT] = symbol
def visit_data_type(self, node): """ Visits a single data type meta_model node and updates, checks correctness and updates its type symbol. This visitor can also be used to derive the original name of the unit. :param node: a single datatype node. :type node: ast_data_type """ if node.is_integer: self.symbol = PredefinedTypes.get_integer_type() node.set_type_symbol(self.symbol) elif node.is_real: self.symbol = PredefinedTypes.get_real_type() node.set_type_symbol(self.symbol) elif node.is_string: self.symbol = PredefinedTypes.get_string_type() node.set_type_symbol(self.symbol) elif node.is_boolean: self.symbol = PredefinedTypes.get_boolean_type() node.set_type_symbol(self.symbol) elif node.is_void: self.symbol = PredefinedTypes.get_void_type() node.set_type_symbol(self.symbol)
def visit_data_type(self, node): """ Visits a single data type meta_model node and updates, checks correctness and updates its type symbol. This visitor can also be used to derive the original name of the unit. :param node: a single datatype node. :type node: ast_data_type """ if node.is_integer: self.symbol = PredefinedTypes.get_integer_type() node.set_type_symbol(self.symbol) elif node.is_real: self.symbol = PredefinedTypes.get_real_type() node.set_type_symbol(self.symbol) elif node.is_string: self.symbol = PredefinedTypes.get_string_type() node.set_type_symbol(self.symbol) elif node.is_boolean: self.symbol = PredefinedTypes.get_boolean_type() node.set_type_symbol(self.symbol) elif node.is_void: self.symbol = PredefinedTypes.get_void_type() node.set_type_symbol(self.symbol)