Sphinx 7.3.7__py3-none-any.whl → 7.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Sphinx might be problematic. Click here for more details.

Files changed (357) hide show
  1. sphinx/__init__.py +5 -6
  2. sphinx/_cli/__init__.py +296 -0
  3. sphinx/_cli/util/__init__.py +0 -0
  4. sphinx/_cli/util/colour.py +103 -0
  5. sphinx/_cli/util/errors.py +165 -0
  6. sphinx/application.py +78 -43
  7. sphinx/builders/__init__.py +59 -15
  8. sphinx/builders/_epub_base.py +11 -5
  9. sphinx/builders/changes.py +2 -2
  10. sphinx/builders/epub3.py +2 -2
  11. sphinx/builders/gettext.py +10 -10
  12. sphinx/builders/html/__init__.py +56 -54
  13. sphinx/builders/latex/__init__.py +5 -5
  14. sphinx/builders/latex/constants.py +5 -0
  15. sphinx/builders/linkcheck.py +73 -38
  16. sphinx/builders/texinfo.py +1 -1
  17. sphinx/cmd/build.py +1 -1
  18. sphinx/cmd/quickstart.py +11 -11
  19. sphinx/config.py +57 -38
  20. sphinx/directives/__init__.py +7 -9
  21. sphinx/directives/code.py +12 -15
  22. sphinx/directives/other.py +12 -15
  23. sphinx/directives/patches.py +26 -0
  24. sphinx/domains/__init__.py +1 -1
  25. sphinx/domains/c/__init__.py +5 -5
  26. sphinx/domains/c/_ast.py +436 -12
  27. sphinx/domains/c/_symbol.py +89 -134
  28. sphinx/domains/changeset.py +3 -4
  29. sphinx/domains/cpp/__init__.py +5 -6
  30. sphinx/domains/cpp/_ast.py +822 -25
  31. sphinx/domains/cpp/_symbol.py +3 -0
  32. sphinx/domains/javascript.py +3 -6
  33. sphinx/domains/math.py +3 -2
  34. sphinx/domains/python/__init__.py +44 -6
  35. sphinx/domains/python/_object.py +7 -5
  36. sphinx/domains/rst.py +2 -2
  37. sphinx/domains/std/__init__.py +95 -14
  38. sphinx/environment/__init__.py +35 -15
  39. sphinx/environment/adapters/indexentries.py +71 -24
  40. sphinx/environment/adapters/toctree.py +1 -1
  41. sphinx/environment/collectors/__init__.py +18 -4
  42. sphinx/environment/collectors/asset.py +4 -4
  43. sphinx/environment/collectors/toctree.py +27 -14
  44. sphinx/events.py +7 -6
  45. sphinx/ext/apidoc.py +377 -170
  46. sphinx/ext/autodoc/__init__.py +13 -13
  47. sphinx/ext/autodoc/directive.py +10 -13
  48. sphinx/ext/autodoc/mock.py +10 -7
  49. sphinx/ext/autodoc/preserve_defaults.py +1 -1
  50. sphinx/ext/autodoc/typehints.py +2 -2
  51. sphinx/ext/autosummary/__init__.py +15 -9
  52. sphinx/ext/autosummary/generate.py +270 -154
  53. sphinx/ext/coverage.py +108 -18
  54. sphinx/ext/duration.py +10 -3
  55. sphinx/ext/extlinks.py +3 -2
  56. sphinx/ext/graphviz.py +3 -3
  57. sphinx/ext/ifconfig.py +1 -2
  58. sphinx/ext/imgconverter.py +1 -0
  59. sphinx/ext/imgmath.py +7 -6
  60. sphinx/ext/inheritance_diagram.py +3 -3
  61. sphinx/ext/intersphinx/__init__.py +81 -0
  62. sphinx/ext/intersphinx/__main__.py +10 -0
  63. sphinx/ext/intersphinx/_cli.py +44 -0
  64. sphinx/ext/intersphinx/_load.py +253 -0
  65. sphinx/ext/{intersphinx.py → intersphinx/_resolve.py} +17 -368
  66. sphinx/ext/intersphinx/_shared.py +53 -0
  67. sphinx/ext/mathjax.py +1 -1
  68. sphinx/ext/todo.py +2 -2
  69. sphinx/io.py +2 -6
  70. sphinx/locale/__init__.py +1 -5
  71. sphinx/locale/ar/LC_MESSAGES/sphinx.js +1 -1
  72. sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
  73. sphinx/locale/ar/LC_MESSAGES/sphinx.po +678 -471
  74. sphinx/locale/bg/LC_MESSAGES/sphinx.js +1 -1
  75. sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
  76. sphinx/locale/bg/LC_MESSAGES/sphinx.po +684 -476
  77. sphinx/locale/bn/LC_MESSAGES/sphinx.js +1 -1
  78. sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
  79. sphinx/locale/bn/LC_MESSAGES/sphinx.po +679 -472
  80. sphinx/locale/ca/LC_MESSAGES/sphinx.js +1 -1
  81. sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
  82. sphinx/locale/ca/LC_MESSAGES/sphinx.po +681 -474
  83. sphinx/locale/cak/LC_MESSAGES/sphinx.js +1 -1
  84. sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
  85. sphinx/locale/cak/LC_MESSAGES/sphinx.po +678 -471
  86. sphinx/locale/cs/LC_MESSAGES/sphinx.js +1 -1
  87. sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
  88. sphinx/locale/cs/LC_MESSAGES/sphinx.po +679 -472
  89. sphinx/locale/cy/LC_MESSAGES/sphinx.js +1 -1
  90. sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
  91. sphinx/locale/cy/LC_MESSAGES/sphinx.po +679 -472
  92. sphinx/locale/da/LC_MESSAGES/sphinx.js +1 -1
  93. sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
  94. sphinx/locale/da/LC_MESSAGES/sphinx.po +679 -472
  95. sphinx/locale/de/LC_MESSAGES/sphinx.js +1 -1
  96. sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
  97. sphinx/locale/de/LC_MESSAGES/sphinx.po +679 -472
  98. sphinx/locale/de_DE/LC_MESSAGES/sphinx.js +1 -1
  99. sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
  100. sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +678 -471
  101. sphinx/locale/el/LC_MESSAGES/sphinx.js +1 -1
  102. sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
  103. sphinx/locale/el/LC_MESSAGES/sphinx.po +701 -494
  104. sphinx/locale/en_DE/LC_MESSAGES/sphinx.js +1 -1
  105. sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
  106. sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +700 -493
  107. sphinx/locale/en_FR/LC_MESSAGES/sphinx.js +1 -1
  108. sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
  109. sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +700 -493
  110. sphinx/locale/en_GB/LC_MESSAGES/sphinx.js +1 -1
  111. sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
  112. sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +701 -494
  113. sphinx/locale/en_HK/LC_MESSAGES/sphinx.js +1 -1
  114. sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
  115. sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +700 -493
  116. sphinx/locale/eo/LC_MESSAGES/sphinx.js +1 -1
  117. sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
  118. sphinx/locale/eo/LC_MESSAGES/sphinx.po +701 -494
  119. sphinx/locale/es/LC_MESSAGES/sphinx.js +1 -1
  120. sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
  121. sphinx/locale/es/LC_MESSAGES/sphinx.po +701 -494
  122. sphinx/locale/es_CO/LC_MESSAGES/sphinx.js +1 -1
  123. sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
  124. sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +700 -493
  125. sphinx/locale/et/LC_MESSAGES/sphinx.js +1 -1
  126. sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
  127. sphinx/locale/et/LC_MESSAGES/sphinx.po +701 -494
  128. sphinx/locale/eu/LC_MESSAGES/sphinx.js +1 -1
  129. sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
  130. sphinx/locale/eu/LC_MESSAGES/sphinx.po +701 -494
  131. sphinx/locale/fa/LC_MESSAGES/sphinx.js +1 -1
  132. sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
  133. sphinx/locale/fa/LC_MESSAGES/sphinx.po +701 -494
  134. sphinx/locale/fi/LC_MESSAGES/sphinx.js +1 -1
  135. sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
  136. sphinx/locale/fi/LC_MESSAGES/sphinx.po +700 -493
  137. sphinx/locale/fr/LC_MESSAGES/sphinx.js +1 -1
  138. sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
  139. sphinx/locale/fr/LC_MESSAGES/sphinx.po +725 -518
  140. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.js +1 -1
  141. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
  142. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +700 -493
  143. sphinx/locale/gl/LC_MESSAGES/sphinx.js +1 -1
  144. sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
  145. sphinx/locale/gl/LC_MESSAGES/sphinx.po +701 -494
  146. sphinx/locale/he/LC_MESSAGES/sphinx.js +1 -1
  147. sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
  148. sphinx/locale/he/LC_MESSAGES/sphinx.po +700 -493
  149. sphinx/locale/hi/LC_MESSAGES/sphinx.js +1 -1
  150. sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
  151. sphinx/locale/hi/LC_MESSAGES/sphinx.po +701 -494
  152. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.js +1 -1
  153. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
  154. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +700 -493
  155. sphinx/locale/hr/LC_MESSAGES/sphinx.js +1 -1
  156. sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
  157. sphinx/locale/hr/LC_MESSAGES/sphinx.po +701 -494
  158. sphinx/locale/hu/LC_MESSAGES/sphinx.js +1 -1
  159. sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
  160. sphinx/locale/hu/LC_MESSAGES/sphinx.po +701 -494
  161. sphinx/locale/id/LC_MESSAGES/sphinx.js +1 -1
  162. sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
  163. sphinx/locale/id/LC_MESSAGES/sphinx.po +701 -494
  164. sphinx/locale/is/LC_MESSAGES/sphinx.js +1 -1
  165. sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
  166. sphinx/locale/is/LC_MESSAGES/sphinx.po +700 -493
  167. sphinx/locale/it/LC_MESSAGES/sphinx.js +1 -1
  168. sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
  169. sphinx/locale/it/LC_MESSAGES/sphinx.po +708 -500
  170. sphinx/locale/ja/LC_MESSAGES/sphinx.js +1 -1
  171. sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
  172. sphinx/locale/ja/LC_MESSAGES/sphinx.po +701 -494
  173. sphinx/locale/ka/LC_MESSAGES/sphinx.js +1 -1
  174. sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
  175. sphinx/locale/ka/LC_MESSAGES/sphinx.po +700 -493
  176. sphinx/locale/ko/LC_MESSAGES/sphinx.js +1 -1
  177. sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
  178. sphinx/locale/ko/LC_MESSAGES/sphinx.po +701 -494
  179. sphinx/locale/lt/LC_MESSAGES/sphinx.js +1 -1
  180. sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
  181. sphinx/locale/lt/LC_MESSAGES/sphinx.po +701 -494
  182. sphinx/locale/lv/LC_MESSAGES/sphinx.js +1 -1
  183. sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
  184. sphinx/locale/lv/LC_MESSAGES/sphinx.po +701 -494
  185. sphinx/locale/mk/LC_MESSAGES/sphinx.js +1 -1
  186. sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
  187. sphinx/locale/mk/LC_MESSAGES/sphinx.po +700 -493
  188. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.js +1 -1
  189. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
  190. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +701 -494
  191. sphinx/locale/ne/LC_MESSAGES/sphinx.js +1 -1
  192. sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
  193. sphinx/locale/ne/LC_MESSAGES/sphinx.po +701 -494
  194. sphinx/locale/nl/LC_MESSAGES/sphinx.js +1 -1
  195. sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
  196. sphinx/locale/nl/LC_MESSAGES/sphinx.po +701 -494
  197. sphinx/locale/pl/LC_MESSAGES/sphinx.js +1 -1
  198. sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
  199. sphinx/locale/pl/LC_MESSAGES/sphinx.po +701 -494
  200. sphinx/locale/pt/LC_MESSAGES/sphinx.js +1 -1
  201. sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
  202. sphinx/locale/pt/LC_MESSAGES/sphinx.po +700 -493
  203. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.js +1 -1
  204. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
  205. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +705 -498
  206. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.js +1 -1
  207. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
  208. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +701 -494
  209. sphinx/locale/ro/LC_MESSAGES/sphinx.js +1 -1
  210. sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
  211. sphinx/locale/ro/LC_MESSAGES/sphinx.po +701 -494
  212. sphinx/locale/ru/LC_MESSAGES/sphinx.js +1 -1
  213. sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
  214. sphinx/locale/ru/LC_MESSAGES/sphinx.po +890 -680
  215. sphinx/locale/si/LC_MESSAGES/sphinx.js +1 -1
  216. sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
  217. sphinx/locale/si/LC_MESSAGES/sphinx.po +700 -493
  218. sphinx/locale/sk/LC_MESSAGES/sphinx.js +1 -1
  219. sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
  220. sphinx/locale/sk/LC_MESSAGES/sphinx.po +701 -494
  221. sphinx/locale/sl/LC_MESSAGES/sphinx.js +1 -1
  222. sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
  223. sphinx/locale/sl/LC_MESSAGES/sphinx.po +701 -494
  224. sphinx/locale/sphinx.pot +702 -494
  225. sphinx/locale/sq/LC_MESSAGES/sphinx.js +1 -1
  226. sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
  227. sphinx/locale/sq/LC_MESSAGES/sphinx.po +704 -497
  228. sphinx/locale/sr/LC_MESSAGES/sphinx.js +1 -1
  229. sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
  230. sphinx/locale/sr/LC_MESSAGES/sphinx.po +700 -493
  231. sphinx/locale/sr@latin/LC_MESSAGES/sphinx.mo +0 -0
  232. sphinx/locale/sr_RS/LC_MESSAGES/sphinx.mo +0 -0
  233. sphinx/locale/sv/LC_MESSAGES/sphinx.js +1 -1
  234. sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
  235. sphinx/locale/sv/LC_MESSAGES/sphinx.po +701 -494
  236. sphinx/locale/ta/LC_MESSAGES/sphinx.po +1016 -808
  237. sphinx/locale/te/LC_MESSAGES/sphinx.js +1 -1
  238. sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
  239. sphinx/locale/te/LC_MESSAGES/sphinx.po +700 -493
  240. sphinx/locale/tr/LC_MESSAGES/sphinx.js +1 -1
  241. sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
  242. sphinx/locale/tr/LC_MESSAGES/sphinx.po +701 -494
  243. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.js +1 -1
  244. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
  245. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +701 -494
  246. sphinx/locale/ur/LC_MESSAGES/sphinx.js +1 -1
  247. sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
  248. sphinx/locale/ur/LC_MESSAGES/sphinx.po +700 -493
  249. sphinx/locale/vi/LC_MESSAGES/sphinx.js +1 -1
  250. sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
  251. sphinx/locale/vi/LC_MESSAGES/sphinx.po +701 -494
  252. sphinx/locale/yue/LC_MESSAGES/sphinx.js +1 -1
  253. sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
  254. sphinx/locale/yue/LC_MESSAGES/sphinx.po +700 -493
  255. sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po +704 -496
  256. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.js +1 -1
  257. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
  258. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +700 -493
  259. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js +1 -1
  260. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
  261. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +729 -522
  262. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.js +1 -1
  263. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
  264. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +700 -493
  265. sphinx/roles.py +1 -1
  266. sphinx/search/__init__.py +17 -9
  267. sphinx/templates/quickstart/{root_doc.rst_t → root_doc.rst.jinja} +7 -10
  268. sphinx/testing/fixtures.py +22 -20
  269. sphinx/testing/path.py +6 -2
  270. sphinx/testing/util.py +8 -13
  271. sphinx/texinputs/sphinx.sty +449 -332
  272. sphinx/texinputs/sphinxlatexadmonitions.sty +209 -66
  273. sphinx/texinputs/sphinxlatexliterals.sty +9 -16
  274. sphinx/texinputs/sphinxlatexstyletext.sty +4 -38
  275. sphinx/texinputs/sphinxlatextables.sty +6 -14
  276. sphinx/texinputs/sphinxpackageboxes.sty +15 -42
  277. sphinx/texinputs/sphinxpackagefootnote.sty +4 -3
  278. sphinx/themes/agogo/layout.html +3 -3
  279. sphinx/themes/basic/genindex-single.html +2 -1
  280. sphinx/themes/basic/layout.html +3 -6
  281. sphinx/themes/basic/static/searchtools.js +4 -3
  282. sphinx/themes/haiku/layout.html +4 -4
  283. sphinx/themes/pyramid/layout.html +1 -1
  284. sphinx/themes/scrolls/layout.html +2 -2
  285. sphinx/theming.py +3 -3
  286. sphinx/transforms/__init__.py +34 -20
  287. sphinx/transforms/i18n.py +8 -7
  288. sphinx/transforms/post_transforms/__init__.py +1 -1
  289. sphinx/transforms/post_transforms/images.py +7 -10
  290. sphinx/util/_pathlib.py +2 -2
  291. sphinx/util/cfamily.py +52 -30
  292. sphinx/util/console.py +1 -1
  293. sphinx/util/display.py +16 -11
  294. sphinx/util/docutils.py +88 -40
  295. sphinx/util/fileutil.py +15 -3
  296. sphinx/util/images.py +1 -0
  297. sphinx/util/inspect.py +66 -22
  298. sphinx/util/inventory.py +15 -0
  299. sphinx/util/logging.py +14 -21
  300. sphinx/util/math.py +3 -1
  301. sphinx/util/nodes.py +9 -12
  302. sphinx/util/osutil.py +5 -5
  303. sphinx/util/parsing.py +93 -0
  304. sphinx/util/tags.py +71 -47
  305. sphinx/util/typing.py +261 -143
  306. sphinx/versioning.py +17 -17
  307. sphinx/writers/html5.py +26 -19
  308. sphinx/writers/latex.py +58 -28
  309. sphinx/writers/manpage.py +4 -3
  310. sphinx/writers/texinfo.py +19 -14
  311. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/METADATA +21 -20
  312. sphinx-7.4.0.dist-info/RECORD +591 -0
  313. sphinx-7.3.7.dist-info/RECORD +0 -581
  314. /sphinx/templates/apidoc/{module.rst_t → module.rst.jinja} +0 -0
  315. /sphinx/templates/apidoc/{package.rst_t → package.rst.jinja} +0 -0
  316. /sphinx/templates/apidoc/{toc.rst_t → toc.rst.jinja} +0 -0
  317. /sphinx/templates/epub3/{content.opf_t → content.opf.jinja} +0 -0
  318. /sphinx/templates/epub3/{nav.xhtml_t → nav.xhtml.jinja} +0 -0
  319. /sphinx/templates/epub3/{toc.ncx_t → toc.ncx.jinja} +0 -0
  320. /sphinx/templates/gettext/{message.pot_t → message.pot.jinja} +0 -0
  321. /sphinx/templates/imgmath/{preview.tex_t → preview.tex.jinja} +0 -0
  322. /sphinx/templates/imgmath/{template.tex_t → template.tex.jinja} +0 -0
  323. /sphinx/templates/latex/{latex.tex_t → latex.tex.jinja} +0 -0
  324. /sphinx/templates/latex/{longtable.tex_t → longtable.tex.jinja} +0 -0
  325. /sphinx/templates/latex/{sphinxmessages.sty_t → sphinxmessages.sty.jinja} +0 -0
  326. /sphinx/templates/latex/{tabular.tex_t → tabular.tex.jinja} +0 -0
  327. /sphinx/templates/latex/{tabulary.tex_t → tabulary.tex.jinja} +0 -0
  328. /sphinx/templates/quickstart/{Makefile_t → Makefile.jinja} +0 -0
  329. /sphinx/templates/quickstart/{Makefile.new_t → Makefile.new.jinja} +0 -0
  330. /sphinx/templates/quickstart/{conf.py_t → conf.py.jinja} +0 -0
  331. /sphinx/templates/quickstart/{make.bat_t → make.bat.jinja} +0 -0
  332. /sphinx/templates/quickstart/{make.bat.new_t → make.bat.new.jinja} +0 -0
  333. /sphinx/texinputs/{Makefile_t → Makefile.jinja} +0 -0
  334. /sphinx/texinputs/{latexmkjarc_t → latexmkjarc.jinja} +0 -0
  335. /sphinx/texinputs/{latexmkrc_t → latexmkrc.jinja} +0 -0
  336. /sphinx/texinputs/{make.bat_t → make.bat.jinja} +0 -0
  337. /sphinx/texinputs_win/{Makefile_t → Makefile.jinja} +0 -0
  338. /sphinx/themes/agogo/static/{agogo.css_t → agogo.css.jinja} +0 -0
  339. /sphinx/themes/basic/static/{basic.css_t → basic.css.jinja} +0 -0
  340. /sphinx/themes/basic/static/{documentation_options.js_t → documentation_options.js.jinja} +0 -0
  341. /sphinx/themes/basic/static/{language_data.js_t → language_data.js.jinja} +0 -0
  342. /sphinx/themes/bizstyle/static/{bizstyle.css_t → bizstyle.css.jinja} +0 -0
  343. /sphinx/themes/bizstyle/static/{bizstyle.js_t → bizstyle.js.jinja} +0 -0
  344. /sphinx/themes/classic/static/{classic.css_t → classic.css.jinja} +0 -0
  345. /sphinx/themes/classic/static/{sidebar.js_t → sidebar.js.jinja} +0 -0
  346. /sphinx/themes/epub/static/{epub.css_t → epub.css.jinja} +0 -0
  347. /sphinx/themes/haiku/static/{haiku.css_t → haiku.css.jinja} +0 -0
  348. /sphinx/themes/nature/static/{nature.css_t → nature.css.jinja} +0 -0
  349. /sphinx/themes/nonav/static/{nonav.css_t → nonav.css.jinja} +0 -0
  350. /sphinx/themes/pyramid/static/{epub.css_t → epub.css.jinja} +0 -0
  351. /sphinx/themes/pyramid/static/{pyramid.css_t → pyramid.css.jinja} +0 -0
  352. /sphinx/themes/scrolls/static/{scrolls.css_t → scrolls.css.jinja} +0 -0
  353. /sphinx/themes/sphinxdoc/static/{sphinxdoc.css_t → sphinxdoc.css.jinja} +0 -0
  354. /sphinx/themes/traditional/static/{traditional.css_t → traditional.css.jinja} +0 -0
  355. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/LICENSE.rst +0 -0
  356. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/WHEEL +0 -0
  357. {sphinx-7.3.7.dist-info → sphinx-7.4.0.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import TYPE_CHECKING, Any
3
+ import sys
4
+ import warnings
5
+ from typing import TYPE_CHECKING, Any, ClassVar, Literal
4
6
 
5
7
  from docutils import nodes
6
8
 
@@ -44,60 +46,64 @@ class ASTBase(ASTBaseBase):
44
46
  ################################################################################
45
47
 
46
48
  class ASTIdentifier(ASTBase):
47
- def __init__(self, identifier: str) -> None:
48
- assert identifier is not None
49
- assert len(identifier) != 0
50
- self.identifier = identifier
49
+ def __init__(self, name: str) -> None:
50
+ if not isinstance(name, str) or len(name) == 0:
51
+ raise AssertionError
52
+ self.name = sys.intern(name)
53
+ self.is_anonymous = name[0] == '@'
51
54
 
52
55
  # ASTBaseBase already implements this method,
53
56
  # but specialising it here improves performance
54
57
  def __eq__(self, other: object) -> bool:
55
- if type(other) is not ASTIdentifier:
58
+ if not isinstance(other, ASTIdentifier):
56
59
  return NotImplemented
57
- return self.identifier == other.identifier
60
+ return self.name == other.name
61
+
62
+ def __hash__(self) -> int:
63
+ return hash(self.name)
58
64
 
59
65
  def _stringify(self, transform: StringifyTransform) -> str:
60
- return transform(self.identifier)
66
+ return transform(self.name)
61
67
 
62
68
  def is_anon(self) -> bool:
63
- return self.identifier[0] == '@'
69
+ return self.is_anonymous
64
70
 
65
71
  def get_id(self, version: int) -> str:
66
- if self.is_anon() and version < 3:
72
+ if self.is_anonymous and version < 3:
67
73
  raise NoOldIdError
68
74
  if version == 1:
69
- if self.identifier == 'size_t':
75
+ if self.name == 'size_t':
70
76
  return 's'
71
77
  else:
72
- return self.identifier
73
- if self.identifier == "std":
78
+ return self.name
79
+ if self.name == "std":
74
80
  return 'St'
75
- elif self.identifier[0] == "~":
81
+ elif self.name[0] == "~":
76
82
  # a destructor, just use an arbitrary version of dtors
77
83
  return 'D0'
78
84
  else:
79
- if self.is_anon():
80
- return 'Ut%d_%s' % (len(self.identifier) - 1, self.identifier[1:])
85
+ if self.is_anonymous:
86
+ return 'Ut%d_%s' % (len(self.name) - 1, self.name[1:])
81
87
  else:
82
- return str(len(self.identifier)) + self.identifier
88
+ return str(len(self.name)) + self.name
83
89
 
84
90
  # and this is where we finally make a difference between __str__ and the display string
85
91
 
86
92
  def __str__(self) -> str:
87
- return self.identifier
93
+ return self.name
88
94
 
89
95
  def get_display_string(self) -> str:
90
- return "[anonymous]" if self.is_anon() else self.identifier
96
+ return "[anonymous]" if self.is_anonymous else self.name
91
97
 
92
98
  def describe_signature(self, signode: TextElement, mode: str, env: BuildEnvironment,
93
99
  prefix: str, templateArgs: str, symbol: Symbol) -> None:
94
100
  verify_description_mode(mode)
95
- if self.is_anon():
101
+ if self.is_anonymous:
96
102
  node = addnodes.desc_sig_name(text="[anonymous]")
97
103
  else:
98
- node = addnodes.desc_sig_name(self.identifier, self.identifier)
104
+ node = addnodes.desc_sig_name(self.name, self.name)
99
105
  if mode == 'markType':
100
- targetText = prefix + self.identifier + templateArgs
106
+ targetText = prefix + self.name + templateArgs
101
107
  pnode = addnodes.pending_xref('', refdomain='cpp',
102
108
  reftype='identifier',
103
109
  reftarget=targetText, modname=None,
@@ -118,8 +124,8 @@ class ASTIdentifier(ASTBase):
118
124
  # the target is 'operator""id' instead of just 'id'
119
125
  assert len(prefix) == 0
120
126
  assert len(templateArgs) == 0
121
- assert not self.is_anon()
122
- targetText = 'operator""' + self.identifier
127
+ assert not self.is_anonymous
128
+ targetText = 'operator""' + self.name
123
129
  pnode = addnodes.pending_xref('', refdomain='cpp',
124
130
  reftype='identifier',
125
131
  reftarget=targetText, modname=None,
@@ -130,6 +136,14 @@ class ASTIdentifier(ASTBase):
130
136
  else:
131
137
  raise Exception('Unknown description mode: %s' % mode)
132
138
 
139
+ @property
140
+ def identifier(self) -> str:
141
+ warnings.warn(
142
+ '`ASTIdentifier.identifier` is deprecated, use `ASTIdentifier.name` instead',
143
+ DeprecationWarning, stacklevel=2,
144
+ )
145
+ return self.name
146
+
133
147
 
134
148
  class ASTNestedNameElement(ASTBase):
135
149
  def __init__(self, identOrOp: ASTIdentifier | ASTOperator,
@@ -137,6 +151,14 @@ class ASTNestedNameElement(ASTBase):
137
151
  self.identOrOp = identOrOp
138
152
  self.templateArgs = templateArgs
139
153
 
154
+ def __eq__(self, other: object) -> bool:
155
+ if not isinstance(other, ASTNestedNameElement):
156
+ return NotImplemented
157
+ return self.identOrOp == other.identOrOp and self.templateArgs == other.templateArgs
158
+
159
+ def __hash__(self) -> int:
160
+ return hash((self.identOrOp, self.templateArgs))
161
+
140
162
  def is_operator(self) -> bool:
141
163
  return False
142
164
 
@@ -169,6 +191,18 @@ class ASTNestedName(ASTBase):
169
191
  assert len(self.names) == len(self.templates)
170
192
  self.rooted = rooted
171
193
 
194
+ def __eq__(self, other: object) -> bool:
195
+ if not isinstance(other, ASTNestedName):
196
+ return NotImplemented
197
+ return (
198
+ self.names == other.names
199
+ and self.templates == other.templates
200
+ and self.rooted == other.rooted
201
+ )
202
+
203
+ def __hash__(self) -> int:
204
+ return hash((self.names, self.templates, self.rooted))
205
+
172
206
  @property
173
207
  def name(self) -> ASTNestedName:
174
208
  return self
@@ -316,6 +350,12 @@ class ASTLiteral(ASTExpression):
316
350
 
317
351
 
318
352
  class ASTPointerLiteral(ASTLiteral):
353
+ def __eq__(self, other: object) -> bool:
354
+ return isinstance(other, ASTPointerLiteral)
355
+
356
+ def __hash__(self) -> int:
357
+ return hash('nullptr')
358
+
319
359
  def _stringify(self, transform: StringifyTransform) -> str:
320
360
  return 'nullptr'
321
361
 
@@ -331,6 +371,14 @@ class ASTBooleanLiteral(ASTLiteral):
331
371
  def __init__(self, value: bool) -> None:
332
372
  self.value = value
333
373
 
374
+ def __eq__(self, other: object) -> bool:
375
+ if not isinstance(other, ASTBooleanLiteral):
376
+ return NotImplemented
377
+ return self.value == other.value
378
+
379
+ def __hash__(self) -> int:
380
+ return hash(self.value)
381
+
334
382
  def _stringify(self, transform: StringifyTransform) -> str:
335
383
  if self.value:
336
384
  return 'true'
@@ -352,6 +400,14 @@ class ASTNumberLiteral(ASTLiteral):
352
400
  def __init__(self, data: str) -> None:
353
401
  self.data = data
354
402
 
403
+ def __eq__(self, other: object) -> bool:
404
+ if not isinstance(other, ASTNumberLiteral):
405
+ return NotImplemented
406
+ return self.data == other.data
407
+
408
+ def __hash__(self) -> int:
409
+ return hash(self.data)
410
+
355
411
  def _stringify(self, transform: StringifyTransform) -> str:
356
412
  return self.data
357
413
 
@@ -368,6 +424,14 @@ class ASTStringLiteral(ASTLiteral):
368
424
  def __init__(self, data: str) -> None:
369
425
  self.data = data
370
426
 
427
+ def __eq__(self, other: object) -> bool:
428
+ if not isinstance(other, ASTStringLiteral):
429
+ return NotImplemented
430
+ return self.data == other.data
431
+
432
+ def __hash__(self) -> int:
433
+ return hash(self.data)
434
+
371
435
  def _stringify(self, transform: StringifyTransform) -> str:
372
436
  return self.data
373
437
 
@@ -392,6 +456,17 @@ class ASTCharLiteral(ASTLiteral):
392
456
  else:
393
457
  raise UnsupportedMultiCharacterCharLiteral(decoded)
394
458
 
459
+ def __eq__(self, other: object) -> bool:
460
+ if not isinstance(other, ASTCharLiteral):
461
+ return NotImplemented
462
+ return (
463
+ self.prefix == other.prefix
464
+ and self.value == other.value
465
+ )
466
+
467
+ def __hash__(self) -> int:
468
+ return hash((self.prefix, self.value))
469
+
395
470
  def _stringify(self, transform: StringifyTransform) -> str:
396
471
  if self.prefix is None:
397
472
  return "'" + self.data + "'"
@@ -415,6 +490,14 @@ class ASTUserDefinedLiteral(ASTLiteral):
415
490
  self.literal = literal
416
491
  self.ident = ident
417
492
 
493
+ def __eq__(self, other: object) -> bool:
494
+ if not isinstance(other, ASTUserDefinedLiteral):
495
+ return NotImplemented
496
+ return self.literal == other.literal and self.ident == other.ident
497
+
498
+ def __hash__(self) -> int:
499
+ return hash((self.literal, self.ident))
500
+
418
501
  def _stringify(self, transform: StringifyTransform) -> str:
419
502
  return transform(self.literal) + transform(self.ident)
420
503
 
@@ -431,6 +514,12 @@ class ASTUserDefinedLiteral(ASTLiteral):
431
514
  ################################################################################
432
515
 
433
516
  class ASTThisLiteral(ASTExpression):
517
+ def __eq__(self, other: object) -> bool:
518
+ return isinstance(other, ASTThisLiteral)
519
+
520
+ def __hash__(self) -> int:
521
+ return hash("this")
522
+
434
523
  def _stringify(self, transform: StringifyTransform) -> str:
435
524
  return "this"
436
525
 
@@ -450,6 +539,18 @@ class ASTFoldExpr(ASTExpression):
450
539
  self.op = op
451
540
  self.rightExpr = rightExpr
452
541
 
542
+ def __eq__(self, other: object) -> bool:
543
+ if not isinstance(other, ASTFoldExpr):
544
+ return NotImplemented
545
+ return (
546
+ self.leftExpr == other.leftExpr
547
+ and self.op == other.op
548
+ and self.rightExpr == other.rightExpr
549
+ )
550
+
551
+ def __hash__(self) -> int:
552
+ return hash((self.leftExpr, self.op, self.rightExpr))
553
+
453
554
  def _stringify(self, transform: StringifyTransform) -> str:
454
555
  res = ['(']
455
556
  if self.leftExpr:
@@ -508,6 +609,14 @@ class ASTParenExpr(ASTExpression):
508
609
  def __init__(self, expr: ASTExpression) -> None:
509
610
  self.expr = expr
510
611
 
612
+ def __eq__(self, other: object) -> bool:
613
+ if not isinstance(other, ASTParenExpr):
614
+ return NotImplemented
615
+ return self.expr == other.expr
616
+
617
+ def __hash__(self) -> int:
618
+ return hash(self.expr)
619
+
511
620
  def _stringify(self, transform: StringifyTransform) -> str:
512
621
  return '(' + transform(self.expr) + ')'
513
622
 
@@ -526,6 +635,14 @@ class ASTIdExpression(ASTExpression):
526
635
  # note: this class is basically to cast a nested name as an expression
527
636
  self.name = name
528
637
 
638
+ def __eq__(self, other: object) -> bool:
639
+ if not isinstance(other, ASTIdExpression):
640
+ return NotImplemented
641
+ return self.name == other.name
642
+
643
+ def __hash__(self) -> int:
644
+ return hash(self.name)
645
+
529
646
  def _stringify(self, transform: StringifyTransform) -> str:
530
647
  return transform(self.name)
531
648
 
@@ -553,6 +670,14 @@ class ASTPostfixArray(ASTPostfixOp):
553
670
  def __init__(self, expr: ASTExpression) -> None:
554
671
  self.expr = expr
555
672
 
673
+ def __eq__(self, other: object) -> bool:
674
+ if not isinstance(other, ASTPostfixArray):
675
+ return NotImplemented
676
+ return self.expr == other.expr
677
+
678
+ def __hash__(self) -> int:
679
+ return hash(self.expr)
680
+
556
681
  def _stringify(self, transform: StringifyTransform) -> str:
557
682
  return '[' + transform(self.expr) + ']'
558
683
 
@@ -570,6 +695,14 @@ class ASTPostfixMember(ASTPostfixOp):
570
695
  def __init__(self, name: ASTNestedName) -> None:
571
696
  self.name = name
572
697
 
698
+ def __eq__(self, other: object) -> bool:
699
+ if not isinstance(other, ASTPostfixMember):
700
+ return NotImplemented
701
+ return self.name == other.name
702
+
703
+ def __hash__(self) -> int:
704
+ return hash(self.name)
705
+
573
706
  def _stringify(self, transform: StringifyTransform) -> str:
574
707
  return '.' + transform(self.name)
575
708
 
@@ -586,6 +719,14 @@ class ASTPostfixMemberOfPointer(ASTPostfixOp):
586
719
  def __init__(self, name: ASTNestedName) -> None:
587
720
  self.name = name
588
721
 
722
+ def __eq__(self, other: object) -> bool:
723
+ if not isinstance(other, ASTPostfixMemberOfPointer):
724
+ return NotImplemented
725
+ return self.name == other.name
726
+
727
+ def __hash__(self) -> int:
728
+ return hash(self.name)
729
+
589
730
  def _stringify(self, transform: StringifyTransform) -> str:
590
731
  return '->' + transform(self.name)
591
732
 
@@ -599,6 +740,12 @@ class ASTPostfixMemberOfPointer(ASTPostfixOp):
599
740
 
600
741
 
601
742
  class ASTPostfixInc(ASTPostfixOp):
743
+ def __eq__(self, other: object) -> bool:
744
+ return isinstance(other, ASTPostfixInc)
745
+
746
+ def __hash__(self) -> int:
747
+ return hash('++')
748
+
602
749
  def _stringify(self, transform: StringifyTransform) -> str:
603
750
  return '++'
604
751
 
@@ -611,6 +758,12 @@ class ASTPostfixInc(ASTPostfixOp):
611
758
 
612
759
 
613
760
  class ASTPostfixDec(ASTPostfixOp):
761
+ def __eq__(self, other: object) -> bool:
762
+ return isinstance(other, ASTPostfixDec)
763
+
764
+ def __hash__(self) -> int:
765
+ return hash('--')
766
+
614
767
  def _stringify(self, transform: StringifyTransform) -> str:
615
768
  return '--'
616
769
 
@@ -626,6 +779,14 @@ class ASTPostfixCallExpr(ASTPostfixOp):
626
779
  def __init__(self, lst: ASTParenExprList | ASTBracedInitList) -> None:
627
780
  self.lst = lst
628
781
 
782
+ def __eq__(self, other: object) -> bool:
783
+ if not isinstance(other, ASTPostfixCallExpr):
784
+ return NotImplemented
785
+ return self.lst == other.lst
786
+
787
+ def __hash__(self) -> int:
788
+ return hash(self.lst)
789
+
629
790
  def _stringify(self, transform: StringifyTransform) -> str:
630
791
  return transform(self.lst)
631
792
 
@@ -647,6 +808,14 @@ class ASTPostfixExpr(ASTExpression):
647
808
  self.prefix = prefix
648
809
  self.postFixes = postFixes
649
810
 
811
+ def __eq__(self, other: object) -> bool:
812
+ if not isinstance(other, ASTPostfixExpr):
813
+ return NotImplemented
814
+ return self.prefix == other.prefix and self.postFixes == other.postFixes
815
+
816
+ def __hash__(self) -> int:
817
+ return hash((self.prefix, self.postFixes))
818
+
650
819
  def _stringify(self, transform: StringifyTransform) -> str:
651
820
  return ''.join([transform(self.prefix), *(transform(p) for p in self.postFixes)])
652
821
 
@@ -670,6 +839,14 @@ class ASTExplicitCast(ASTExpression):
670
839
  self.typ = typ
671
840
  self.expr = expr
672
841
 
842
+ def __eq__(self, other: object) -> bool:
843
+ if not isinstance(other, ASTExplicitCast):
844
+ return NotImplemented
845
+ return self.cast == other.cast and self.typ == other.typ and self.expr == other.expr
846
+
847
+ def __hash__(self) -> int:
848
+ return hash((self.cast, self.typ, self.expr))
849
+
673
850
  def _stringify(self, transform: StringifyTransform) -> str:
674
851
  res = [self.cast]
675
852
  res.append('<')
@@ -700,6 +877,14 @@ class ASTTypeId(ASTExpression):
700
877
  self.typeOrExpr = typeOrExpr
701
878
  self.isType = isType
702
879
 
880
+ def __eq__(self, other: object) -> bool:
881
+ if not isinstance(other, ASTTypeId):
882
+ return NotImplemented
883
+ return self.typeOrExpr == other.typeOrExpr and self.isType == other.isType
884
+
885
+ def __hash__(self) -> int:
886
+ return hash((self.typeOrExpr, self.isType))
887
+
703
888
  def _stringify(self, transform: StringifyTransform) -> str:
704
889
  return 'typeid(' + transform(self.typeOrExpr) + ')'
705
890
 
@@ -723,6 +908,14 @@ class ASTUnaryOpExpr(ASTExpression):
723
908
  self.op = op
724
909
  self.expr = expr
725
910
 
911
+ def __eq__(self, other: object) -> bool:
912
+ if not isinstance(other, ASTUnaryOpExpr):
913
+ return NotImplemented
914
+ return self.op == other.op and self.expr == other.expr
915
+
916
+ def __hash__(self) -> int:
917
+ return hash((self.op, self.expr))
918
+
726
919
  def _stringify(self, transform: StringifyTransform) -> str:
727
920
  if self.op[0] in 'cn':
728
921
  return self.op + " " + transform(self.expr)
@@ -746,6 +939,14 @@ class ASTSizeofParamPack(ASTExpression):
746
939
  def __init__(self, identifier: ASTIdentifier) -> None:
747
940
  self.identifier = identifier
748
941
 
942
+ def __eq__(self, other: object) -> bool:
943
+ if not isinstance(other, ASTSizeofParamPack):
944
+ return NotImplemented
945
+ return self.identifier == other.identifier
946
+
947
+ def __hash__(self) -> int:
948
+ return hash(self.identifier)
949
+
749
950
  def _stringify(self, transform: StringifyTransform) -> str:
750
951
  return "sizeof...(" + transform(self.identifier) + ")"
751
952
 
@@ -766,6 +967,14 @@ class ASTSizeofType(ASTExpression):
766
967
  def __init__(self, typ: ASTType) -> None:
767
968
  self.typ = typ
768
969
 
970
+ def __eq__(self, other: object) -> bool:
971
+ if not isinstance(other, ASTSizeofType):
972
+ return NotImplemented
973
+ return self.typ == other.typ
974
+
975
+ def __hash__(self) -> int:
976
+ return hash(self.typ)
977
+
769
978
  def _stringify(self, transform: StringifyTransform) -> str:
770
979
  return "sizeof(" + transform(self.typ) + ")"
771
980
 
@@ -784,6 +993,14 @@ class ASTSizeofExpr(ASTExpression):
784
993
  def __init__(self, expr: ASTExpression) -> None:
785
994
  self.expr = expr
786
995
 
996
+ def __eq__(self, other: object) -> bool:
997
+ if not isinstance(other, ASTSizeofExpr):
998
+ return NotImplemented
999
+ return self.expr == other.expr
1000
+
1001
+ def __hash__(self) -> int:
1002
+ return hash(self.expr)
1003
+
787
1004
  def _stringify(self, transform: StringifyTransform) -> str:
788
1005
  return "sizeof " + transform(self.expr)
789
1006
 
@@ -801,6 +1018,14 @@ class ASTAlignofExpr(ASTExpression):
801
1018
  def __init__(self, typ: ASTType) -> None:
802
1019
  self.typ = typ
803
1020
 
1021
+ def __eq__(self, other: object) -> bool:
1022
+ if not isinstance(other, ASTAlignofExpr):
1023
+ return NotImplemented
1024
+ return self.typ == other.typ
1025
+
1026
+ def __hash__(self) -> int:
1027
+ return hash(self.typ)
1028
+
804
1029
  def _stringify(self, transform: StringifyTransform) -> str:
805
1030
  return "alignof(" + transform(self.typ) + ")"
806
1031
 
@@ -819,6 +1044,14 @@ class ASTNoexceptExpr(ASTExpression):
819
1044
  def __init__(self, expr: ASTExpression) -> None:
820
1045
  self.expr = expr
821
1046
 
1047
+ def __eq__(self, other: object) -> bool:
1048
+ if not isinstance(other, ASTNoexceptExpr):
1049
+ return NotImplemented
1050
+ return self.expr == other.expr
1051
+
1052
+ def __hash__(self) -> int:
1053
+ return hash(self.expr)
1054
+
822
1055
  def _stringify(self, transform: StringifyTransform) -> str:
823
1056
  return 'noexcept(' + transform(self.expr) + ')'
824
1057
 
@@ -841,6 +1074,19 @@ class ASTNewExpr(ASTExpression):
841
1074
  self.typ = typ
842
1075
  self.initList = initList
843
1076
 
1077
+ def __eq__(self, other: object) -> bool:
1078
+ if not isinstance(other, ASTNewExpr):
1079
+ return NotImplemented
1080
+ return (
1081
+ self.rooted == other.rooted
1082
+ and self.isNewTypeId == other.isNewTypeId
1083
+ and self.typ == other.typ
1084
+ and self.initList == other.initList
1085
+ )
1086
+
1087
+ def __hash__(self) -> int:
1088
+ return hash((self.rooted, self.isNewTypeId, self.typ, self.initList))
1089
+
844
1090
  def _stringify(self, transform: StringifyTransform) -> str:
845
1091
  res = []
846
1092
  if self.rooted:
@@ -888,6 +1134,18 @@ class ASTDeleteExpr(ASTExpression):
888
1134
  self.array = array
889
1135
  self.expr = expr
890
1136
 
1137
+ def __eq__(self, other: object) -> bool:
1138
+ if not isinstance(other, ASTDeleteExpr):
1139
+ return NotImplemented
1140
+ return (
1141
+ self.rooted == other.rooted
1142
+ and self.array == other.array
1143
+ and self.expr == other.expr
1144
+ )
1145
+
1146
+ def __hash__(self) -> int:
1147
+ return hash((self.rooted, self.array, self.expr))
1148
+
891
1149
  def _stringify(self, transform: StringifyTransform) -> str:
892
1150
  res = []
893
1151
  if self.rooted:
@@ -925,6 +1183,17 @@ class ASTCastExpr(ASTExpression):
925
1183
  self.typ = typ
926
1184
  self.expr = expr
927
1185
 
1186
+ def __eq__(self, other: object) -> bool:
1187
+ if not isinstance(other, ASTCastExpr):
1188
+ return NotImplemented
1189
+ return (
1190
+ self.typ == other.typ
1191
+ and self.expr == other.expr
1192
+ )
1193
+
1194
+ def __hash__(self) -> int:
1195
+ return hash((self.typ, self.expr))
1196
+
928
1197
  def _stringify(self, transform: StringifyTransform) -> str:
929
1198
  res = ['(']
930
1199
  res.append(transform(self.typ))
@@ -950,6 +1219,17 @@ class ASTBinOpExpr(ASTExpression):
950
1219
  self.exprs = exprs
951
1220
  self.ops = ops
952
1221
 
1222
+ def __eq__(self, other: object) -> bool:
1223
+ if not isinstance(other, ASTBinOpExpr):
1224
+ return NotImplemented
1225
+ return (
1226
+ self.exprs == other.exprs
1227
+ and self.ops == other.ops
1228
+ )
1229
+
1230
+ def __hash__(self) -> int:
1231
+ return hash((self.exprs, self.ops))
1232
+
953
1233
  def _stringify(self, transform: StringifyTransform) -> str:
954
1234
  res = []
955
1235
  res.append(transform(self.exprs[0]))
@@ -990,6 +1270,18 @@ class ASTConditionalExpr(ASTExpression):
990
1270
  self.thenExpr = thenExpr
991
1271
  self.elseExpr = elseExpr
992
1272
 
1273
+ def __eq__(self, other: object) -> bool:
1274
+ if not isinstance(other, ASTConditionalExpr):
1275
+ return NotImplemented
1276
+ return (
1277
+ self.ifExpr == other.ifExpr
1278
+ and self.thenExpr == other.thenExpr
1279
+ and self.elseExpr == other.elseExpr
1280
+ )
1281
+
1282
+ def __hash__(self) -> int:
1283
+ return hash((self.ifExpr, self.thenExpr, self.elseExpr))
1284
+
993
1285
  def _stringify(self, transform: StringifyTransform) -> str:
994
1286
  res = []
995
1287
  res.append(transform(self.ifExpr))
@@ -1027,6 +1319,14 @@ class ASTBracedInitList(ASTBase):
1027
1319
  self.exprs = exprs
1028
1320
  self.trailingComma = trailingComma
1029
1321
 
1322
+ def __eq__(self, other: object) -> bool:
1323
+ if not isinstance(other, ASTBracedInitList):
1324
+ return NotImplemented
1325
+ return self.exprs == other.exprs and self.trailingComma == other.trailingComma
1326
+
1327
+ def __hash__(self) -> int:
1328
+ return hash((self.exprs, self.trailingComma))
1329
+
1030
1330
  def get_id(self, version: int) -> str:
1031
1331
  return "il%sE" % ''.join(e.get_id(version) for e in self.exprs)
1032
1332
 
@@ -1059,6 +1359,18 @@ class ASTAssignmentExpr(ASTExpression):
1059
1359
  self.op = op
1060
1360
  self.rightExpr = rightExpr
1061
1361
 
1362
+ def __eq__(self, other: object) -> bool:
1363
+ if not isinstance(other, ASTAssignmentExpr):
1364
+ return NotImplemented
1365
+ return (
1366
+ self.leftExpr == other.leftExpr
1367
+ and self.op == other.op
1368
+ and self.rightExpr == other.rightExpr
1369
+ )
1370
+
1371
+ def __hash__(self) -> int:
1372
+ return hash((self.leftExpr, self.op, self.rightExpr))
1373
+
1062
1374
  def _stringify(self, transform: StringifyTransform) -> str:
1063
1375
  res = []
1064
1376
  res.append(transform(self.leftExpr))
@@ -1093,6 +1405,14 @@ class ASTCommaExpr(ASTExpression):
1093
1405
  assert len(exprs) > 0
1094
1406
  self.exprs = exprs
1095
1407
 
1408
+ def __eq__(self, other: object) -> bool:
1409
+ if not isinstance(other, ASTCommaExpr):
1410
+ return NotImplemented
1411
+ return self.exprs == other.exprs
1412
+
1413
+ def __hash__(self) -> int:
1414
+ return hash(self.exprs)
1415
+
1096
1416
  def _stringify(self, transform: StringifyTransform) -> str:
1097
1417
  return ', '.join(transform(e) for e in self.exprs)
1098
1418
 
@@ -1118,6 +1438,14 @@ class ASTFallbackExpr(ASTExpression):
1118
1438
  def __init__(self, expr: str) -> None:
1119
1439
  self.expr = expr
1120
1440
 
1441
+ def __eq__(self, other: object) -> bool:
1442
+ if not isinstance(other, ASTFallbackExpr):
1443
+ return NotImplemented
1444
+ return self.expr == other.expr
1445
+
1446
+ def __hash__(self) -> int:
1447
+ return hash(self.expr)
1448
+
1121
1449
  def _stringify(self, transform: StringifyTransform) -> str:
1122
1450
  return self.expr
1123
1451
 
@@ -1137,11 +1465,16 @@ class ASTFallbackExpr(ASTExpression):
1137
1465
  ################################################################################
1138
1466
 
1139
1467
  class ASTOperator(ASTBase):
1468
+ is_anonymous: ClassVar[Literal[False]] = False
1469
+
1140
1470
  def __eq__(self, other: object) -> bool:
1141
1471
  raise NotImplementedError(repr(self))
1142
1472
 
1473
+ def __hash__(self) -> int:
1474
+ raise NotImplementedError(repr(self))
1475
+
1143
1476
  def is_anon(self) -> bool:
1144
- return False
1477
+ return self.is_anonymous
1145
1478
 
1146
1479
  def is_operator(self) -> bool:
1147
1480
  return True
@@ -1193,6 +1526,9 @@ class ASTOperatorBuildIn(ASTOperator):
1193
1526
  return NotImplemented
1194
1527
  return self.op == other.op
1195
1528
 
1529
+ def __hash__(self) -> int:
1530
+ return hash(self.op)
1531
+
1196
1532
  def get_id(self, version: int) -> str:
1197
1533
  if version == 1:
1198
1534
  ids = _id_operator_v1
@@ -1228,6 +1564,9 @@ class ASTOperatorLiteral(ASTOperator):
1228
1564
  return NotImplemented
1229
1565
  return self.identifier == other.identifier
1230
1566
 
1567
+ def __hash__(self) -> int:
1568
+ return hash(self.identifier)
1569
+
1231
1570
  def get_id(self, version: int) -> str:
1232
1571
  if version == 1:
1233
1572
  raise NoOldIdError
@@ -1252,6 +1591,9 @@ class ASTOperatorType(ASTOperator):
1252
1591
  return NotImplemented
1253
1592
  return self.type == other.type
1254
1593
 
1594
+ def __hash__(self) -> int:
1595
+ return hash(self.type)
1596
+
1255
1597
  def get_id(self, version: int) -> str:
1256
1598
  if version == 1:
1257
1599
  return 'castto-%s-operator' % self.type.get_id(version)
@@ -1275,6 +1617,14 @@ class ASTTemplateArgConstant(ASTBase):
1275
1617
  def __init__(self, value: ASTExpression) -> None:
1276
1618
  self.value = value
1277
1619
 
1620
+ def __eq__(self, other: object) -> bool:
1621
+ if not isinstance(other, ASTTemplateArgConstant):
1622
+ return NotImplemented
1623
+ return self.value == other.value
1624
+
1625
+ def __hash__(self) -> int:
1626
+ return hash(self.value)
1627
+
1278
1628
  def _stringify(self, transform: StringifyTransform) -> str:
1279
1629
  return transform(self.value)
1280
1630
 
@@ -1298,6 +1648,14 @@ class ASTTemplateArgs(ASTBase):
1298
1648
  self.args = args
1299
1649
  self.packExpansion = packExpansion
1300
1650
 
1651
+ def __eq__(self, other: object) -> bool:
1652
+ if not isinstance(other, ASTTemplateArgs):
1653
+ return NotImplemented
1654
+ return self.args == other.args and self.packExpansion == other.packExpansion
1655
+
1656
+ def __hash__(self) -> int:
1657
+ return hash((self.args, self.packExpansion))
1658
+
1301
1659
  def get_id(self, version: int) -> str:
1302
1660
  if version == 1:
1303
1661
  res = []
@@ -1361,6 +1719,14 @@ class ASTTrailingTypeSpecFundamental(ASTTrailingTypeSpec):
1361
1719
  # the canonical name list is for ID lookup
1362
1720
  self.canonNames = canonNames
1363
1721
 
1722
+ def __eq__(self, other: object) -> bool:
1723
+ if not isinstance(other, ASTTrailingTypeSpecFundamental):
1724
+ return NotImplemented
1725
+ return self.names == other.names and self.canonNames == other.canonNames
1726
+
1727
+ def __hash__(self) -> int:
1728
+ return hash((self.names, self.canonNames))
1729
+
1364
1730
  def _stringify(self, transform: StringifyTransform) -> str:
1365
1731
  return ' '.join(self.names)
1366
1732
 
@@ -1394,6 +1760,12 @@ class ASTTrailingTypeSpecFundamental(ASTTrailingTypeSpec):
1394
1760
 
1395
1761
 
1396
1762
  class ASTTrailingTypeSpecDecltypeAuto(ASTTrailingTypeSpec):
1763
+ def __eq__(self, other: object) -> bool:
1764
+ return isinstance(other, ASTTrailingTypeSpecDecltypeAuto)
1765
+
1766
+ def __hash__(self) -> int:
1767
+ return hash('decltype(auto)')
1768
+
1397
1769
  def _stringify(self, transform: StringifyTransform) -> str:
1398
1770
  return 'decltype(auto)'
1399
1771
 
@@ -1414,6 +1786,14 @@ class ASTTrailingTypeSpecDecltype(ASTTrailingTypeSpec):
1414
1786
  def __init__(self, expr: ASTExpression) -> None:
1415
1787
  self.expr = expr
1416
1788
 
1789
+ def __eq__(self, other: object) -> bool:
1790
+ if not isinstance(other, ASTTrailingTypeSpecDecltype):
1791
+ return NotImplemented
1792
+ return self.expr == other.expr
1793
+
1794
+ def __hash__(self) -> int:
1795
+ return hash(self.expr)
1796
+
1417
1797
  def _stringify(self, transform: StringifyTransform) -> str:
1418
1798
  return 'decltype(' + transform(self.expr) + ')'
1419
1799
 
@@ -1437,6 +1817,18 @@ class ASTTrailingTypeSpecName(ASTTrailingTypeSpec):
1437
1817
  self.nestedName = nestedName
1438
1818
  self.placeholderType = placeholderType
1439
1819
 
1820
+ def __eq__(self, other: object) -> bool:
1821
+ if not isinstance(other, ASTTrailingTypeSpecName):
1822
+ return NotImplemented
1823
+ return (
1824
+ self.prefix == other.prefix
1825
+ and self.nestedName == other.nestedName
1826
+ and self.placeholderType == other.placeholderType
1827
+ )
1828
+
1829
+ def __hash__(self) -> int:
1830
+ return hash((self.prefix, self.nestedName, self.placeholderType))
1831
+
1440
1832
  @property
1441
1833
  def name(self) -> ASTNestedName:
1442
1834
  return self.nestedName
@@ -1480,6 +1872,14 @@ class ASTFunctionParameter(ASTBase):
1480
1872
  self.arg = arg
1481
1873
  self.ellipsis = ellipsis
1482
1874
 
1875
+ def __eq__(self, other: object) -> bool:
1876
+ if not isinstance(other, ASTFunctionParameter):
1877
+ return NotImplemented
1878
+ return self.arg == other.arg and self.ellipsis == other.ellipsis
1879
+
1880
+ def __hash__(self) -> int:
1881
+ return hash((self.arg, self.ellipsis))
1882
+
1483
1883
  def get_id(
1484
1884
  self, version: int, objectType: str | None = None, symbol: Symbol | None = None,
1485
1885
  ) -> str:
@@ -1512,6 +1912,14 @@ class ASTNoexceptSpec(ASTBase):
1512
1912
  def __init__(self, expr: ASTExpression | None) -> None:
1513
1913
  self.expr = expr
1514
1914
 
1915
+ def __eq__(self, other: object) -> bool:
1916
+ if not isinstance(other, ASTNoexceptSpec):
1917
+ return NotImplemented
1918
+ return self.expr == other.expr
1919
+
1920
+ def __hash__(self) -> int:
1921
+ return hash(self.expr)
1922
+
1515
1923
  def _stringify(self, transform: StringifyTransform) -> str:
1516
1924
  if self.expr:
1517
1925
  return 'noexcept(' + transform(self.expr) + ')'
@@ -1543,6 +1951,28 @@ class ASTParametersQualifiers(ASTBase):
1543
1951
  self.attrs = attrs
1544
1952
  self.initializer = initializer
1545
1953
 
1954
+ def __eq__(self, other: object) -> bool:
1955
+ if not isinstance(other, ASTParametersQualifiers):
1956
+ return NotImplemented
1957
+ return (
1958
+ self.args == other.args
1959
+ and self.volatile == other.volatile
1960
+ and self.const == other.const
1961
+ and self.refQual == other.refQual
1962
+ and self.exceptionSpec == other.exceptionSpec
1963
+ and self.trailingReturn == other.trailingReturn
1964
+ and self.override == other.override
1965
+ and self.final == other.final
1966
+ and self.attrs == other.attrs
1967
+ and self.initializer == other.initializer
1968
+ )
1969
+
1970
+ def __hash__(self) -> int:
1971
+ return hash((
1972
+ self.args, self.volatile, self.const, self.refQual, self.exceptionSpec,
1973
+ self.trailingReturn, self.override, self.final, self.attrs, self.initializer
1974
+ ))
1975
+
1546
1976
  @property
1547
1977
  def function_params(self) -> list[ASTFunctionParameter]:
1548
1978
  return self.args
@@ -1681,6 +2111,14 @@ class ASTExplicitSpec(ASTBase):
1681
2111
  def __init__(self, expr: ASTExpression | None) -> None:
1682
2112
  self.expr = expr
1683
2113
 
2114
+ def __eq__(self, other: object) -> bool:
2115
+ if not isinstance(other, ASTExplicitSpec):
2116
+ return NotImplemented
2117
+ return self.expr == other.expr
2118
+
2119
+ def __hash__(self) -> int:
2120
+ return hash(self.expr)
2121
+
1684
2122
  def _stringify(self, transform: StringifyTransform) -> str:
1685
2123
  res = ['explicit']
1686
2124
  if self.expr is not None:
@@ -1717,6 +2155,40 @@ class ASTDeclSpecsSimple(ASTBase):
1717
2155
  self.friend = friend
1718
2156
  self.attrs = attrs
1719
2157
 
2158
+ def __eq__(self, other: object) -> bool:
2159
+ if not isinstance(other, ASTDeclSpecsSimple):
2160
+ return NotImplemented
2161
+ return (
2162
+ self.storage == other.storage
2163
+ and self.threadLocal == other.threadLocal
2164
+ and self.inline == other.inline
2165
+ and self.virtual == other.virtual
2166
+ and self.explicitSpec == other.explicitSpec
2167
+ and self.consteval == other.consteval
2168
+ and self.constexpr == other.constexpr
2169
+ and self.constinit == other.constinit
2170
+ and self.volatile == other.volatile
2171
+ and self.const == other.const
2172
+ and self.friend == other.friend
2173
+ and self.attrs == other.attrs
2174
+ )
2175
+
2176
+ def __hash__(self) -> int:
2177
+ return hash((
2178
+ self.storage,
2179
+ self.threadLocal,
2180
+ self.inline,
2181
+ self.virtual,
2182
+ self.explicitSpec,
2183
+ self.consteval,
2184
+ self.constexpr,
2185
+ self.constinit,
2186
+ self.volatile,
2187
+ self.const,
2188
+ self.friend,
2189
+ self.attrs,
2190
+ ))
2191
+
1720
2192
  def mergeWith(self, other: ASTDeclSpecsSimple) -> ASTDeclSpecsSimple:
1721
2193
  if not other:
1722
2194
  return self
@@ -1811,6 +2283,24 @@ class ASTDeclSpecs(ASTBase):
1811
2283
  self.allSpecs = self.leftSpecs.mergeWith(self.rightSpecs)
1812
2284
  self.trailingTypeSpec = trailing
1813
2285
 
2286
+ def __eq__(self, other: object) -> bool:
2287
+ if not isinstance(other, ASTDeclSpecs):
2288
+ return NotImplemented
2289
+ return (
2290
+ self.outer == other.outer
2291
+ and self.leftSpecs == other.leftSpecs
2292
+ and self.rightSpecs == other.rightSpecs
2293
+ and self.trailingTypeSpec == other.trailingTypeSpec
2294
+ )
2295
+
2296
+ def __hash__(self) -> int:
2297
+ return hash((
2298
+ self.outer,
2299
+ self.leftSpecs,
2300
+ self.rightSpecs,
2301
+ self.trailingTypeSpec,
2302
+ ))
2303
+
1814
2304
  def get_id(self, version: int) -> str:
1815
2305
  if version == 1:
1816
2306
  res = []
@@ -1873,6 +2363,14 @@ class ASTArray(ASTBase):
1873
2363
  def __init__(self, size: ASTExpression) -> None:
1874
2364
  self.size = size
1875
2365
 
2366
+ def __eq__(self, other: object) -> bool:
2367
+ if not isinstance(other, ASTArray):
2368
+ return NotImplemented
2369
+ return self.size == other.size
2370
+
2371
+ def __hash__(self) -> int:
2372
+ return hash(self.size)
2373
+
1876
2374
  def _stringify(self, transform: StringifyTransform) -> str:
1877
2375
  if self.size:
1878
2376
  return '[' + transform(self.size) + ']'
@@ -1953,6 +2451,18 @@ class ASTDeclaratorNameParamQual(ASTDeclarator):
1953
2451
  self.arrayOps = arrayOps
1954
2452
  self.paramQual = paramQual
1955
2453
 
2454
+ def __eq__(self, other: object) -> bool:
2455
+ if not isinstance(other, ASTDeclaratorNameParamQual):
2456
+ return NotImplemented
2457
+ return (
2458
+ self.declId == other.declId
2459
+ and self.arrayOps == other.arrayOps
2460
+ and self.paramQual == other.paramQual
2461
+ )
2462
+
2463
+ def __hash__(self) -> int:
2464
+ return hash((self.declId, self.arrayOps, self.paramQual))
2465
+
1956
2466
  @property
1957
2467
  def name(self) -> ASTNestedName:
1958
2468
  return self.declId
@@ -2037,6 +2547,14 @@ class ASTDeclaratorNameBitField(ASTDeclarator):
2037
2547
  self.declId = declId
2038
2548
  self.size = size
2039
2549
 
2550
+ def __eq__(self, other: object) -> bool:
2551
+ if not isinstance(other, ASTDeclaratorNameBitField):
2552
+ return NotImplemented
2553
+ return self.declId == other.declId and self.size == other.size
2554
+
2555
+ def __hash__(self) -> int:
2556
+ return hash((self.declId, self.size))
2557
+
2040
2558
  @property
2041
2559
  def name(self) -> ASTNestedName:
2042
2560
  return self.declId
@@ -2087,6 +2605,19 @@ class ASTDeclaratorPtr(ASTDeclarator):
2087
2605
  self.const = const
2088
2606
  self.attrs = attrs
2089
2607
 
2608
+ def __eq__(self, other: object) -> bool:
2609
+ if not isinstance(other, ASTDeclaratorPtr):
2610
+ return NotImplemented
2611
+ return (
2612
+ self.next == other.next
2613
+ and self.volatile == other.volatile
2614
+ and self.const == other.const
2615
+ and self.attrs == other.attrs
2616
+ )
2617
+
2618
+ def __hash__(self) -> int:
2619
+ return hash((self.next, self.volatile, self.const, self.attrs))
2620
+
2090
2621
  @property
2091
2622
  def name(self) -> ASTNestedName:
2092
2623
  return self.next.name
@@ -2192,6 +2723,14 @@ class ASTDeclaratorRef(ASTDeclarator):
2192
2723
  self.next = next
2193
2724
  self.attrs = attrs
2194
2725
 
2726
+ def __eq__(self, other: object) -> bool:
2727
+ if not isinstance(other, ASTDeclaratorRef):
2728
+ return NotImplemented
2729
+ return self.next == other.next and self.attrs == other.attrs
2730
+
2731
+ def __hash__(self) -> int:
2732
+ return hash((self.next, self.attrs))
2733
+
2195
2734
  @property
2196
2735
  def name(self) -> ASTNestedName:
2197
2736
  return self.next.name
@@ -2258,6 +2797,14 @@ class ASTDeclaratorParamPack(ASTDeclarator):
2258
2797
  assert next
2259
2798
  self.next = next
2260
2799
 
2800
+ def __eq__(self, other: object) -> bool:
2801
+ if not isinstance(other, ASTDeclaratorParamPack):
2802
+ return NotImplemented
2803
+ return self.next == other.next
2804
+
2805
+ def __hash__(self) -> int:
2806
+ return hash(self.next)
2807
+
2261
2808
  @property
2262
2809
  def name(self) -> ASTNestedName:
2263
2810
  return self.next.name
@@ -2326,6 +2873,19 @@ class ASTDeclaratorMemPtr(ASTDeclarator):
2326
2873
  self.volatile = volatile
2327
2874
  self.next = next
2328
2875
 
2876
+ def __eq__(self, other: object) -> bool:
2877
+ if not isinstance(other, ASTDeclaratorMemPtr):
2878
+ return NotImplemented
2879
+ return (
2880
+ self.className == other.className
2881
+ and self.const == other.const
2882
+ and self.volatile == other.volatile
2883
+ and self.next == other.next
2884
+ )
2885
+
2886
+ def __hash__(self) -> int:
2887
+ return hash((self.className, self.const, self.volatile, self.next))
2888
+
2329
2889
  @property
2330
2890
  def name(self) -> ASTNestedName:
2331
2891
  return self.next.name
@@ -2424,6 +2984,14 @@ class ASTDeclaratorParen(ASTDeclarator):
2424
2984
  self.next = next
2425
2985
  # TODO: we assume the name, params, and qualifiers are in inner
2426
2986
 
2987
+ def __eq__(self, other: object) -> bool:
2988
+ if not isinstance(other, ASTDeclaratorParen):
2989
+ return NotImplemented
2990
+ return self.inner == other.inner and self.next == other.next
2991
+
2992
+ def __hash__(self) -> int:
2993
+ return hash((self.inner, self.next))
2994
+
2427
2995
  @property
2428
2996
  def name(self) -> ASTNestedName:
2429
2997
  return self.inner.name
@@ -2493,6 +3061,14 @@ class ASTPackExpansionExpr(ASTExpression):
2493
3061
  def __init__(self, expr: ASTExpression | ASTBracedInitList) -> None:
2494
3062
  self.expr = expr
2495
3063
 
3064
+ def __eq__(self, other: object) -> bool:
3065
+ if not isinstance(other, ASTPackExpansionExpr):
3066
+ return NotImplemented
3067
+ return self.expr == other.expr
3068
+
3069
+ def __hash__(self) -> int:
3070
+ return hash(self.expr)
3071
+
2496
3072
  def _stringify(self, transform: StringifyTransform) -> str:
2497
3073
  return transform(self.expr) + '...'
2498
3074
 
@@ -2510,6 +3086,14 @@ class ASTParenExprList(ASTBaseParenExprList):
2510
3086
  def __init__(self, exprs: list[ASTExpression | ASTBracedInitList]) -> None:
2511
3087
  self.exprs = exprs
2512
3088
 
3089
+ def __eq__(self, other: object) -> bool:
3090
+ if not isinstance(other, ASTParenExprList):
3091
+ return NotImplemented
3092
+ return self.exprs == other.exprs
3093
+
3094
+ def __hash__(self) -> int:
3095
+ return hash(self.exprs)
3096
+
2513
3097
  def get_id(self, version: int) -> str:
2514
3098
  return "pi%sE" % ''.join(e.get_id(version) for e in self.exprs)
2515
3099
 
@@ -2538,6 +3122,14 @@ class ASTInitializer(ASTBase):
2538
3122
  self.value = value
2539
3123
  self.hasAssign = hasAssign
2540
3124
 
3125
+ def __eq__(self, other: object) -> bool:
3126
+ if not isinstance(other, ASTInitializer):
3127
+ return NotImplemented
3128
+ return self.value == other.value and self.hasAssign == other.hasAssign
3129
+
3130
+ def __hash__(self) -> int:
3131
+ return hash((self.value, self.hasAssign))
3132
+
2541
3133
  def _stringify(self, transform: StringifyTransform) -> str:
2542
3134
  val = transform(self.value)
2543
3135
  if self.hasAssign:
@@ -2562,6 +3154,14 @@ class ASTType(ASTBase):
2562
3154
  self.declSpecs = declSpecs
2563
3155
  self.decl = decl
2564
3156
 
3157
+ def __eq__(self, other: object) -> bool:
3158
+ if not isinstance(other, ASTType):
3159
+ return NotImplemented
3160
+ return self.declSpecs == other.declSpecs and self.decl == other.decl
3161
+
3162
+ def __hash__(self) -> int:
3163
+ return hash((self.declSpecs, self.decl))
3164
+
2565
3165
  @property
2566
3166
  def name(self) -> ASTNestedName:
2567
3167
  return self.decl.name
@@ -2671,6 +3271,14 @@ class ASTTemplateParamConstrainedTypeWithInit(ASTBase):
2671
3271
  self.type = type
2672
3272
  self.init = init
2673
3273
 
3274
+ def __eq__(self, other: object) -> bool:
3275
+ if not isinstance(other, ASTTemplateParamConstrainedTypeWithInit):
3276
+ return NotImplemented
3277
+ return self.type == other.type and self.init == other.init
3278
+
3279
+ def __hash__(self) -> int:
3280
+ return hash((self.type, self.init))
3281
+
2674
3282
  @property
2675
3283
  def name(self) -> ASTNestedName:
2676
3284
  return self.type.name
@@ -2712,6 +3320,14 @@ class ASTTypeWithInit(ASTBase):
2712
3320
  self.type = type
2713
3321
  self.init = init
2714
3322
 
3323
+ def __eq__(self, other: object) -> bool:
3324
+ if not isinstance(other, ASTTypeWithInit):
3325
+ return NotImplemented
3326
+ return self.type == other.type and self.init == other.init
3327
+
3328
+ def __hash__(self) -> int:
3329
+ return hash((self.type, self.init))
3330
+
2715
3331
  @property
2716
3332
  def name(self) -> ASTNestedName:
2717
3333
  return self.type.name
@@ -2749,6 +3365,14 @@ class ASTTypeUsing(ASTBase):
2749
3365
  self.name = name
2750
3366
  self.type = type
2751
3367
 
3368
+ def __eq__(self, other: object) -> bool:
3369
+ if not isinstance(other, ASTTypeUsing):
3370
+ return NotImplemented
3371
+ return self.name == other.name and self.type == other.type
3372
+
3373
+ def __hash__(self) -> int:
3374
+ return hash((self.name, self.type))
3375
+
2752
3376
  def get_id(self, version: int, objectType: str | None = None,
2753
3377
  symbol: Symbol | None = None) -> str:
2754
3378
  if version == 1:
@@ -2785,6 +3409,14 @@ class ASTConcept(ASTBase):
2785
3409
  self.nestedName = nestedName
2786
3410
  self.initializer = initializer
2787
3411
 
3412
+ def __eq__(self, other: object) -> bool:
3413
+ if not isinstance(other, ASTConcept):
3414
+ return NotImplemented
3415
+ return self.nestedName == other.nestedName and self.initializer == other.initializer
3416
+
3417
+ def __hash__(self) -> int:
3418
+ return hash((self.nestedName, self.initializer))
3419
+
2788
3420
  @property
2789
3421
  def name(self) -> ASTNestedName:
2790
3422
  return self.nestedName
@@ -2816,6 +3448,19 @@ class ASTBaseClass(ASTBase):
2816
3448
  self.virtual = virtual
2817
3449
  self.pack = pack
2818
3450
 
3451
+ def __eq__(self, other: object) -> bool:
3452
+ if not isinstance(other, ASTBaseClass):
3453
+ return NotImplemented
3454
+ return (
3455
+ self.name == other.name
3456
+ and self.visibility == other.visibility
3457
+ and self.virtual == other.virtual
3458
+ and self.pack == other.pack
3459
+ )
3460
+
3461
+ def __hash__(self) -> int:
3462
+ return hash((self.name, self.visibility, self.virtual, self.pack))
3463
+
2819
3464
  def _stringify(self, transform: StringifyTransform) -> str:
2820
3465
  res = []
2821
3466
  if self.visibility is not None:
@@ -2851,6 +3496,19 @@ class ASTClass(ASTBase):
2851
3496
  self.bases = bases
2852
3497
  self.attrs = attrs
2853
3498
 
3499
+ def __eq__(self, other: object) -> bool:
3500
+ if not isinstance(other, ASTClass):
3501
+ return NotImplemented
3502
+ return (
3503
+ self.name == other.name
3504
+ and self.final == other.final
3505
+ and self.bases == other.bases
3506
+ and self.attrs == other.attrs
3507
+ )
3508
+
3509
+ def __hash__(self) -> int:
3510
+ return hash((self.name, self.final, self.bases, self.attrs))
3511
+
2854
3512
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
2855
3513
  return symbol.get_full_nested_name().get_id(version)
2856
3514
 
@@ -2899,6 +3557,14 @@ class ASTUnion(ASTBase):
2899
3557
  self.name = name
2900
3558
  self.attrs = attrs
2901
3559
 
3560
+ def __eq__(self, other: object) -> bool:
3561
+ if not isinstance(other, ASTUnion):
3562
+ return NotImplemented
3563
+ return self.name == other.name and self.attrs == other.attrs
3564
+
3565
+ def __hash__(self) -> int:
3566
+ return hash((self.name, self.attrs))
3567
+
2902
3568
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
2903
3569
  if version == 1:
2904
3570
  raise NoOldIdError
@@ -2929,6 +3595,19 @@ class ASTEnum(ASTBase):
2929
3595
  self.underlyingType = underlyingType
2930
3596
  self.attrs = attrs
2931
3597
 
3598
+ def __eq__(self, other: object) -> bool:
3599
+ if not isinstance(other, ASTEnum):
3600
+ return NotImplemented
3601
+ return (
3602
+ self.name == other.name
3603
+ and self.scoped == other.scoped
3604
+ and self.underlyingType == other.underlyingType
3605
+ and self.attrs == other.attrs
3606
+ )
3607
+
3608
+ def __hash__(self) -> int:
3609
+ return hash((self.name, self.scoped, self.underlyingType, self.attrs))
3610
+
2932
3611
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
2933
3612
  if version == 1:
2934
3613
  raise NoOldIdError
@@ -2971,6 +3650,18 @@ class ASTEnumerator(ASTBase):
2971
3650
  self.init = init
2972
3651
  self.attrs = attrs
2973
3652
 
3653
+ def __eq__(self, other: object) -> bool:
3654
+ if not isinstance(other, ASTEnumerator):
3655
+ return NotImplemented
3656
+ return (
3657
+ self.name == other.name
3658
+ and self.init == other.init
3659
+ and self.attrs == other.attrs
3660
+ )
3661
+
3662
+ def __hash__(self) -> int:
3663
+ return hash((self.name, self.init, self.attrs))
3664
+
2974
3665
  def get_id(self, version: int, objectType: str, symbol: Symbol) -> str:
2975
3666
  if version == 1:
2976
3667
  raise NoOldIdError
@@ -3035,6 +3726,19 @@ class ASTTemplateKeyParamPackIdDefault(ASTTemplateParam):
3035
3726
  self.parameterPack = parameterPack
3036
3727
  self.default = default
3037
3728
 
3729
+ def __eq__(self, other: object) -> bool:
3730
+ if not isinstance(other, ASTTemplateKeyParamPackIdDefault):
3731
+ return NotImplemented
3732
+ return (
3733
+ self.key == other.key
3734
+ and self.identifier == other.identifier
3735
+ and self.parameterPack == other.parameterPack
3736
+ and self.default == other.default
3737
+ )
3738
+
3739
+ def __hash__(self) -> int:
3740
+ return hash((self.key, self.identifier, self.parameterPack, self.default))
3741
+
3038
3742
  def get_identifier(self) -> ASTIdentifier:
3039
3743
  return self.identifier
3040
3744
 
@@ -3086,6 +3790,14 @@ class ASTTemplateParamType(ASTTemplateParam):
3086
3790
  assert data
3087
3791
  self.data = data
3088
3792
 
3793
+ def __eq__(self, other: object) -> bool:
3794
+ if not isinstance(other, ASTTemplateParamType):
3795
+ return NotImplemented
3796
+ return self.data == other.data
3797
+
3798
+ def __hash__(self) -> int:
3799
+ return hash(self.data)
3800
+
3089
3801
  @property
3090
3802
  def name(self) -> ASTNestedName:
3091
3803
  id = self.get_identifier()
@@ -3125,6 +3837,17 @@ class ASTTemplateParamTemplateType(ASTTemplateParam):
3125
3837
  self.nestedParams = nestedParams
3126
3838
  self.data = data
3127
3839
 
3840
+ def __eq__(self, other: object) -> bool:
3841
+ if not isinstance(other, ASTTemplateParamTemplateType):
3842
+ return NotImplemented
3843
+ return (
3844
+ self.nestedParams == other.nestedParams
3845
+ and self.data == other.data
3846
+ )
3847
+
3848
+ def __hash__(self) -> int:
3849
+ return hash((self.nestedParams, self.data))
3850
+
3128
3851
  @property
3129
3852
  def name(self) -> ASTNestedName:
3130
3853
  id = self.get_identifier()
@@ -3166,6 +3889,14 @@ class ASTTemplateParamNonType(ASTTemplateParam):
3166
3889
  self.param = param
3167
3890
  self.parameterPack = parameterPack
3168
3891
 
3892
+ def __eq__(self, other: object) -> bool:
3893
+ if not isinstance(other, ASTTemplateParamNonType):
3894
+ return NotImplemented
3895
+ return (
3896
+ self.param == other.param
3897
+ and self.parameterPack == other.parameterPack
3898
+ )
3899
+
3169
3900
  @property
3170
3901
  def name(self) -> ASTNestedName:
3171
3902
  id = self.get_identifier()
@@ -3221,6 +3952,14 @@ class ASTTemplateParams(ASTBase):
3221
3952
  self.params = params
3222
3953
  self.requiresClause = requiresClause
3223
3954
 
3955
+ def __eq__(self, other: object) -> bool:
3956
+ if not isinstance(other, ASTTemplateParams):
3957
+ return NotImplemented
3958
+ return self.params == other.params and self.requiresClause == other.requiresClause
3959
+
3960
+ def __hash__(self) -> int:
3961
+ return hash((self.params, self.requiresClause))
3962
+
3224
3963
  def get_id(self, version: int, excludeRequires: bool = False) -> str:
3225
3964
  assert version >= 2
3226
3965
  res = []
@@ -3295,6 +4034,17 @@ class ASTTemplateIntroductionParameter(ASTBase):
3295
4034
  self.identifier = identifier
3296
4035
  self.parameterPack = parameterPack
3297
4036
 
4037
+ def __eq__(self, other: object) -> bool:
4038
+ if not isinstance(other, ASTTemplateIntroductionParameter):
4039
+ return NotImplemented
4040
+ return (
4041
+ self.identifier == other.identifier
4042
+ and self.parameterPack == other.parameterPack
4043
+ )
4044
+
4045
+ def __hash__(self) -> int:
4046
+ return hash((self.identifier, self.parameterPack))
4047
+
3298
4048
  @property
3299
4049
  def name(self) -> ASTNestedName:
3300
4050
  id = self.get_identifier()
@@ -3351,6 +4101,14 @@ class ASTTemplateIntroduction(ASTBase):
3351
4101
  self.concept = concept
3352
4102
  self.params = params
3353
4103
 
4104
+ def __eq__(self, other: object) -> bool:
4105
+ if not isinstance(other, ASTTemplateIntroduction):
4106
+ return NotImplemented
4107
+ return self.concept == other.concept and self.params == other.params
4108
+
4109
+ def __hash__(self) -> int:
4110
+ return hash((self.concept, self.params))
4111
+
3354
4112
  def get_id(self, version: int) -> str:
3355
4113
  assert version >= 2
3356
4114
  return ''.join([
@@ -3402,6 +4160,14 @@ class ASTTemplateDeclarationPrefix(ASTBase):
3402
4160
  # templates is None means it's an explicit instantiation of a variable
3403
4161
  self.templates = templates
3404
4162
 
4163
+ def __eq__(self, other: object) -> bool:
4164
+ if not isinstance(other, ASTTemplateDeclarationPrefix):
4165
+ return NotImplemented
4166
+ return self.templates == other.templates
4167
+
4168
+ def __hash__(self) -> int:
4169
+ return hash(self.templates)
4170
+
3405
4171
  def get_requires_clause_in_last(self) -> ASTRequiresClause | None:
3406
4172
  if self.templates is None:
3407
4173
  return None
@@ -3436,6 +4202,14 @@ class ASTRequiresClause(ASTBase):
3436
4202
  def __init__(self, expr: ASTExpression) -> None:
3437
4203
  self.expr = expr
3438
4204
 
4205
+ def __eq__(self, other: object) -> bool:
4206
+ if not isinstance(other, ASTRequiresClause):
4207
+ return NotImplemented
4208
+ return self.expr == other.expr
4209
+
4210
+ def __hash__(self) -> int:
4211
+ return hash(self.expr)
4212
+
3439
4213
  def _stringify(self, transform: StringifyTransform) -> str:
3440
4214
  return 'requires ' + transform(self.expr)
3441
4215
 
@@ -3472,6 +4246,21 @@ class ASTDeclaration(ASTBase):
3472
4246
  # further changes will be made to this object
3473
4247
  self._newest_id_cache: str | None = None
3474
4248
 
4249
+ def __eq__(self, other: object) -> bool:
4250
+ if not isinstance(other, ASTDeclaration):
4251
+ return NotImplemented
4252
+ return (
4253
+ self.objectType == other.objectType
4254
+ and self.directiveType == other.directiveType
4255
+ and self.visibility == other.visibility
4256
+ and self.templatePrefix == other.templatePrefix
4257
+ and self.declaration == other.declaration
4258
+ and self.trailingRequiresClause == other.trailingRequiresClause
4259
+ and self.semicolon == other.semicolon
4260
+ and self.symbol == other.symbol
4261
+ and self.enumeratorScopedSymbol == other.enumeratorScopedSymbol
4262
+ )
4263
+
3475
4264
  def clone(self) -> ASTDeclaration:
3476
4265
  templatePrefixClone = self.templatePrefix.clone() if self.templatePrefix else None
3477
4266
  trailingRequiresClasueClone = self.trailingRequiresClause.clone() \
@@ -3627,6 +4416,14 @@ class ASTNamespace(ASTBase):
3627
4416
  self.nestedName = nestedName
3628
4417
  self.templatePrefix = templatePrefix
3629
4418
 
4419
+ def __eq__(self, other: object) -> bool:
4420
+ if not isinstance(other, ASTNamespace):
4421
+ return NotImplemented
4422
+ return (
4423
+ self.nestedName == other.nestedName
4424
+ and self.templatePrefix == other.templatePrefix
4425
+ )
4426
+
3630
4427
  def _stringify(self, transform: StringifyTransform) -> str:
3631
4428
  res = []
3632
4429
  if self.templatePrefix: