Support varargs in C++ function signatures.

This commit is contained in:
Chris Pickel 2011-04-19 22:22:33 -04:00
parent 3c2662580a
commit 7aef73271a
2 changed files with 10 additions and 0 deletions

View File

@ -712,6 +712,13 @@ class DefinitionParser(object):
self.fail('expected comma between arguments')
self.skip_ws()
if self.skip_string('...'):
args.append(ArgumentDefExpr(None, '...', None))
if self.skip_string(')'):
break
else:
self.fail('expected closing parenthesis after ellipses')
argtype = self._parse_type()
argname = default = None
self.skip_ws()

View File

@ -37,6 +37,9 @@ def test_type_definitions():
x = 'explicit module::myclass::foo::foo()'
assert unicode(parse('function', x)) == x
x = 'int printf(const char* fmt, ...)'
assert unicode(parse('function', x)) == x
x = 'std::vector<std::pair<std::string, long long>> module::blah'
assert unicode(parse('type_object', x)) == x