rbtr-lang-c 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.
- rbtr_lang_c-2026.9.0.dev1/LICENSE +21 -0
- rbtr_lang_c-2026.9.0.dev1/PKG-INFO +60 -0
- rbtr_lang_c-2026.9.0.dev1/README.md +33 -0
- rbtr_lang_c-2026.9.0.dev1/pyproject.toml +58 -0
- rbtr_lang_c-2026.9.0.dev1/pyproject.toml.orig +62 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/__init__.py +1 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/c.scm +63 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/plugin.py +41 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/py.typed +0 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/__init__.py +0 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/__snapshots__/test_samples/test_edges_match_snapshot.json +7 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/__snapshots__/test_samples/test_extraction_matches_snapshot.json +572 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/cases_docstrings.py +88 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/cases_extraction.py +137 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/samples/c/c.c +44 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/samples/c/greeter.h +23 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/samples/c/util/text.c +10 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/samples/c/util/text.h +8 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/test_docstrings.py +43 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/test_extraction.py +57 -0
- rbtr_lang_c-2026.9.0.dev1/src/rbtr_lang_c/tests/test_samples.py +73 -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,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rbtr-lang-c
|
|
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,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-c
|
|
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-c#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-c
|
|
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** — function definitions and prototypes.
|
|
38
|
+
- **Classes** — `struct` / `enum` / `union` and `typedef` types (a
|
|
39
|
+
`typedef struct G G;` yields two: the definition and the alias).
|
|
40
|
+
- **Variables** — top-level variables and enum constants (C enum constants
|
|
41
|
+
leak into the enclosing scope, so they are file-scope variables).
|
|
42
|
+
- **Imports** — `#include <system>` and `#include "local"` headers.
|
|
43
|
+
|
|
44
|
+
## Chunks produced
|
|
45
|
+
|
|
46
|
+
```c
|
|
47
|
+
void greet(const char *name); /* function "greet" */
|
|
48
|
+
struct Point { int x, y; }; /* class "Point" */
|
|
49
|
+
enum Color { RED, GREEN }; /* class "Color"; variables RED, GREEN */
|
|
50
|
+
#include <stdio.h> /* import, metadata {module: stdio.h} */
|
|
51
|
+
#include "greeter.h" /* import, metadata {module: greeter.h} */
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Embedded / injected chunks
|
|
55
|
+
|
|
56
|
+
None. C does not embed other languages.
|
|
57
|
+
|
|
58
|
+
## Grammar & dependencies
|
|
59
|
+
|
|
60
|
+
Uses the `tree-sitter-c` grammar. No dependency on other language plugins.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# rbtr-lang-c
|
|
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** — function definitions and prototypes.
|
|
11
|
+
- **Classes** — `struct` / `enum` / `union` and `typedef` types (a
|
|
12
|
+
`typedef struct G G;` yields two: the definition and the alias).
|
|
13
|
+
- **Variables** — top-level variables and enum constants (C enum constants
|
|
14
|
+
leak into the enclosing scope, so they are file-scope variables).
|
|
15
|
+
- **Imports** — `#include <system>` and `#include "local"` headers.
|
|
16
|
+
|
|
17
|
+
## Chunks produced
|
|
18
|
+
|
|
19
|
+
```c
|
|
20
|
+
void greet(const char *name); /* function "greet" */
|
|
21
|
+
struct Point { int x, y; }; /* class "Point" */
|
|
22
|
+
enum Color { RED, GREEN }; /* class "Color"; variables RED, GREEN */
|
|
23
|
+
#include <stdio.h> /* import, metadata {module: stdio.h} */
|
|
24
|
+
#include "greeter.h" /* import, metadata {module: greeter.h} */
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Embedded / injected chunks
|
|
28
|
+
|
|
29
|
+
None. C does not embed other languages.
|
|
30
|
+
|
|
31
|
+
## Grammar & dependencies
|
|
32
|
+
|
|
33
|
+
Uses the `tree-sitter-c` grammar. No dependency on other language plugins.
|
|
@@ -0,0 +1,58 @@
|
|
|
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_c"
|
|
7
|
+
|
|
8
|
+
[tool.uv.sources.rbtr]
|
|
9
|
+
workspace = true
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "rbtr-lang-c"
|
|
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
|
+
"c",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 4 - Beta",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"Programming Language :: C",
|
|
31
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Topic :: Software Development :: Libraries",
|
|
34
|
+
"Topic :: Text Processing :: Indexing",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
requires-python = ">=3.13"
|
|
38
|
+
dependencies = [
|
|
39
|
+
"rbtr==2026.9.0-dev1",
|
|
40
|
+
"tree-sitter-c",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[project.authors]]
|
|
44
|
+
name = "Alejandro Giacometti"
|
|
45
|
+
email = "alejandro.giacometti@gmail.com"
|
|
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-c#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
|
+
c = "rbtr_lang_c.plugin:c"
|
|
56
|
+
|
|
57
|
+
[dependency-groups]
|
|
58
|
+
dev = ["rbtr[test]"]
|
|
@@ -0,0 +1,62 @@
|
|
|
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_c"
|
|
7
|
+
# No source-exclude: the plugin's tests, samples, and snapshots ship with
|
|
8
|
+
# the wheel (they are the language's golden record), and c.scm ships as
|
|
9
|
+
# package data.
|
|
10
|
+
|
|
11
|
+
[project]
|
|
12
|
+
name = "rbtr-lang-c"
|
|
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
|
+
"c",
|
|
29
|
+
]
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 4 - Beta",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"Programming Language :: C",
|
|
34
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Software Development :: Libraries",
|
|
37
|
+
"Topic :: Text Processing :: Indexing",
|
|
38
|
+
"Typing :: Typed",
|
|
39
|
+
]
|
|
40
|
+
requires-python = ">=3.13"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"rbtr==2026.9.0-dev1",
|
|
43
|
+
"tree-sitter-c",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/janrito/rbtr"
|
|
48
|
+
Repository = "https://github.com/janrito/rbtr"
|
|
49
|
+
Documentation = "https://github.com/janrito/rbtr/tree/main/packages/rbtr-lang-c#readme"
|
|
50
|
+
Issues = "https://github.com/janrito/rbtr/issues"
|
|
51
|
+
Changelog = "https://github.com/janrito/rbtr/releases"
|
|
52
|
+
|
|
53
|
+
[project.entry-points."rbtr.languages"]
|
|
54
|
+
# The value resolves to the language's `LanguageRegistration` (named by its
|
|
55
|
+
# id) — see the rbtr ARCHITECTURE "External plugins" note.
|
|
56
|
+
c = "rbtr_lang_c.plugin:c"
|
|
57
|
+
|
|
58
|
+
[tool.uv.sources]
|
|
59
|
+
rbtr = { workspace = true }
|
|
60
|
+
|
|
61
|
+
[dependency-groups]
|
|
62
|
+
dev = ["rbtr[test]"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""C language plugin package."""
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
(preproc_include
|
|
9
|
+
path: (system_lib_string) @_import_module) @import
|
|
10
|
+
|
|
11
|
+
(preproc_include
|
|
12
|
+
path: (string_literal) @_import_module) @import
|
|
13
|
+
|
|
14
|
+
(struct_specifier
|
|
15
|
+
name: (type_identifier) @_cls_name
|
|
16
|
+
body: (field_declaration_list)) @class
|
|
17
|
+
|
|
18
|
+
(union_specifier
|
|
19
|
+
name: (type_identifier) @_cls_name
|
|
20
|
+
body: (field_declaration_list)) @class
|
|
21
|
+
|
|
22
|
+
(enum_specifier
|
|
23
|
+
name: (type_identifier) @_cls_name
|
|
24
|
+
body: (enumerator_list)) @class
|
|
25
|
+
|
|
26
|
+
(enumerator
|
|
27
|
+
name: (identifier) @_var_name) @variable
|
|
28
|
+
|
|
29
|
+
(type_definition
|
|
30
|
+
declarator: (type_identifier) @_cls_name) @class
|
|
31
|
+
|
|
32
|
+
(type_definition
|
|
33
|
+
declarator: (function_declarator
|
|
34
|
+
declarator: (parenthesized_declarator
|
|
35
|
+
(pointer_declarator
|
|
36
|
+
declarator: (type_identifier) @_cls_name)))) @class
|
|
37
|
+
|
|
38
|
+
(preproc_function_def
|
|
39
|
+
name: (identifier) @_fn_name) @function
|
|
40
|
+
|
|
41
|
+
(preproc_def
|
|
42
|
+
name: (identifier) @_var_name) @variable
|
|
43
|
+
|
|
44
|
+
(translation_unit
|
|
45
|
+
(declaration
|
|
46
|
+
declarator: (function_declarator
|
|
47
|
+
declarator: (identifier) @_fn_name)) @function)
|
|
48
|
+
|
|
49
|
+
(translation_unit
|
|
50
|
+
(declaration
|
|
51
|
+
declarator: (init_declarator
|
|
52
|
+
declarator: (identifier) @_var_name)) @variable)
|
|
53
|
+
|
|
54
|
+
(translation_unit
|
|
55
|
+
(declaration
|
|
56
|
+
declarator: (pointer_declarator
|
|
57
|
+
declarator: (identifier) @_var_name)) @variable)
|
|
58
|
+
|
|
59
|
+
(translation_unit
|
|
60
|
+
(declaration
|
|
61
|
+
declarator: (init_declarator
|
|
62
|
+
declarator: (pointer_declarator
|
|
63
|
+
declarator: (identifier) @_var_name))) @variable)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""C language plugin.
|
|
2
|
+
|
|
3
|
+
Provides symbol extraction (functions, function prototypes, structs,
|
|
4
|
+
unions, enums, typedefs, global variables, and function/object-like
|
|
5
|
+
macros) and include directive capture. Object-like macros and
|
|
6
|
+
pointer-declared globals are variables; function-like macros and
|
|
7
|
+
prototypes are functions.
|
|
8
|
+
|
|
9
|
+
Extracted chunks::
|
|
10
|
+
|
|
11
|
+
int add(int a, int b) { ... } → function "add", scope ""
|
|
12
|
+
struct Node { int value; }; → class "Node", scope ""
|
|
13
|
+
enum Color { RED, GREEN }; → class "Color", scope ""
|
|
14
|
+
typedef struct { ... } Point; → class "Point", scope ""
|
|
15
|
+
|
|
16
|
+
#include <stdio.h>
|
|
17
|
+
→ import, metadata {module: "stdio.h"}
|
|
18
|
+
#include "mylib.h"
|
|
19
|
+
→ import, metadata {module: "mylib.h"}
|
|
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
|
+
c = LanguageRegistration(
|
|
33
|
+
id="c",
|
|
34
|
+
extensions=frozenset({".c", ".h"}),
|
|
35
|
+
grammar_module="tree_sitter_c",
|
|
36
|
+
extraction=QueryExtraction(
|
|
37
|
+
query=load_query(__package__, "c"),
|
|
38
|
+
),
|
|
39
|
+
source_roots=("", "include", "src"),
|
|
40
|
+
extraction_serial=4,
|
|
41
|
+
)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[
|
|
2
|
+
"c.c::#include \"greeter.h\" -> greeter.h::GREETER_H [imports]",
|
|
3
|
+
"c.c::#include \"greeter.h\" -> greeter.h::Greeter [imports]",
|
|
4
|
+
"c.c::#include \"greeter.h\" -> greeter.h::Greeter [imports]",
|
|
5
|
+
"c.c::#include \"greeter.h\" -> greeter.h::MAX_NAME [imports]",
|
|
6
|
+
"util/text.c::#include \"text.h\" -> util/text.h::GREETER_UTIL_TEXT_H [imports]"
|
|
7
|
+
]
|