@@ -107,8 +107,25 @@ def __init__(self):
107107 self .typedefs = {} # Store typedef declarations
108108
109109 def _contains_key_annotations (self , content : str ) -> bool :
110- """Check if IDL content contains @key annotations (not supported in ROS2 .msg)"""
111- return '@key' in content
110+ """Check if IDL content contains @key annotations or references to keyed types (not supported in ROS2 .msg)"""
111+ # Direct @key annotations
112+ if '@key' in content :
113+ return True
114+
115+ # Check for references to known keyed types
116+ keyed_type_patterns = [
117+ r'test_msgs::msg::KeyedString' ,
118+ r'test_msgs::msg::KeyedLong' ,
119+ r'KeyedString' ,
120+ r'KeyedLong'
121+ ]
122+
123+ import re
124+ for pattern in keyed_type_patterns :
125+ if re .search (pattern , content ):
126+ return True
127+
128+ return False
112129
113130 def parse_file (self , idl_file_path : str ) -> List [IdlInterface ]:
114131 """Parse an IDL file and return list of interfaces"""
@@ -123,7 +140,12 @@ def parse_content(self, content: str, file_path: str = "") -> List[IdlInterface]
123140
124141 # Check for unsupported features
125142 if self ._contains_key_annotations (content ):
126- print (f"Warning: Skipping { file_path } - contains @key annotations which are not supported in ROS2 .msg files" )
143+ # Determine the specific reason for skipping
144+ if '@key' in content :
145+ reason = "contains @key annotations"
146+ else :
147+ reason = "references keyed types"
148+ print (f"Warning: Skipping { file_path } - { reason } which are not supported in ROS2 .msg files" )
127149 return interfaces
128150
129151 # Extract modules and their contents BEFORE preprocessing (to preserve @verbatim)
0 commit comments