diff --git a/TODO b/TODO new file mode 100644 index 00000000..96fdc3b2 --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +namespaces +using +lambdas +friend diff --git a/doc/cpp-testing.rst b/doc/cpp-testing.rst new file mode 100644 index 00000000..b42d2029 --- /dev/null +++ b/doc/cpp-testing.rst @@ -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::type +.. +.. A scoped enum with non-default visibility, and with a specified underlying +.. type. diff --git a/doc/index.rst b/doc/index.rst index f0f229f0..137fd26b 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -48,6 +48,7 @@ Contents: built-in-extensions tips troubleshooting + cpp-testing Indices and tables ================== diff --git a/dump_tokens.py b/dump_tokens.py new file mode 100755 index 00000000..a93d8c6b --- /dev/null +++ b/dump_tokens.py @@ -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())