Added support for strings with commas in template definitions.

This commit is contained in:
Armin Ronacher 2011-09-22 11:17:18 +02:00
parent 48ca7f47f9
commit 9325a16c6f
2 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,7 @@ _string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'"
r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)
_visibility_re = re.compile(r'\b(public|private|protected)\b')
_array_def_re = re.compile(r'\[\s*(.+?)?\s*\]')
_template_arg_re = re.compile(r'[^,>]+')
_template_arg_re = re.compile(r'(%s)|([^,>]+)' % _string_re.pattern, re.S)
_operator_re = re.compile(r'''(?x)
\[\s*\]
| \(\s*\)

View File

@ -28,6 +28,9 @@ def test_type_definitions():
x = 'void operator()(const boost::array<VertexID, 2>& v) const'
assert unicode(parse('function', x)) == x
x = 'void operator()(const boost::array<VertexID, 2, "foo, bar">& v) const'
assert unicode(parse('function', x)) == x
rv = parse('member_object', 'const std::vector< unsigned int, long> &name')
assert unicode(rv) == 'const std::vector<unsigned int, long>& name'