rbtr-lang-cpp 2026.9.0.dev1__tar.gz

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.
Files changed (21) hide show
  1. rbtr_lang_cpp-2026.9.0.dev1/LICENSE +21 -0
  2. rbtr_lang_cpp-2026.9.0.dev1/PKG-INFO +62 -0
  3. rbtr_lang_cpp-2026.9.0.dev1/README.md +35 -0
  4. rbtr_lang_cpp-2026.9.0.dev1/pyproject.toml +59 -0
  5. rbtr_lang_cpp-2026.9.0.dev1/pyproject.toml.orig +63 -0
  6. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/__init__.py +1 -0
  7. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/cpp.scm +106 -0
  8. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/plugin.py +43 -0
  9. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/py.typed +0 -0
  10. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/__init__.py +0 -0
  11. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/__snapshots__/test_samples/test_edges_match_snapshot.json +9 -0
  12. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/__snapshots__/test_samples/test_extraction_matches_snapshot.json +667 -0
  13. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/cases_docstrings.py +58 -0
  14. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/cases_extraction.py +223 -0
  15. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/samples/cpp/cpp.cpp +63 -0
  16. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/samples/cpp/greeter.hpp +22 -0
  17. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/samples/cpp/util/text.cpp +12 -0
  18. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/samples/cpp/util/text.hpp +7 -0
  19. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/test_docstrings.py +43 -0
  20. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/test_extraction.py +43 -0
  21. rbtr_lang_cpp-2026.9.0.dev1/src/rbtr_lang_cpp/tests/test_samples.py +74 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alejandro Giacometti
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,62 @@
1
+ Metadata-Version: 2.4
2
+ Name: rbtr-lang-cpp
3
+ Version: 2026.9.0.dev1
4
+ Summary: rbtr — C++ language plugin
5
+ Keywords: code-search,code-index,tree-sitter,static-analysis,semantic-search,developer-tools,cpp,c++
6
+ Author: Alejandro Giacometti
7
+ Author-email: Alejandro Giacometti <alejandro.giacometti@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: C++
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Classifier: Topic :: Text Processing :: Indexing
17
+ Classifier: Typing :: Typed
18
+ Requires-Dist: rbtr==2026.9.0.dev1
19
+ Requires-Dist: tree-sitter-cpp
20
+ Requires-Python: >=3.13
21
+ Project-URL: Homepage, https://github.com/janrito/rbtr
22
+ Project-URL: Repository, https://github.com/janrito/rbtr
23
+ Project-URL: Documentation, https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-cpp#readme
24
+ Project-URL: Issues, https://github.com/janrito/rbtr/issues
25
+ Project-URL: Changelog, https://github.com/janrito/rbtr/releases
26
+ Description-Content-Type: text/markdown
27
+
28
+ # rbtr-lang-cpp
29
+
30
+ C++ support for [rbtr]. A **default** plugin — installed with rbtr
31
+ itself (`pip install rbtr`).
32
+
33
+ [rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
34
+
35
+ ## What it ingests
36
+
37
+ - **Functions** — free functions and function templates.
38
+ - **Classes** — classes, structs, and enums.
39
+ - **Methods** — member functions and constructors, scoped to their class.
40
+ - **Variables** — namespace-level and top-level variables.
41
+ - **Imports** — `#include` headers.
42
+
43
+ Scope uses `::` and includes the enclosing namespace.
44
+
45
+ ## Chunks produced
46
+
47
+ ```cpp
48
+ int add(int a, int b) { … } // function "add"
49
+ namespace ui { //
50
+ class Widget { void draw(); }; // class "Widget"; method "draw" scope "ui::Widget"
51
+ int count = 0; // variable "count", scope "ui"
52
+ }
53
+ #include <vector> // import, metadata {module: vector}
54
+ ```
55
+
56
+ ## Embedded / injected chunks
57
+
58
+ None. C++ does not embed other languages.
59
+
60
+ ## Grammar & dependencies
61
+
62
+ Uses the `tree-sitter-cpp` grammar. No dependency on other language plugins.
@@ -0,0 +1,35 @@
1
+ # rbtr-lang-cpp
2
+
3
+ C++ support for [rbtr]. A **default** plugin — installed with rbtr
4
+ itself (`pip install rbtr`).
5
+
6
+ [rbtr]: https://github.com/janrito/rbtr/tree/main/packages/rbtr#readme
7
+
8
+ ## What it ingests
9
+
10
+ - **Functions** — free functions and function templates.
11
+ - **Classes** — classes, structs, and enums.
12
+ - **Methods** — member functions and constructors, scoped to their class.
13
+ - **Variables** — namespace-level and top-level variables.
14
+ - **Imports** — `#include` headers.
15
+
16
+ Scope uses `::` and includes the enclosing namespace.
17
+
18
+ ## Chunks produced
19
+
20
+ ```cpp
21
+ int add(int a, int b) { … } // function "add"
22
+ namespace ui { //
23
+ class Widget { void draw(); }; // class "Widget"; method "draw" scope "ui::Widget"
24
+ int count = 0; // variable "count", scope "ui"
25
+ }
26
+ #include <vector> // import, metadata {module: vector}
27
+ ```
28
+
29
+ ## Embedded / injected chunks
30
+
31
+ None. C++ does not embed other languages.
32
+
33
+ ## Grammar & dependencies
34
+
35
+ Uses the `tree-sitter-cpp` grammar. No dependency on other language plugins.
@@ -0,0 +1,59 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.11.26,<1"]
3
+ build-backend = "uv_build"
4
+
5
+ [tool.uv.build-backend]
6
+ module-name = "rbtr_lang_cpp"
7
+
8
+ [tool.uv.sources.rbtr]
9
+ workspace = true
10
+
11
+ [project]
12
+ name = "rbtr-lang-cpp"
13
+ version = "2026.9.0-dev1"
14
+ description = "rbtr — C++ language plugin"
15
+ readme = "README.md"
16
+ license = "MIT"
17
+ license-files = ["LICENSE"]
18
+ keywords = [
19
+ "code-search",
20
+ "code-index",
21
+ "tree-sitter",
22
+ "static-analysis",
23
+ "semantic-search",
24
+ "developer-tools",
25
+ "cpp",
26
+ "c++",
27
+ ]
28
+ classifiers = [
29
+ "Development Status :: 4 - Beta",
30
+ "Intended Audience :: Developers",
31
+ "Programming Language :: C++",
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Topic :: Software Development :: Libraries",
35
+ "Topic :: Text Processing :: Indexing",
36
+ "Typing :: Typed",
37
+ ]
38
+ requires-python = ">=3.13"
39
+ dependencies = [
40
+ "rbtr==2026.9.0-dev1",
41
+ "tree-sitter-cpp",
42
+ ]
43
+
44
+ [[project.authors]]
45
+ name = "Alejandro Giacometti"
46
+ email = "alejandro.giacometti@gmail.com"
47
+
48
+ [project.urls]
49
+ Homepage = "https://github.com/janrito/rbtr"
50
+ Repository = "https://github.com/janrito/rbtr"
51
+ Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-cpp#readme"
52
+ Issues = "https://github.com/janrito/rbtr/issues"
53
+ Changelog = "https://github.com/janrito/rbtr/releases"
54
+
55
+ [project.entry-points."rbtr.languages"]
56
+ cpp = "rbtr_lang_cpp.plugin:cpp"
57
+
58
+ [dependency-groups]
59
+ dev = ["rbtr[test]"]
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.11.26,<1"]
3
+ build-backend = "uv_build"
4
+
5
+ [tool.uv.build-backend]
6
+ module-name = "rbtr_lang_cpp"
7
+ # No source-exclude: the plugin's tests, samples, and snapshots ship with
8
+ # the wheel (they are the language's golden record), and cpp.scm ships as
9
+ # package data.
10
+
11
+ [project]
12
+ name = "rbtr-lang-cpp"
13
+ version = "2026.9.0-dev1"
14
+ description = "rbtr — C++ language plugin"
15
+ readme = "README.md"
16
+ license = "MIT"
17
+ license-files = ["LICENSE"]
18
+ authors = [
19
+ { name = "Alejandro Giacometti", email = "alejandro.giacometti@gmail.com" },
20
+ ]
21
+ keywords = [
22
+ "code-search",
23
+ "code-index",
24
+ "tree-sitter",
25
+ "static-analysis",
26
+ "semantic-search",
27
+ "developer-tools",
28
+ "cpp",
29
+ "c++",
30
+ ]
31
+ classifiers = [
32
+ "Development Status :: 4 - Beta",
33
+ "Intended Audience :: Developers",
34
+ "Programming Language :: C++",
35
+ "Programming Language :: Python :: 3 :: Only",
36
+ "Programming Language :: Python :: 3.13",
37
+ "Topic :: Software Development :: Libraries",
38
+ "Topic :: Text Processing :: Indexing",
39
+ "Typing :: Typed",
40
+ ]
41
+ requires-python = ">=3.13"
42
+ dependencies = [
43
+ "rbtr==2026.9.0-dev1",
44
+ "tree-sitter-cpp",
45
+ ]
46
+
47
+ [project.urls]
48
+ Homepage = "https://github.com/janrito/rbtr"
49
+ Repository = "https://github.com/janrito/rbtr"
50
+ Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-cpp#readme"
51
+ Issues = "https://github.com/janrito/rbtr/issues"
52
+ Changelog = "https://github.com/janrito/rbtr/releases"
53
+
54
+ [project.entry-points."rbtr.languages"]
55
+ # The value resolves to the language's `LanguageRegistration` (named by its
56
+ # id) — see the rbtr ARCHITECTURE "External plugins" note.
57
+ cpp = "rbtr_lang_cpp.plugin:cpp"
58
+
59
+ [tool.uv.sources]
60
+ rbtr = { workspace = true }
61
+
62
+ [dependency-groups]
63
+ dev = ["rbtr[test]"]
@@ -0,0 +1 @@
1
+ """C++ language plugin package."""
@@ -0,0 +1,106 @@
1
+ ; Top-level comments (C++ uses one `comment` type for `//` and `/* */`).
2
+ (comment) @comment
3
+
4
+ (function_definition
5
+ declarator: (function_declarator
6
+ declarator: (identifier) @_fn_name)) @function
7
+
8
+ (function_definition
9
+ declarator: (function_declarator
10
+ declarator: (field_identifier) @_fn_name)) @function
11
+
12
+ (function_definition
13
+ declarator: (function_declarator
14
+ declarator: (operator_name) @_fn_name)) @function
15
+
16
+ (field_declaration
17
+ declarator: (function_declarator
18
+ declarator: (field_identifier) @_method_name)) @method
19
+
20
+ (field_declaration_list
21
+ (declaration
22
+ declarator: (function_declarator
23
+ declarator: (identifier) @_method_name)) @method)
24
+
25
+ (preproc_include
26
+ path: (system_lib_string) @_import_module) @import
27
+
28
+ (preproc_include
29
+ path: (string_literal) @_import_module) @import
30
+
31
+ (preproc_function_def
32
+ name: (identifier) @_fn_name) @function
33
+
34
+ (preproc_def
35
+ name: (identifier) @_var_name) @variable
36
+
37
+ (class_specifier
38
+ name: (type_identifier) @_cls_name
39
+ body: (field_declaration_list)) @class
40
+
41
+ (struct_specifier
42
+ name: (type_identifier) @_cls_name
43
+ body: (field_declaration_list)) @class
44
+
45
+ (union_specifier
46
+ name: (type_identifier) @_cls_name
47
+ body: (field_declaration_list)) @class
48
+
49
+ (enum_specifier
50
+ name: (type_identifier) @_cls_name
51
+ body: (enumerator_list)) @class
52
+
53
+ (alias_declaration
54
+ name: (type_identifier) @_cls_name) @class
55
+
56
+ (namespace_definition
57
+ name: (namespace_identifier) @_cls_name) @class
58
+
59
+ (concept_definition
60
+ name: (identifier) @_cls_name) @class
61
+
62
+ (translation_unit
63
+ (declaration
64
+ declarator: (function_declarator
65
+ declarator: (identifier) @_fn_name)) @function)
66
+
67
+ (namespace_definition
68
+ body: (declaration_list
69
+ (declaration
70
+ declarator: (function_declarator
71
+ declarator: (identifier) @_fn_name)) @function))
72
+
73
+ (translation_unit
74
+ (declaration
75
+ declarator: (init_declarator
76
+ declarator: (identifier) @_var_name)) @variable)
77
+
78
+ (translation_unit
79
+ (declaration
80
+ declarator: (pointer_declarator
81
+ declarator: (identifier) @_var_name)) @variable)
82
+
83
+ (translation_unit
84
+ (declaration
85
+ declarator: (init_declarator
86
+ declarator: (pointer_declarator
87
+ declarator: (identifier) @_var_name))) @variable)
88
+
89
+ (namespace_definition
90
+ body: (declaration_list
91
+ (declaration
92
+ declarator: (init_declarator
93
+ declarator: (identifier) @_var_name)) @variable))
94
+
95
+ (namespace_definition
96
+ body: (declaration_list
97
+ (declaration
98
+ declarator: (pointer_declarator
99
+ declarator: (identifier) @_var_name)) @variable))
100
+
101
+ (namespace_definition
102
+ body: (declaration_list
103
+ (declaration
104
+ declarator: (init_declarator
105
+ declarator: (pointer_declarator
106
+ declarator: (identifier) @_var_name))) @variable))
@@ -0,0 +1,43 @@
1
+ """C++ language plugin.
2
+
3
+ Provides symbol extraction (functions, prototypes, classes, structs,
4
+ unions, enums, type aliases, namespaces, methods including operator
5
+ overloads, namespace/global variables, and function/object-like
6
+ macros) and include directive capture. Namespaces are both a symbol
7
+ (class) and a naming scope.
8
+
9
+ Extracted chunks::
10
+
11
+ void greet() {} → function "greet", scope ""
12
+ class Shape {}; → class "Shape", scope ""
13
+ struct Point { ... }; → class "Point", scope ""
14
+ class Foo {
15
+ void bar() {} → method "bar", scope "Foo"
16
+ };
17
+
18
+ #include <iostream>
19
+ → import, metadata {module: "iostream"}
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ from rbtr.languages.registration import LanguageRegistration, QueryExtraction, load_query
25
+
26
+ # ── Query ────────────────────────────────────────────────────────────
27
+
28
+
29
+ # ── Plugin ───────────────────────────────────────────────────────────
30
+
31
+
32
+ cpp = LanguageRegistration(
33
+ id="cpp",
34
+ extensions=frozenset({".cpp", ".cc", ".cxx", ".hpp", ".hxx"}),
35
+ grammar_module="tree_sitter_cpp",
36
+ extraction=QueryExtraction(
37
+ query=load_query(__package__, "cpp"),
38
+ scope_types=frozenset({"class_specifier", "struct_specifier", "namespace_definition"}),
39
+ class_scope_types=frozenset({"class_specifier", "struct_specifier"}),
40
+ ),
41
+ source_roots=("", "include", "src"),
42
+ extraction_serial=6,
43
+ )
File without changes
@@ -0,0 +1,9 @@
1
+ [
2
+ "cpp.cpp::#include \"greeter.hpp\" -> greeter.hpp::Greeting [imports]",
3
+ "cpp.cpp::#include \"greeter.hpp\" -> greeter.hpp::Greeting [imports]",
4
+ "cpp.cpp::#include \"greeter.hpp\" -> greeter.hpp::greet [imports]",
5
+ "cpp.cpp::#include \"greeter.hpp\" -> greeter.hpp::render [imports]",
6
+ "cpp.cpp::#include \"greeter.hpp\" -> greeter.hpp::withDefault [imports]",
7
+ "util/text.cpp::#include \"text.hpp\" -> util/text.hpp::text_length [imports]",
8
+ "util/text.cpp::#include \"text.hpp\" -> util/text.hpp::util [imports]"
9
+ ]