When calling some functions (e.g. constructors without the new operator), sometimes the templates are not parsed, because they do not appear explicitly in the text tokens. However, they are available in the type information. E.g. (exceprt):
The type of the expression is correctly identified as actionlib::SimpleActionServer<actionlib_tutorials::FibonacciAction>, even though the templates are not explicit in the tokens of the function call.
The current version of the parser only looks at the tokens, as seen below.
def _parse_templates(self, name, tokens):
templates = []
text = "".join(tokens)
start = text.find("<")
if (start >= 0 and not "<" in name and not ">" in name
and text[:start].endswith(name)):
matches = 1
i = start + 1
while matches > 0 and i < len(text):
if text[i] == "<":
matches += 1
elif text[i] == ">":
matches -= 1
elif text[i] == "," and matches == 1:
templates.append(text[start+1:i])
start = i
i += 1
templates.append(text[start+1:i-1])
return tuple(templates)
This function should be modified and reused to search for templates in type information when it is not available in the tokens.
When calling some functions (e.g. constructors without the
new
operator), sometimes the templates are not parsed, because they do not appear explicitly in the text tokens. However, they are available in the type information. E.g. (exceprt):When parsing the code above, specifically the line
The type of the expression is correctly identified as
actionlib::SimpleActionServer<actionlib_tutorials::FibonacciAction>
, even though the templates are not explicit in the tokens of the function call.The current version of the parser only looks at the tokens, as seen below.
This function should be modified and reused to search for templates in type information when it is not available in the tokens.