Commit c41116b
authored
Allow Prefix Removal for Struct and Enums (#259)
This is a sub-issue from #247 . Previously we have prefix removal
feature for standalone functions. This PR expands the feature to Struct
and Enums. Assuming a prefix named `_prefix_` is to be removed, a struct
named `_prefix_Foo` is named `Foo` in python. A enum defined below:
```c++
enum _prefix_Fruit {
_prefix_Apple,
_prefix_Banana
};
```
will be exported as:
```Python
Fruit(IntEnum):
Apple = 0
Banana = 1
```
in python. This is to say that the prefix removal is applicable to both
enum name as well as the members.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Configurable prefix removal for enums, structs, and functions so
exported Python names omit configured prefixes.
* Enum symbol list is now exposed in module exports for easier
discovery.
* **Refactor**
* Centralized prefix-removal and unified Python-facing name handling
across binding generation and symbol registration.
* Rendering internals now propagate Python-visible names consistently.
* **Tests**
* Added/updated tests to verify prefix removal and symbol exposure;
tests invoke kernels directly and reset renderer/function caches.
* **Documentation**
* Clarified enum registration docstring.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Michael Wang <[email protected]>1 parent ae49180 commit c41116b
File tree
11 files changed
+311
-210
lines changed- numbast/src/numbast
- static
- tools
- tests
- config
11 files changed
+311
-210
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
33 | 43 | | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
39 | | - | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
45 | 58 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
52 | | - | |
| 63 | + | |
53 | 64 | | |
54 | 65 | | |
55 | 66 | | |
| |||
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
62 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
63 | 76 | | |
64 | 77 | | |
| 78 | + | |
65 | 79 | | |
66 | | - | |
| 80 | + | |
67 | 81 | | |
68 | 82 | | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
73 | | - | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
416 | | - | |
417 | | - | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
| |||
423 | 424 | | |
424 | 425 | | |
425 | 426 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | 427 | | |
446 | 428 | | |
447 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
| |||
245 | 249 | | |
246 | 250 | | |
247 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
248 | 264 | | |
249 | 265 | | |
250 | 266 | | |
| |||
257 | 273 | | |
258 | 274 | | |
259 | 275 | | |
| 276 | + | |
260 | 277 | | |
261 | 278 | | |
262 | 279 | | |
263 | 280 | | |
264 | 281 | | |
265 | | - | |
266 | | - | |
| 282 | + | |
| 283 | + | |
267 | 284 | | |
268 | 285 | | |
269 | 286 | | |
| |||
0 commit comments