nodes: 0, module; 1, function_definition; 2, function_name:generate_enums_info; 3, parameters; 4, block; 5, identifier:enums; 6, identifier:msgs; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, comment:"""Add camel case swift names for enums an entries, descriptions and sort enums alphabetically"""; 11, identifier:enum; 12, identifier:enums; 13, block; 14, call; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, if_statement; 19, expression_statement; 20, expression_statement; 21, for_statement; 22, expression_statement; 23, expression_statement; 24, expression_statement; 25, attribute; 26, argument_list; 27, assignment; 28, assignment; 29, assignment; 30, attribute; 31, block; 32, assignment; 33, assignment; 34, identifier:entry; 35, attribute; 36, block; 37, assignment; 38, assignment; 39, assignment; 40, identifier:enums; 41, identifier:sort; 42, keyword_argument; 43, attribute; 44, call; 45, attribute; 46, call; 47, attribute; 48, string:""; 49, identifier:enum; 50, identifier:description; 51, expression_statement; 52, expression_statement; 53, identifier:all_entities; 54, list; 55, identifier:entities_info; 56, list; 57, identifier:enum; 58, identifier:entry; 59, expression_statement; 60, expression_statement; 61, if_statement; 62, expression_statement; 63, expression_statement; 64, if_statement; 65, expression_statement; 66, expression_statement; 67, attribute; 68, call; 69, attribute; 70, call; 71, attribute; 72, call; 73, identifier:key; 74, lambda; 75, identifier:enum; 76, identifier:swift_name; 77, identifier:camel_case_from_underscores; 78, argument_list; 79, identifier:enum; 80, identifier:raw_value_type; 81, identifier:get_enum_raw_type; 82, argument_list; 83, identifier:enum; 84, identifier:formatted_description; 85, assignment; 86, assignment; 87, assignment; 88, comment:"""Ensure that enums entry name does not start from digit"""; 89, call; 90, block; 91, assignment; 92, assignment; 93, attribute; 94, block; 95, call; 96, call; 97, identifier:enum; 98, identifier:all_entities; 99, attribute; 100, argument_list; 101, identifier:enum; 102, identifier:entities_info; 103, attribute; 104, argument_list; 105, identifier:enum; 106, identifier:entity_description; 107, attribute; 108, argument_list; 109, lambda_parameters; 110, attribute; 111, attribute; 112, identifier:enum; 113, identifier:msgs; 114, attribute; 115, call; 116, attribute; 117, binary_operator:"\n/**\n    %s\n*/\n" % enum.description; 118, identifier:name; 119, call; 120, attribute; 121, argument_list; 122, expression_statement; 123, attribute; 124, call; 125, attribute; 126, string:""; 127, identifier:entry; 128, identifier:description; 129, expression_statement; 130, expression_statement; 131, attribute; 132, argument_list; 133, attribute; 134, argument_list; 135, string:", "; 136, identifier:join; 137, identifier:all_entities; 138, string:", "; 139, identifier:join; 140, identifier:entities_info; 141, attribute; 142, identifier:replace; 143, string:'"'; 144, string:'\\"'; 145, identifier:enum; 146, identifier:enum; 147, identifier:swift_name; 148, identifier:enum; 149, identifier:name; 150, identifier:enum; 151, identifier:description; 152, attribute; 153, argument_list; 154, identifier:enum; 155, identifier:formatted_description; 156, string:"\n/**\n    %s\n*/\n"; 157, attribute; 158, attribute; 159, argument_list; 160, subscript; 161, identifier:isdigit; 162, assignment; 163, identifier:entry; 164, identifier:swift_name; 165, identifier:camel_case_from_underscores; 166, argument_list; 167, identifier:entry; 168, identifier:formatted_description; 169, assignment; 170, assignment; 171, identifier:all_entities; 172, identifier:append; 173, attribute; 174, identifier:entities_info; 175, identifier:append; 176, binary_operator:'("%s", "%s")' % (entry.name, entry.description.replace('"','\\"')); 177, identifier:enum; 178, identifier:description; 179, string:" "; 180, identifier:join; 181, call; 182, identifier:enum; 183, identifier:description; 184, attribute; 185, identifier:replace; 186, binary_operator:enum.name + '_'; 187, string; 188, identifier:name; 189, integer:0; 190, identifier:name; 191, binary_operator:"MAV_" + name; 192, identifier:name; 193, attribute; 194, call; 195, attribute; 196, binary_operator:"\n\t/// " + entry.description + "\n"; 197, identifier:entry; 198, identifier:swift_name; 199, string:'("%s", "%s")'; 200, tuple; 201, attribute; 202, argument_list; 203, identifier:entry; 204, identifier:name; 205, attribute; 206, string; 207, string:"MAV_"; 208, identifier:name; 209, identifier:entry; 210, identifier:description; 211, attribute; 212, argument_list; 213, identifier:entry; 214, identifier:formatted_description; 215, binary_operator:"\n\t/// " + entry.description; 216, string:"\n"; 217, attribute; 218, call; 219, attribute; 220, identifier:split; 221, identifier:enum; 222, identifier:name; 223, string_content:_; 224, string:" "; 225, identifier:join; 226, call; 227, string:"\n\t/// "; 228, attribute; 229, identifier:entry; 230, identifier:name; 231, attribute; 232, argument_list; 233, identifier:enum; 234, identifier:description; 235, attribute; 236, argument_list; 237, identifier:entry; 238, identifier:description; 239, attribute; 240, identifier:replace; 241, string:'"'; 242, string:'\\"'; 243, attribute; 244, identifier:split; 245, identifier:entry; 246, identifier:description; 247, identifier:entry; 248, identifier:description
code: def generate_enums_info(enums, msgs):
      """Add camel case swift names for enums an entries, descriptions and sort enums alphabetically"""
  
      for enum in enums:
          enum.swift_name = camel_case_from_underscores(enum.name)
          enum.raw_value_type = get_enum_raw_type(enum, msgs)
  
          enum.formatted_description = ""
          if enum.description:
              enum.description = " ".join(enum.description.split())
              enum.formatted_description = "\n/**\n    %s\n*/\n" % enum.description
  
          all_entities = []
          entities_info = []
  
          for entry in enum.entry:
              name = entry.name.replace(enum.name + '_', '')
              """Ensure that enums entry name does not start from digit"""
              if name[0].isdigit():
                  name = "MAV_" + name
              entry.swift_name = camel_case_from_underscores(name)
              
              entry.formatted_description = ""
              if entry.description:
                  entry.description = " ".join(entry.description.split())
                  entry.formatted_description = "\n\t/// " + entry.description + "\n"
  
              all_entities.append(entry.swift_name)
              entities_info.append('("%s", "%s")' % (entry.name, entry.description.replace('"','\\"')))
  
          enum.all_entities = ", ".join(all_entities)
          enum.entities_info = ", ".join(entities_info)
          enum.entity_description = enum.description.replace('"','\\"')
  
      enums.sort(key = lambda enum : enum.swift_name)