diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py index 0de8fea8a9..b92627fd07 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/__init__.py @@ -260,7 +260,7 @@ def make_template_expander(filename): template_text = re.sub(r'([^\$]{0,1})\$\{([^\}]+)\}', r'\1$!\2!$', template_text) # Flow control expression transformation: % foo: ==> - template_text = re.sub(r'(?m)^(\ *)\%\ *([^\:]+?):{0,1}$', r'\1', template_text) + template_text = re.sub(r'(?m)^(\ *)\%\ *(.+?):{0,1}$', r'\1', template_text) # Block termination transformation: ==> template_text = re.sub(r'\<\!--\(end[a-z]+\)--\>', r'', template_text) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl index 8fd4d2f726..305d715dc5 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl @@ -311,7 +311,7 @@ const ::uavcan::DefaultDataTypeRegistrator< ${t.cpp_full_type_name} > _uavcan_gd // No default registration % endif -% for nsc in t.cpp_namespace_components: +% for nsc in t.cpp_namespace_components[::-1]: } // Namespace ${nsc} % endfor @@ -387,8 +387,8 @@ ${define_streaming_operator(type_name=t.cpp_full_type_name + '::Response')} ${define_streaming_operator(type_name=t.cpp_full_type_name)} % endif -% for nsc in t.cpp_namespace_components: -} +% for nsc in t.cpp_namespace_components[::-1]: +} // Namespace ${nsc} % endfor #endif // ${t.include_guard}