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