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.
|
* #647: Do not apply SmartyPants in parsed-literal blocks.
|
||||||
|
|
||||||
|
* C++ domain now supports array definitions.
|
||||||
|
|
||||||
|
|
||||||
Release 1.0.7 (Jan 15, 2011)
|
Release 1.0.7 (Jan 15, 2011)
|
||||||
============================
|
============================
|
||||||
|
@ -28,6 +28,7 @@ _whitespace_re = re.compile(r'\s+(?u)')
|
|||||||
_string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'"
|
_string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'"
|
||||||
r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)
|
r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)
|
||||||
_visibility_re = re.compile(r'\b(public|private|protected)\b')
|
_visibility_re = re.compile(r'\b(public|private|protected)\b')
|
||||||
|
_array_def_re = re.compile(r'\[\s*(.+?)?\s*\]')
|
||||||
_operator_re = re.compile(r'''(?x)
|
_operator_re = re.compile(r'''(?x)
|
||||||
\[\s*\]
|
\[\s*\]
|
||||||
| \(\s*\)
|
| \(\s*\)
|
||||||
@ -269,6 +270,22 @@ class PtrDefExpr(WrappingDefExpr):
|
|||||||
return u'%s*' % self.typename
|
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):
|
class RefDefExpr(WrappingDefExpr):
|
||||||
|
|
||||||
def get_id(self):
|
def get_id(self):
|
||||||
@ -558,6 +575,8 @@ class DefinitionParser(object):
|
|||||||
expr = ConstDefExpr(expr)
|
expr = ConstDefExpr(expr)
|
||||||
elif self.skip_string('*'):
|
elif self.skip_string('*'):
|
||||||
expr = PtrDefExpr(expr)
|
expr = PtrDefExpr(expr)
|
||||||
|
elif self.match(_array_def_re):
|
||||||
|
expr = ArrayDefExpr(expr, self.last_match.group(1))
|
||||||
elif self.skip_string('&'):
|
elif self.skip_string('&'):
|
||||||
expr = RefDefExpr(expr)
|
expr = RefDefExpr(expr)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user