mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C++ domain now supports array definitions.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -67,6 +67,8 @@ Release 1.1 (in development)
|
||||
* #259: HTML table rows now have even/odd CSS classes to enable
|
||||
"Zebra styling".
|
||||
|
||||
* C++ domain now supports array definitions.
|
||||
|
||||
|
||||
Release 1.0.7 (in development)
|
||||
==============================
|
||||
|
||||
@@ -28,6 +28,7 @@ _whitespace_re = re.compile(r'\s+(?u)')
|
||||
_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*\]')
|
||||
_operator_re = re.compile(r'''(?x)
|
||||
\[\s*\]
|
||||
| \(\s*\)
|
||||
@@ -273,6 +274,22 @@ class PtrDefExpr(WrappingDefExpr):
|
||||
return u'%s*' % self.typename
|
||||
|
||||
|
||||
class ArrayDefExpr(WrappingDefExpr):
|
||||
|
||||
def __init__(self, typename, size_hint=None):
|
||||
WrappingDefExpr.__init__(self, typename)
|
||||
self.size_hint = size_hint
|
||||
|
||||
def get_id(self):
|
||||
return self.typename.get_id() + u'A'
|
||||
|
||||
def __unicode__(self):
|
||||
return u'%s[%s]' % (
|
||||
self.typename,
|
||||
self.size_hint is not None and unicode(self.size_hint) or u''
|
||||
)
|
||||
|
||||
|
||||
class RefDefExpr(WrappingDefExpr):
|
||||
|
||||
def get_id(self):
|
||||
@@ -562,6 +579,8 @@ class DefinitionParser(object):
|
||||
expr = ConstDefExpr(expr)
|
||||
elif self.skip_string('*'):
|
||||
expr = PtrDefExpr(expr)
|
||||
elif self.match(_array_def_re):
|
||||
expr = ArrayDefExpr(expr, self.last_match.group(1))
|
||||
elif self.skip_string('&'):
|
||||
expr = RefDefExpr(expr)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user