Пример #1
0
 def create_entity(self, node):
     """
         Create an entity
     """
     comment = None
     if len(node.children) == 4:
         comment = self._handle_node(node.children[3])
     
     interf = DefineEntity(str(node.children[0].text), comment)
     
     parents = node.children[1].children
     interf.parents = [self._handle_node(x) for x in parents]
     
     attributes = node.children[2].children
     for attribute in attributes:
         type_ref = self._handle_node(attribute.children[0])
         name = str(attribute.children[1].text)
         
         default_value = None
         if len(attribute.children) > 2:
             default_value = self._handle_node(attribute.children[2])
             
         interf.add_attribute(type_ref, name, default_value)
     
     return interf