mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix name of _parse_declerator [sic]
This commit is contained in:
parent
528de30ed3
commit
07f2823618
@ -95,9 +95,9 @@ if False:
|
||||
attribute-specifier-seq[opt] decl-specifier-seq[opt]
|
||||
init-declarator-list[opt] ;
|
||||
# Drop the semi-colon. For now: drop the attributes (TODO).
|
||||
# Use at most 1 init-declerator.
|
||||
-> decl-specifier-seq init-declerator
|
||||
-> decl-specifier-seq declerator initializer
|
||||
# Use at most 1 init-declarator.
|
||||
-> decl-specifier-seq init-declarator
|
||||
-> decl-specifier-seq declarator initializer
|
||||
|
||||
decl-specifier ->
|
||||
storage-class-specifier ->
|
||||
@ -158,22 +158,22 @@ if False:
|
||||
| template-argument-list "," template-argument "..."[opt]
|
||||
template-argument ->
|
||||
constant-expression
|
||||
| type-specifier-seq abstract-declerator
|
||||
| type-specifier-seq abstract-declarator
|
||||
| id-expression
|
||||
|
||||
|
||||
declerator ->
|
||||
ptr-declerator
|
||||
declarator ->
|
||||
ptr-declarator
|
||||
| noptr-declarator parameters-and-qualifiers trailing-return-type
|
||||
(TODO: for now we don't support trailing-eturn-type)
|
||||
ptr-declerator ->
|
||||
noptr-declerator
|
||||
ptr-declarator ->
|
||||
noptr-declarator
|
||||
| ptr-operator ptr-declarator
|
||||
noptr-declerator ->
|
||||
noptr-declarator ->
|
||||
declarator-id attribute-specifier-seq[opt] ->
|
||||
"..."[opt] id-expression
|
||||
| rest-of-trailing
|
||||
| noptr-declerator parameters-and-qualifiers
|
||||
| noptr-declarator parameters-and-qualifiers
|
||||
| noptr-declarator "[" constant-expression[opt] "]"
|
||||
attribute-specifier-seq[opt]
|
||||
| "(" ptr-declarator ")"
|
||||
@ -235,20 +235,20 @@ if False:
|
||||
# Drop the attributes
|
||||
-> decl-specifier-seq abstract-declarator[opt]
|
||||
grammar, typedef-like: no initilizer
|
||||
decl-specifier-seq declerator
|
||||
decl-specifier-seq declarator
|
||||
Can start with a templateDeclPrefix.
|
||||
|
||||
member_object:
|
||||
goal: as a type_object which must have a declerator, and optionally
|
||||
goal: as a type_object which must have a declarator, and optionally
|
||||
with a initializer
|
||||
grammar:
|
||||
decl-specifier-seq declerator initializer
|
||||
decl-specifier-seq declarator initializer
|
||||
Can start with a templateDeclPrefix.
|
||||
|
||||
function_object:
|
||||
goal: a function declaration, TODO: what about templates? for now: skip
|
||||
grammar: no initializer
|
||||
decl-specifier-seq declerator
|
||||
decl-specifier-seq declarator
|
||||
Can start with a templateDeclPrefix.
|
||||
|
||||
class_object:
|
||||
@ -3868,7 +3868,7 @@ class DefinitionParser(object):
|
||||
return ASTDeclaratorNameParamQual(declId=declId, arrayOps=arrayOps,
|
||||
paramQual=paramQual)
|
||||
|
||||
def _parse_declerator(self, named, paramMode, typed=True):
|
||||
def _parse_declarator(self, named, paramMode, typed=True):
|
||||
# type: (Union[bool, unicode], unicode, bool) -> Any
|
||||
# 'typed' here means 'parse return type stuff'
|
||||
if paramMode not in ('type', 'function', 'operatorCast'):
|
||||
@ -3890,14 +3890,14 @@ class DefinitionParser(object):
|
||||
if const:
|
||||
continue
|
||||
break
|
||||
next = self._parse_declerator(named, paramMode, typed)
|
||||
next = self._parse_declarator(named, paramMode, typed)
|
||||
return ASTDeclaratorPtr(next=next, volatile=volatile, const=const)
|
||||
# TODO: shouldn't we parse an R-value ref here first?
|
||||
if typed and self.skip_string("&"):
|
||||
next = self._parse_declerator(named, paramMode, typed)
|
||||
next = self._parse_declarator(named, paramMode, typed)
|
||||
return ASTDeclaratorRef(next=next)
|
||||
if typed and self.skip_string("..."):
|
||||
next = self._parse_declerator(named, paramMode, False)
|
||||
next = self._parse_declarator(named, paramMode, False)
|
||||
return ASTDeclaratorParamPack(next=next)
|
||||
if typed: # pointer to member
|
||||
pos = self.pos
|
||||
@ -3923,7 +3923,7 @@ class DefinitionParser(object):
|
||||
if const:
|
||||
continue
|
||||
break
|
||||
next = self._parse_declerator(named, paramMode, typed)
|
||||
next = self._parse_declarator(named, paramMode, typed)
|
||||
return ASTDeclaratorMemPtr(name, const, volatile, next=next)
|
||||
if typed and self.current_char == '(': # note: peeking, not skipping
|
||||
if paramMode == "operatorCast":
|
||||
@ -3948,10 +3948,10 @@ class DefinitionParser(object):
|
||||
# TODO: hmm, if there is a name, it must be in inner, right?
|
||||
# TODO: hmm, if there must be parameters, they must b
|
||||
# inside, right?
|
||||
inner = self._parse_declerator(named, paramMode, typed)
|
||||
inner = self._parse_declarator(named, paramMode, typed)
|
||||
if not self.skip_string(')'):
|
||||
self.fail("Expected ')' in \"( ptr-declarator )\"")
|
||||
next = self._parse_declerator(named=False,
|
||||
next = self._parse_declarator(named=False,
|
||||
paramMode="type",
|
||||
typed=typed)
|
||||
return ASTDeclaratorParen(inner=inner, next=next)
|
||||
@ -3969,6 +3969,9 @@ class DefinitionParser(object):
|
||||
header = "Error in declarator or parameters and qualifiers"
|
||||
raise self._make_multi_error(prevErrors, header)
|
||||
|
||||
# backwards-compatible typo
|
||||
_parse_declerator = _parse_declarator
|
||||
|
||||
def _parse_initializer(self, outer=None):
|
||||
# type: (unicode) -> ASTInitializer
|
||||
self.skip_ws()
|
||||
@ -4011,7 +4014,7 @@ class DefinitionParser(object):
|
||||
# first try without the type
|
||||
try:
|
||||
declSpecs = self._parse_decl_specs(outer=outer, typed=False)
|
||||
decl = self._parse_declerator(named=True, paramMode=outer,
|
||||
decl = self._parse_declarator(named=True, paramMode=outer,
|
||||
typed=False)
|
||||
self.assert_end()
|
||||
except DefinitionError as exUntyped:
|
||||
@ -4025,7 +4028,7 @@ class DefinitionParser(object):
|
||||
self.pos = startPos
|
||||
try:
|
||||
declSpecs = self._parse_decl_specs(outer=outer)
|
||||
decl = self._parse_declerator(named=True, paramMode=outer)
|
||||
decl = self._parse_declarator(named=True, paramMode=outer)
|
||||
except DefinitionError as exTyped:
|
||||
self.pos = startPos
|
||||
if outer == 'type':
|
||||
@ -4056,7 +4059,7 @@ class DefinitionParser(object):
|
||||
self.pos = startPos
|
||||
typed = True
|
||||
declSpecs = self._parse_decl_specs(outer=outer, typed=typed)
|
||||
decl = self._parse_declerator(named=True, paramMode=outer,
|
||||
decl = self._parse_declarator(named=True, paramMode=outer,
|
||||
typed=typed)
|
||||
else:
|
||||
paramMode = 'type'
|
||||
@ -4068,7 +4071,7 @@ class DefinitionParser(object):
|
||||
elif outer == 'templateParam':
|
||||
named = 'single'
|
||||
declSpecs = self._parse_decl_specs(outer=outer)
|
||||
decl = self._parse_declerator(named=named, paramMode=paramMode)
|
||||
decl = self._parse_declarator(named=named, paramMode=paramMode)
|
||||
return ASTType(declSpecs, decl)
|
||||
|
||||
def _parse_type_with_init(self, named, outer):
|
||||
|
Loading…
Reference in New Issue
Block a user