mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C++: remove function concepts.
This commit is contained in:
parent
5ae72bdd28
commit
9aac2420d3
1
CHANGES
1
CHANGES
@ -68,6 +68,7 @@ Features removed
|
|||||||
* ``sphinx.util.nodes.process_only_nodes()``
|
* ``sphinx.util.nodes.process_only_nodes()``
|
||||||
* LaTeX environment ``notice``, use ``sphinxadmonition`` instead
|
* LaTeX environment ``notice``, use ``sphinxadmonition`` instead
|
||||||
* LaTeX ``\sphinxstylethead``, use ``\sphinxstyletheadfamily``
|
* LaTeX ``\sphinxstylethead``, use ``\sphinxstyletheadfamily``
|
||||||
|
* C++, support of function concepts
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -720,13 +720,12 @@ a visibility statement (``public``, ``private`` or ``protected``).
|
|||||||
|
|
||||||
|
|
||||||
.. rst:directive:: .. cpp:concept:: template-parameter-list name
|
.. rst:directive:: .. cpp:concept:: template-parameter-list name
|
||||||
.. cpp:concept:: template-parameter-list name()
|
|
||||||
|
|
||||||
.. warning:: The support for concepts is experimental. It is based on the
|
.. warning:: The support for concepts is experimental. It is based on the
|
||||||
Concepts Technical Specification, and the features may change as the TS evolves.
|
Concepts Technical Specification, and the features may change as the TS evolves.
|
||||||
|
|
||||||
Describe a variable concept or a function concept. Both must have exactly 1
|
Describe a concept. It must have exactly 1 template parameter list. The name may be a
|
||||||
template parameter list. The name may be a nested name. Examples::
|
nested name. Example::
|
||||||
|
|
||||||
.. cpp:concept:: template<typename It> std::Iterator
|
.. cpp:concept:: template<typename It> std::Iterator
|
||||||
|
|
||||||
@ -744,12 +743,7 @@ a visibility statement (``public``, ``private`` or ``protected``).
|
|||||||
- :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
|
- :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
|
||||||
- :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when :cpp:expr:`r` is incrementable.
|
- :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when :cpp:expr:`r` is incrementable.
|
||||||
|
|
||||||
.. cpp:concept:: template<typename Cont> std::Container()
|
This will render as follows:
|
||||||
|
|
||||||
Holder of elements, to which it can provide access via
|
|
||||||
:cpp:concept:`Iterator` s.
|
|
||||||
|
|
||||||
They will render as follows:
|
|
||||||
|
|
||||||
.. cpp:concept:: template<typename It> std::Iterator
|
.. cpp:concept:: template<typename It> std::Iterator
|
||||||
|
|
||||||
@ -767,11 +761,6 @@ a visibility statement (``public``, ``private`` or ``protected``).
|
|||||||
- :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
|
- :cpp:expr:`*r`, when :cpp:expr:`r` is dereferenceable.
|
||||||
- :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when :cpp:expr:`r` is incrementable.
|
- :cpp:expr:`++r`, with return type :cpp:expr:`It&`, when :cpp:expr:`r` is incrementable.
|
||||||
|
|
||||||
.. cpp:concept:: template<typename Cont> std::Container()
|
|
||||||
|
|
||||||
Holder of elements, to which it can provide access via
|
|
||||||
:cpp:concept:`Iterator` s.
|
|
||||||
|
|
||||||
Options
|
Options
|
||||||
.......
|
.......
|
||||||
|
|
||||||
|
@ -224,13 +224,12 @@ logger = logging.getLogger(__name__)
|
|||||||
concept_object:
|
concept_object:
|
||||||
goal:
|
goal:
|
||||||
just a declaration of the name (for now)
|
just a declaration of the name (for now)
|
||||||
either a variable concept or function concept
|
|
||||||
|
|
||||||
grammar: only a single template parameter list, and the nested name
|
grammar: only a single template parameter list, and the nested name
|
||||||
may not have any template argument lists
|
may not have any template argument lists
|
||||||
|
|
||||||
"template" "<" template-parameter-list ">"
|
"template" "<" template-parameter-list ">"
|
||||||
nested-name-specifier "()"[opt]
|
nested-name-specifier
|
||||||
|
|
||||||
type_object:
|
type_object:
|
||||||
goal:
|
goal:
|
||||||
@ -2780,10 +2779,9 @@ class ASTTypeUsing(ASTBase):
|
|||||||
|
|
||||||
|
|
||||||
class ASTConcept(ASTBase):
|
class ASTConcept(ASTBase):
|
||||||
def __init__(self, nestedName, isFunction, initializer):
|
def __init__(self, nestedName, initializer):
|
||||||
# type: (Any, bool, Any) -> None
|
# type: (Any, Any) -> None
|
||||||
self.nestedName = nestedName
|
self.nestedName = nestedName
|
||||||
self.isFunction = isFunction # otherwise it's a variable concept
|
|
||||||
self.initializer = initializer
|
self.initializer = initializer
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -2800,18 +2798,13 @@ class ASTConcept(ASTBase):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
# type: () -> unicode
|
# type: () -> unicode
|
||||||
res = text_type(self.nestedName)
|
res = text_type(self.nestedName)
|
||||||
if self.isFunction:
|
|
||||||
res += "()"
|
|
||||||
if self.initializer:
|
if self.initializer:
|
||||||
res += text_type(self.initializer)
|
res += text_type(self.initializer)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def describe_signature(self, signode, mode, env, symbol):
|
def describe_signature(self, signode, mode, env, symbol):
|
||||||
# type: (addnodes.desc_signature, unicode, BuildEnvironment, Symbol) -> None
|
# type: (addnodes.desc_signature, unicode, BuildEnvironment, Symbol) -> None
|
||||||
signode += nodes.Text(text_type("bool "))
|
|
||||||
self.nestedName.describe_signature(signode, mode, env, symbol)
|
self.nestedName.describe_signature(signode, mode, env, symbol)
|
||||||
if self.isFunction:
|
|
||||||
signode += nodes.Text("()")
|
|
||||||
if self.initializer:
|
if self.initializer:
|
||||||
self.initializer.describe_signature(signode, mode, env, symbol)
|
self.initializer.describe_signature(signode, mode, env, symbol)
|
||||||
|
|
||||||
@ -4718,20 +4711,9 @@ class DefinitionParser(object):
|
|||||||
def _parse_concept(self):
|
def _parse_concept(self):
|
||||||
# type: () -> ASTConcept
|
# type: () -> ASTConcept
|
||||||
nestedName = self._parse_nested_name()
|
nestedName = self._parse_nested_name()
|
||||||
isFunction = False
|
|
||||||
|
|
||||||
self.skip_ws()
|
self.skip_ws()
|
||||||
if self.skip_string('('):
|
|
||||||
isFunction = True
|
|
||||||
self.skip_ws()
|
|
||||||
if not self.skip_string(')'):
|
|
||||||
self.fail("Expected ')' in function concept declaration.")
|
|
||||||
|
|
||||||
initializer = self._parse_initializer('member')
|
initializer = self._parse_initializer('member')
|
||||||
if initializer and isFunction:
|
return ASTConcept(nestedName, initializer)
|
||||||
self.fail("Function concept with initializer.")
|
|
||||||
|
|
||||||
return ASTConcept(nestedName, isFunction, initializer)
|
|
||||||
|
|
||||||
def _parse_class(self):
|
def _parse_class(self):
|
||||||
# type: () -> ASTClass
|
# type: () -> ASTClass
|
||||||
|
@ -231,10 +231,6 @@ def test_concept_definitions():
|
|||||||
{2:'I0EN1A1B7ConceptE'})
|
{2:'I0EN1A1B7ConceptE'})
|
||||||
check('concept', 'template<typename A, typename B, typename ...C> Foo',
|
check('concept', 'template<typename A, typename B, typename ...C> Foo',
|
||||||
{2:'I00DpE3Foo'})
|
{2:'I00DpE3Foo'})
|
||||||
check('concept', 'template<typename Param> A::B::Concept()',
|
|
||||||
{2:'I0EN1A1B7ConceptE'})
|
|
||||||
check('concept', 'template<typename A, typename B, typename ...C> Foo()',
|
|
||||||
{2:'I00DpE3Foo'})
|
|
||||||
with pytest.raises(DefinitionError):
|
with pytest.raises(DefinitionError):
|
||||||
parse('concept', 'Foo')
|
parse('concept', 'Foo')
|
||||||
with pytest.raises(DefinitionError):
|
with pytest.raises(DefinitionError):
|
||||||
|
Loading…
Reference in New Issue
Block a user