Skip to content

Commit

Permalink
DELETE ME: test / debugging helper files, etc.
Browse files Browse the repository at this point in the history
Literal landfill...
  • Loading branch information
BrunoMSantos committed May 3, 2024
1 parent f77e003 commit 86dcba4
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespaces
using
lambdas
friend
49 changes: 49 additions & 0 deletions doc/cpp-testing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
C++ testing grounds
===================

Classes
-------

.. cpp:autodoc:: ../cpp/class.cpp

Structs
-------

.. cpp:autodoc:: ../cpp/struct-class.cpp

Enum class
----------

.. cpp:autodoc:: ../cpp/enum-class.cpp

Templates
---------

.. cpp:autodoc:: ../cpp/template.cpp
:clang: --std=c++17

.. A link to a struct documentation from the docs :cpp:any:`stfoo`.
..
.. .. cpp:autodoc:: test-cpp.cpp
..
.. .. cpp:autovar:: fooer
.. :file: test-cpp.cpp
..
.. .. cpp:autodoc:: enum.cpp
..
.. .. cpp:enum:: MyEnum
..
.. An unscoped enum.
..
.. .. cpp:enum:: MySpecificEnum : long
..
.. An unscoped enum with specified underlying type.
..
.. .. cpp:enum-class:: MyScopedEnum
..
.. A scoped enum.
..
.. .. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type<MySpecificEnum>::type
..
.. A scoped enum with non-default visibility, and with a specified underlying
.. type.
1 change: 1 addition & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Contents:
built-in-extensions
tips
troubleshooting
cpp-testing

Indices and tables
==================
Expand Down
55 changes: 55 additions & 0 deletions dump_tokens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env python

import functools
import sys
import textwrap

from src.hawkmoth.doccursor import *
from clang.cindex import Index, TranslationUnit

index = Index.create()

tu = index.parse(sys.argv[1], args=['-xc++'],
options=TranslationUnit.PARSE_CACHE_COMPLETION_RESULTS |
TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD |
TranslationUnit.PARSE_SKIP_FUNCTION_BODIES)

# for cc in tu.cursor.get_children():
# cursor = DocCursor(cursor=cc)
#
# # cursor2 = DocCursor(cursor=cc)
# # print(' hash:', hash(cursor) == hash(cursor2))
# # print('equality:', cursor == cursor2)
# # print(' ids:', id(cursor) == id(cursor2))
# # print('identity:', cursor is cursor2)
# # exit(0)
#
# print(cursor.kind)
# print('\t', cursor.type, cursor.name)
#
# for c in cursor.get_children():
# print('\t', c.kind)
# print('\t\t', c.type, c.name)

for cc in tu.cursor.get_children():
cursor = DocCursor(cursor=cc)
type = cursor.type
decl_name = cursor.decl_name

for c in cursor.get_children():
type = cursor.type
decl_name = cursor.decl_name

for cc in tu.cursor.get_children():
cursor = DocCursor(cursor=cc)
type = cursor.type
decl_name = cursor.decl_name

for c in cursor.get_children():
type = cursor.type
decl_name = cursor.decl_name

print(DocCursor.cache_info())
DocCursor.cache_wipe()
print()
print(DocCursor.cache_info())

0 comments on commit 86dcba4

Please sign in to comment.