Skip to content

Commit 45fab85

Browse files
committed
Re-export all AST types in the C and C++ domains
1 parent 630fe86 commit 45fab85

File tree

3 files changed

+147
-0
lines changed

3 files changed

+147
-0
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Release 7.3.6 (in development)
44
Bugs fixed
55
----------
66

7+
* #12295: Re-export all AST types in the C and C++ domains.
8+
Patch by Adam Turner.
79

810
Release 7.3.5 (released Apr 17, 2024)
911
=====================================

sphinx/domains/c/__init__.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,59 @@
4444
from sphinx.environment import BuildEnvironment
4545
from sphinx.util.typing import ExtensionMetadata, OptionSpec
4646

47+
# re-export objects for backwards compatibility
48+
# xref https://github.com/sphinx-doc/sphinx/issues/12295
49+
from sphinx.domains.c._ast import ( # NoQA: F401
50+
ASTAlignofExpr,
51+
ASTArray,
52+
ASTAssignmentExpr,
53+
ASTBase,
54+
ASTBinOpExpr,
55+
ASTBooleanLiteral,
56+
ASTBracedInitList,
57+
ASTCastExpr,
58+
ASTCharLiteral,
59+
ASTDeclarator,
60+
ASTDeclaratorNameBitField,
61+
ASTDeclaratorNameParam,
62+
ASTDeclaratorParen,
63+
ASTDeclaratorPtr,
64+
ASTDeclSpecs,
65+
ASTDeclSpecsSimple,
66+
ASTEnum,
67+
ASTEnumerator,
68+
ASTExpression,
69+
ASTFallbackExpr,
70+
ASTFunctionParameter,
71+
ASTIdExpression,
72+
ASTInitializer,
73+
ASTLiteral,
74+
ASTMacro,
75+
ASTMacroParameter,
76+
ASTNumberLiteral,
77+
ASTParameters,
78+
ASTParenExpr,
79+
ASTParenExprList,
80+
ASTPostfixArray,
81+
ASTPostfixCallExpr,
82+
ASTPostfixDec,
83+
ASTPostfixExpr,
84+
ASTPostfixInc,
85+
ASTPostfixMemberOfPointer,
86+
ASTPostfixOp,
87+
ASTSizeofExpr,
88+
ASTSizeofType,
89+
ASTStringLiteral,
90+
ASTStruct,
91+
ASTTrailingTypeSpec,
92+
ASTTrailingTypeSpecFundamental,
93+
ASTTrailingTypeSpecName,
94+
ASTType,
95+
ASTTypeWithInit,
96+
ASTUnaryOpExpr,
97+
ASTUnion,
98+
)
99+
47100
logger = logging.getLogger(__name__)
48101

49102

sphinx/domains/cpp/__init__.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,98 @@
4848
from sphinx.environment import BuildEnvironment
4949
from sphinx.util.typing import ExtensionMetadata, OptionSpec
5050

51+
# re-export objects for backwards compatibility
52+
# xref https://github.com/sphinx-doc/sphinx/issues/12295
53+
from sphinx.domains.cpp._ast import ( # NoQA: F401
54+
ASTAlignofExpr,
55+
ASTArray,
56+
ASTAssignmentExpr,
57+
ASTBase,
58+
ASTBaseClass,
59+
ASTBinOpExpr,
60+
ASTBooleanLiteral,
61+
ASTBracedInitList,
62+
ASTCastExpr,
63+
ASTCharLiteral,
64+
ASTClass,
65+
ASTCommaExpr,
66+
ASTConcept,
67+
ASTConditionalExpr,
68+
ASTDeclarator,
69+
ASTDeclaratorMemPtr,
70+
ASTDeclaratorNameBitField,
71+
ASTDeclaratorNameParamQual,
72+
ASTDeclaratorParamPack,
73+
ASTDeclaratorParen,
74+
ASTDeclaratorPtr,
75+
ASTDeclaratorRef,
76+
ASTDeclSpecs,
77+
ASTDeclSpecsSimple,
78+
ASTDeleteExpr,
79+
ASTEnum,
80+
ASTEnumerator,
81+
ASTExplicitCast,
82+
ASTExplicitSpec,
83+
ASTExpression,
84+
ASTFallbackExpr,
85+
ASTFoldExpr,
86+
ASTFunctionParameter,
87+
ASTIdExpression,
88+
ASTInitializer,
89+
ASTLiteral,
90+
ASTNewExpr,
91+
ASTNoexceptExpr,
92+
ASTNoexceptSpec,
93+
ASTNumberLiteral,
94+
ASTOperator,
95+
ASTOperatorBuildIn,
96+
ASTOperatorLiteral,
97+
ASTOperatorType,
98+
ASTPackExpansionExpr,
99+
ASTParametersQualifiers,
100+
ASTParenExpr,
101+
ASTParenExprList,
102+
ASTPointerLiteral,
103+
ASTPostfixArray,
104+
ASTPostfixCallExpr,
105+
ASTPostfixDec,
106+
ASTPostfixExpr,
107+
ASTPostfixInc,
108+
ASTPostfixMember,
109+
ASTPostfixMemberOfPointer,
110+
ASTPostfixOp,
111+
ASTRequiresClause,
112+
ASTSizeofExpr,
113+
ASTSizeofParamPack,
114+
ASTSizeofType,
115+
ASTStringLiteral,
116+
ASTTemplateArgConstant,
117+
ASTTemplateArgs,
118+
ASTTemplateDeclarationPrefix,
119+
ASTTemplateIntroduction,
120+
ASTTemplateIntroductionParameter,
121+
ASTTemplateKeyParamPackIdDefault,
122+
ASTTemplateParam,
123+
ASTTemplateParamConstrainedTypeWithInit,
124+
ASTTemplateParamNonType,
125+
ASTTemplateParams,
126+
ASTTemplateParamTemplateType,
127+
ASTTemplateParamType,
128+
ASTThisLiteral,
129+
ASTTrailingTypeSpec,
130+
ASTTrailingTypeSpecDecltype,
131+
ASTTrailingTypeSpecDecltypeAuto,
132+
ASTTrailingTypeSpecFundamental,
133+
ASTTrailingTypeSpecName,
134+
ASTType,
135+
ASTTypeId,
136+
ASTTypeUsing,
137+
ASTTypeWithInit,
138+
ASTUnaryOpExpr,
139+
ASTUnion,
140+
ASTUserDefinedLiteral,
141+
)
142+
51143
logger = logging.getLogger(__name__)
52144

53145

0 commit comments

Comments
 (0)