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:
parent
1c902921f3
commit
a2562088f7
2
CHANGES
2
CHANGES
@ -49,6 +49,8 @@ Release 1.0.8 (Sep 22, 2011)
|
||||
|
||||
* #647: Do not apply SmartyPants in parsed-literal blocks.
|
||||
|
||||
* C++ domain now supports array definitions.
|
||||
|
||||
|
||||
Release 1.0.7 (Jan 15, 2011)
|
||||
============================
|
||||
|
@ -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*\)
|
||||
@ -269,6 +270,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):
|
||||
@ -558,6 +575,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:
|
||||
|
Loading…
Reference in New Issue
Block a user