IncludeCPP 3.7.18__tar.gz → 3.7.19__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.
- {includecpp-3.7.18 → includecpp-3.7.19}/IncludeCPP.egg-info/PKG-INFO +1 -1
- {includecpp-3.7.18 → includecpp-3.7.19}/PKG-INFO +1 -1
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/__init__.py +1 -1
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/__init__.py +6 -1
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_builtins.py +68 -6
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_builtins.pyi +79 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_runtime.py +188 -1
- {includecpp-3.7.18 → includecpp-3.7.19}/pyproject.toml +1 -1
- {includecpp-3.7.18 → includecpp-3.7.19}/IncludeCPP.egg-info/SOURCES.txt +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/IncludeCPP.egg-info/dependency_links.txt +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/IncludeCPP.egg-info/entry_points.txt +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/IncludeCPP.egg-info/requires.txt +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/IncludeCPP.egg-info/top_level.txt +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/LICENSE +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/MANIFEST.in +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/README.md +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/__init__.pyi +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/__main__.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/cli/__init__.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/cli/commands.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/cli/config_parser.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/__init__.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/ai_integration.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/build_manager.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cpp_api.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cpp_api.pyi +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cppy_converter.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_events.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_modules.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_parser.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_syntax.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl/cssl_types.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl_bridge.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/cssl_bridge.pyi +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/error_catalog.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/error_formatter.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/exceptions.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/path_discovery.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/project_ui.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/core/settings_ui.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/generator/__init__.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/generator/parser.cpp +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/generator/parser.h +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/generator/type_resolver.cpp +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/generator/type_resolver.h +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/py.typed +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/templates/cpp.proj.template +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/__init__.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/__init__.py +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/images/cssl.png +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/language-configuration.json +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/package.json +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/snippets/cssl.snippets.json +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/requirements.txt +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/setup.cfg +0 -0
- {includecpp-3.7.18 → includecpp-3.7.19}/setup.py +0 -0
|
@@ -16,7 +16,10 @@ from .cssl_parser import (
|
|
|
16
16
|
CSSLSyntaxError, CSSLLexer, CSSLParser, ASTNode,
|
|
17
17
|
KEYWORDS, TYPE_GENERICS, TYPE_PARAM_FUNCTIONS, INJECTION_HELPERS
|
|
18
18
|
)
|
|
19
|
-
from .cssl_runtime import
|
|
19
|
+
from .cssl_runtime import (
|
|
20
|
+
CSSLRuntime, CSSLRuntimeError, CSSLServiceRunner, run_cssl, run_cssl_file,
|
|
21
|
+
register_filter, unregister_filter, get_custom_filters
|
|
22
|
+
)
|
|
20
23
|
from .cssl_types import (
|
|
21
24
|
DataStruct, Shuffled, Iterator, Combo, DataSpace, OpenQuote,
|
|
22
25
|
OpenFind, Parameter, Stack, Vector, Array,
|
|
@@ -33,6 +36,8 @@ __all__ = [
|
|
|
33
36
|
# Runtime
|
|
34
37
|
'CSSLRuntime', 'CSSLRuntimeError', 'CSSLServiceRunner',
|
|
35
38
|
'run_cssl', 'run_cssl_file',
|
|
39
|
+
# Filter Registration
|
|
40
|
+
'register_filter', 'unregister_filter', 'get_custom_filters',
|
|
36
41
|
# Data Types
|
|
37
42
|
'DataStruct', 'Shuffled', 'Iterator', 'Combo', 'DataSpace', 'OpenQuote',
|
|
38
43
|
'OpenFind', 'Parameter', 'Stack', 'Vector', 'Array',
|
|
@@ -1063,13 +1063,18 @@ class CSSLBuiltins:
|
|
|
1063
1063
|
def builtin_instance_getClasses(self, obj: Any) -> list:
|
|
1064
1064
|
"""Get all classes from an object/module.
|
|
1065
1065
|
Usage: instance::getClasses(@module)
|
|
1066
|
-
Returns list of class names.
|
|
1066
|
+
Returns list of class names (including merged classes).
|
|
1067
1067
|
"""
|
|
1068
1068
|
from .cssl_types import CSSLInstance
|
|
1069
1069
|
|
|
1070
|
-
# Handle CSSL class instances
|
|
1070
|
+
# Handle CSSL class instances
|
|
1071
1071
|
if isinstance(obj, CSSLInstance):
|
|
1072
|
-
|
|
1072
|
+
classes = [obj._class.name] # Primary class
|
|
1073
|
+
# Check for merged class instances in members
|
|
1074
|
+
for name, member in obj._members.items():
|
|
1075
|
+
if isinstance(member, CSSLInstance):
|
|
1076
|
+
classes.append(member._class.name)
|
|
1077
|
+
return classes
|
|
1073
1078
|
|
|
1074
1079
|
# Handle Python objects
|
|
1075
1080
|
import inspect
|
|
@@ -1084,13 +1089,18 @@ class CSSLBuiltins:
|
|
|
1084
1089
|
def builtin_instance_getVars(self, obj: Any) -> list:
|
|
1085
1090
|
"""Get all variables/attributes (non-callable) from an object.
|
|
1086
1091
|
Usage: instance::getVars(@module)
|
|
1087
|
-
Returns list of variable names.
|
|
1092
|
+
Returns list of variable names (excludes merged class instances).
|
|
1088
1093
|
"""
|
|
1089
1094
|
from .cssl_types import CSSLInstance
|
|
1090
1095
|
|
|
1091
1096
|
# Handle CSSL class instances
|
|
1092
1097
|
if isinstance(obj, CSSLInstance):
|
|
1093
|
-
|
|
1098
|
+
vars_list = []
|
|
1099
|
+
for name, member in obj._members.items():
|
|
1100
|
+
# Exclude merged class instances
|
|
1101
|
+
if not isinstance(member, CSSLInstance):
|
|
1102
|
+
vars_list.append(name)
|
|
1103
|
+
return vars_list
|
|
1094
1104
|
|
|
1095
1105
|
# Handle Python objects
|
|
1096
1106
|
vars_list = []
|
|
@@ -1118,7 +1128,15 @@ class CSSLBuiltins:
|
|
|
1118
1128
|
if isinstance(obj, CSSLInstance):
|
|
1119
1129
|
result['methods'] = list(obj._class.methods.keys())
|
|
1120
1130
|
result['classes'] = [obj._class.name]
|
|
1121
|
-
|
|
1131
|
+
|
|
1132
|
+
# Separate regular vars from merged class instances
|
|
1133
|
+
for name, member in obj._members.items():
|
|
1134
|
+
if isinstance(member, CSSLInstance):
|
|
1135
|
+
# Merged class - add to classes list
|
|
1136
|
+
result['classes'].append(member._class.name)
|
|
1137
|
+
else:
|
|
1138
|
+
# Regular variable
|
|
1139
|
+
result['vars'].append(name)
|
|
1122
1140
|
return result
|
|
1123
1141
|
|
|
1124
1142
|
# Handle Python objects
|
|
@@ -1197,6 +1215,50 @@ class CSSLBuiltins:
|
|
|
1197
1215
|
# Otherwise, check if the object is not None (for $name or instance<"name">)
|
|
1198
1216
|
return name_or_obj is not None
|
|
1199
1217
|
|
|
1218
|
+
# ============= Filter Registration Functions =============
|
|
1219
|
+
|
|
1220
|
+
def builtin_filter_register(self, filter_type: str, helper: str, callback: Any) -> bool:
|
|
1221
|
+
"""Register a custom filter.
|
|
1222
|
+
Usage: filter::register("mytype", "where", myCallback)
|
|
1223
|
+
|
|
1224
|
+
The callback receives (source, filter_value, runtime) and returns filtered result.
|
|
1225
|
+
Use "*" as helper for catch-all.
|
|
1226
|
+
|
|
1227
|
+
Example:
|
|
1228
|
+
define myFilter(source, value, runtime) {
|
|
1229
|
+
return source + value;
|
|
1230
|
+
}
|
|
1231
|
+
filter::register("custom", "add", myFilter);
|
|
1232
|
+
|
|
1233
|
+
result <==[custom::add=10] 5; // result = 15
|
|
1234
|
+
"""
|
|
1235
|
+
from .cssl_runtime import register_filter
|
|
1236
|
+
register_filter(filter_type, helper, callback)
|
|
1237
|
+
return True
|
|
1238
|
+
|
|
1239
|
+
def builtin_filter_unregister(self, filter_type: str, helper: str) -> bool:
|
|
1240
|
+
"""Unregister a custom filter.
|
|
1241
|
+
Usage: filter::unregister("mytype", "where")
|
|
1242
|
+
"""
|
|
1243
|
+
from .cssl_runtime import unregister_filter
|
|
1244
|
+
return unregister_filter(filter_type, helper)
|
|
1245
|
+
|
|
1246
|
+
def builtin_filter_list(self) -> list:
|
|
1247
|
+
"""List all registered custom filters.
|
|
1248
|
+
Usage: filter::list()
|
|
1249
|
+
Returns list of filter keys like ["mytype::where", "custom::*"]
|
|
1250
|
+
"""
|
|
1251
|
+
from .cssl_runtime import get_custom_filters
|
|
1252
|
+
return list(get_custom_filters().keys())
|
|
1253
|
+
|
|
1254
|
+
def builtin_filter_exists(self, filter_type: str, helper: str) -> bool:
|
|
1255
|
+
"""Check if a custom filter exists.
|
|
1256
|
+
Usage: filter::exists("mytype", "where")
|
|
1257
|
+
"""
|
|
1258
|
+
from .cssl_runtime import get_custom_filters
|
|
1259
|
+
key = f"{filter_type}::{helper}"
|
|
1260
|
+
return key in get_custom_filters()
|
|
1261
|
+
|
|
1200
1262
|
# ============= Regex Functions =============
|
|
1201
1263
|
|
|
1202
1264
|
def builtin_match(self, pattern: str, string: str) -> Optional[dict]:
|
|
@@ -2082,6 +2082,85 @@ def isavailable(name_or_obj: Any) -> bool:
|
|
|
2082
2082
|
"""
|
|
2083
2083
|
...
|
|
2084
2084
|
|
|
2085
|
+
# =============================================================================
|
|
2086
|
+
# FILTER REGISTRATION FUNCTIONS (filter:: namespace)
|
|
2087
|
+
# =============================================================================
|
|
2088
|
+
# Custom filters allow extending the BruteInjection system with user-defined
|
|
2089
|
+
# filter types. Register filters that can then be used in injection syntax:
|
|
2090
|
+
# result <==[mytype::myhelper="value"] source;
|
|
2091
|
+
|
|
2092
|
+
def filter_register(filter_type: str, helper: str, callback: Callable[[Any, Any, Any], Any]) -> bool:
|
|
2093
|
+
"""Register a custom filter.
|
|
2094
|
+
|
|
2095
|
+
Usage in CSSL: filter::register("mytype", "helper", callback)
|
|
2096
|
+
|
|
2097
|
+
Args:
|
|
2098
|
+
filter_type: The filter type name (e.g., "custom", "mytype")
|
|
2099
|
+
helper: The helper name (e.g., "where", "add") or "*" for catch-all
|
|
2100
|
+
callback: Function(source, filter_value, runtime) -> filtered_result
|
|
2101
|
+
|
|
2102
|
+
Example:
|
|
2103
|
+
// Define a custom filter callback
|
|
2104
|
+
define addFilter(source, value, runtime) {
|
|
2105
|
+
return source + value;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
// Register the filter
|
|
2109
|
+
filter::register("math", "add", addFilter);
|
|
2110
|
+
|
|
2111
|
+
// Use the filter
|
|
2112
|
+
result <==[math::add=10] 5; // result = 15
|
|
2113
|
+
|
|
2114
|
+
// Register a catch-all filter
|
|
2115
|
+
define catchAll(source, value, runtime) {
|
|
2116
|
+
printl("Filter called with: " + str(value));
|
|
2117
|
+
return source;
|
|
2118
|
+
}
|
|
2119
|
+
filter::register("debug", "*", catchAll);
|
|
2120
|
+
"""
|
|
2121
|
+
...
|
|
2122
|
+
|
|
2123
|
+
def filter_unregister(filter_type: str, helper: str) -> bool:
|
|
2124
|
+
"""Unregister a custom filter.
|
|
2125
|
+
|
|
2126
|
+
Usage in CSSL: filter::unregister("mytype", "helper")
|
|
2127
|
+
|
|
2128
|
+
Returns:
|
|
2129
|
+
True if filter was found and removed, False otherwise
|
|
2130
|
+
|
|
2131
|
+
Example:
|
|
2132
|
+
filter::unregister("math", "add");
|
|
2133
|
+
"""
|
|
2134
|
+
...
|
|
2135
|
+
|
|
2136
|
+
def filter_list() -> List[str]:
|
|
2137
|
+
"""List all registered custom filters.
|
|
2138
|
+
|
|
2139
|
+
Usage in CSSL: filter::list()
|
|
2140
|
+
|
|
2141
|
+
Returns:
|
|
2142
|
+
List of filter keys like ["math::add", "debug::*"]
|
|
2143
|
+
|
|
2144
|
+
Example:
|
|
2145
|
+
stack<string> filters = filter::list();
|
|
2146
|
+
foreach (f in filters) {
|
|
2147
|
+
printl("Registered filter: " + f);
|
|
2148
|
+
}
|
|
2149
|
+
"""
|
|
2150
|
+
...
|
|
2151
|
+
|
|
2152
|
+
def filter_exists(filter_type: str, helper: str) -> bool:
|
|
2153
|
+
"""Check if a custom filter exists.
|
|
2154
|
+
|
|
2155
|
+
Usage in CSSL: filter::exists("mytype", "helper")
|
|
2156
|
+
|
|
2157
|
+
Example:
|
|
2158
|
+
if (filter::exists("math", "add")) {
|
|
2159
|
+
result <==[math::add=5] 10;
|
|
2160
|
+
}
|
|
2161
|
+
"""
|
|
2162
|
+
...
|
|
2163
|
+
|
|
2085
2164
|
# =============================================================================
|
|
2086
2165
|
# REGEX FUNCTIONS
|
|
2087
2166
|
# =============================================================================
|
|
@@ -19,6 +19,45 @@ from .cssl_types import (
|
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
# Global custom filter registry
|
|
23
|
+
# Structure: { "type::helper": callback_function }
|
|
24
|
+
# Callback signature: (source, filter_value, runtime) -> Any
|
|
25
|
+
_custom_filters: Dict[str, Callable[[Any, Any, Any], Any]] = {}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def register_filter(filter_type: str, helper: str, callback: Callable[[Any, Any, Any], Any]) -> None:
|
|
29
|
+
"""Register a custom filter.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
filter_type: The filter type (e.g., "mytype")
|
|
33
|
+
helper: The helper name (e.g., "where", "index", or "*" for catch-all)
|
|
34
|
+
callback: Function(source, filter_value, runtime) -> filtered_result
|
|
35
|
+
|
|
36
|
+
Usage in CSSL:
|
|
37
|
+
result <==[mytype::where="value"] source;
|
|
38
|
+
|
|
39
|
+
Usage from Python:
|
|
40
|
+
from includecpp.core.cssl.cssl_runtime import register_filter
|
|
41
|
+
register_filter("mytype", "where", lambda src, val, rt: ...)
|
|
42
|
+
"""
|
|
43
|
+
key = f"{filter_type}::{helper}"
|
|
44
|
+
_custom_filters[key] = callback
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def unregister_filter(filter_type: str, helper: str) -> bool:
|
|
48
|
+
"""Unregister a custom filter."""
|
|
49
|
+
key = f"{filter_type}::{helper}"
|
|
50
|
+
if key in _custom_filters:
|
|
51
|
+
del _custom_filters[key]
|
|
52
|
+
return True
|
|
53
|
+
return False
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_custom_filters() -> Dict[str, Callable]:
|
|
57
|
+
"""Get all registered custom filters."""
|
|
58
|
+
return _custom_filters.copy()
|
|
59
|
+
|
|
60
|
+
|
|
22
61
|
class CSSLRuntimeError(Exception):
|
|
23
62
|
"""Runtime error during CSSL execution with detailed context"""
|
|
24
63
|
def __init__(self, message: str, line: int = 0, context: str = None, hint: str = None):
|
|
@@ -1292,6 +1331,12 @@ class CSSLRuntime:
|
|
|
1292
1331
|
- combo::blocked - Get blocked items from combo
|
|
1293
1332
|
- dynamic::VarName=VALUE - Filter by dynamic variable value
|
|
1294
1333
|
- sql::data - Return only SQL-compatible data
|
|
1334
|
+
- instance::class - Get classes from object
|
|
1335
|
+
- instance::method - Get methods from object
|
|
1336
|
+
- instance::var - Get variables from object
|
|
1337
|
+
- instance::all - Get all categorized (methods, classes, vars)
|
|
1338
|
+
- instance::"ClassName" - Get specific class by name
|
|
1339
|
+
- name::"Name" - Filter by name (class, dict key, attribute)
|
|
1295
1340
|
"""
|
|
1296
1341
|
if not filter_info:
|
|
1297
1342
|
return source
|
|
@@ -1303,6 +1348,18 @@ class CSSLRuntime:
|
|
|
1303
1348
|
filter_type, helper = filter_key.split('::', 1)
|
|
1304
1349
|
filter_val = self._evaluate(filter_value) if isinstance(filter_value, ASTNode) else filter_value
|
|
1305
1350
|
|
|
1351
|
+
# === CHECK CUSTOM FILTERS FIRST ===
|
|
1352
|
+
custom_key = f"{filter_type}::{helper}"
|
|
1353
|
+
if custom_key in _custom_filters:
|
|
1354
|
+
result = _custom_filters[custom_key](result, filter_val, self)
|
|
1355
|
+
continue
|
|
1356
|
+
|
|
1357
|
+
# Check for catch-all custom filter (type::*)
|
|
1358
|
+
catchall_key = f"{filter_type}::*"
|
|
1359
|
+
if catchall_key in _custom_filters:
|
|
1360
|
+
result = _custom_filters[catchall_key](result, filter_val, self)
|
|
1361
|
+
continue
|
|
1362
|
+
|
|
1306
1363
|
# === STRING HELPERS ===
|
|
1307
1364
|
if filter_type == 'string':
|
|
1308
1365
|
if helper == 'where':
|
|
@@ -1496,6 +1553,128 @@ class CSSLRuntime:
|
|
|
1496
1553
|
else:
|
|
1497
1554
|
result = str(result) # Convert to string
|
|
1498
1555
|
|
|
1556
|
+
# === INSTANCE HELPERS ===
|
|
1557
|
+
# Works on CSSLInstance, Python objects, dicts, modules
|
|
1558
|
+
elif filter_type == 'instance':
|
|
1559
|
+
from .cssl_types import CSSLInstance
|
|
1560
|
+
import inspect
|
|
1561
|
+
|
|
1562
|
+
if isinstance(result, CSSLInstance):
|
|
1563
|
+
# Filter CSSL instances
|
|
1564
|
+
if helper in ('class', 'classes'):
|
|
1565
|
+
classes = {}
|
|
1566
|
+
for name, member in result._members.items():
|
|
1567
|
+
if isinstance(member, CSSLInstance):
|
|
1568
|
+
classes[name] = member
|
|
1569
|
+
result = classes if classes else None
|
|
1570
|
+
elif helper in ('method', 'methods'):
|
|
1571
|
+
result = dict(result._class.methods)
|
|
1572
|
+
elif helper in ('var', 'vars', 'variable', 'variables'):
|
|
1573
|
+
vars_dict = {}
|
|
1574
|
+
for name, member in result._members.items():
|
|
1575
|
+
if not isinstance(member, CSSLInstance):
|
|
1576
|
+
vars_dict[name] = member
|
|
1577
|
+
result = vars_dict
|
|
1578
|
+
elif helper in ('all',):
|
|
1579
|
+
result = {
|
|
1580
|
+
'methods': list(result._class.methods.keys()),
|
|
1581
|
+
'classes': [result._class.name] + [m._class.name for m in result._members.values() if isinstance(m, CSSLInstance)],
|
|
1582
|
+
'vars': [n for n, m in result._members.items() if not isinstance(m, CSSLInstance)]
|
|
1583
|
+
}
|
|
1584
|
+
else:
|
|
1585
|
+
# Filter by class name
|
|
1586
|
+
class_name = filter_val if filter_val else helper
|
|
1587
|
+
found = None
|
|
1588
|
+
if result._class.name == class_name:
|
|
1589
|
+
found = result
|
|
1590
|
+
else:
|
|
1591
|
+
for name, member in result._members.items():
|
|
1592
|
+
if isinstance(member, CSSLInstance) and member._class.name == class_name:
|
|
1593
|
+
found = member
|
|
1594
|
+
break
|
|
1595
|
+
result = found
|
|
1596
|
+
elif isinstance(result, dict):
|
|
1597
|
+
# Filter dicts
|
|
1598
|
+
if helper in ('class', 'classes'):
|
|
1599
|
+
result = {k: v for k, v in result.items() if inspect.isclass(v)}
|
|
1600
|
+
elif helper in ('method', 'methods', 'func', 'function', 'functions'):
|
|
1601
|
+
result = {k: v for k, v in result.items() if callable(v)}
|
|
1602
|
+
elif helper in ('var', 'vars', 'variable', 'variables'):
|
|
1603
|
+
result = {k: v for k, v in result.items() if not callable(v) and not inspect.isclass(v)}
|
|
1604
|
+
else:
|
|
1605
|
+
# Get by key
|
|
1606
|
+
key_name = filter_val if filter_val else helper
|
|
1607
|
+
result = result.get(key_name)
|
|
1608
|
+
elif hasattr(result, '__dict__') or hasattr(result, '__class__'):
|
|
1609
|
+
# Filter Python objects/modules
|
|
1610
|
+
if helper in ('class', 'classes'):
|
|
1611
|
+
classes = {}
|
|
1612
|
+
for name in dir(result):
|
|
1613
|
+
if not name.startswith('_'):
|
|
1614
|
+
attr = getattr(result, name, None)
|
|
1615
|
+
if inspect.isclass(attr):
|
|
1616
|
+
classes[name] = attr
|
|
1617
|
+
result = classes if classes else None
|
|
1618
|
+
elif helper in ('method', 'methods', 'func', 'function', 'functions'):
|
|
1619
|
+
methods = {}
|
|
1620
|
+
for name in dir(result):
|
|
1621
|
+
if not name.startswith('_'):
|
|
1622
|
+
attr = getattr(result, name, None)
|
|
1623
|
+
if callable(attr):
|
|
1624
|
+
methods[name] = attr
|
|
1625
|
+
result = methods if methods else None
|
|
1626
|
+
elif helper in ('var', 'vars', 'variable', 'variables'):
|
|
1627
|
+
vars_dict = {}
|
|
1628
|
+
for name in dir(result):
|
|
1629
|
+
if not name.startswith('_'):
|
|
1630
|
+
attr = getattr(result, name, None)
|
|
1631
|
+
if not callable(attr) and not inspect.isclass(attr):
|
|
1632
|
+
vars_dict[name] = attr
|
|
1633
|
+
result = vars_dict if vars_dict else None
|
|
1634
|
+
elif helper in ('all',):
|
|
1635
|
+
all_info = {'methods': [], 'classes': [], 'vars': []}
|
|
1636
|
+
for name in dir(result):
|
|
1637
|
+
if not name.startswith('_'):
|
|
1638
|
+
attr = getattr(result, name, None)
|
|
1639
|
+
if inspect.isclass(attr):
|
|
1640
|
+
all_info['classes'].append(name)
|
|
1641
|
+
elif callable(attr):
|
|
1642
|
+
all_info['methods'].append(name)
|
|
1643
|
+
else:
|
|
1644
|
+
all_info['vars'].append(name)
|
|
1645
|
+
result = all_info
|
|
1646
|
+
else:
|
|
1647
|
+
# Get attribute by name
|
|
1648
|
+
attr_name = filter_val if filter_val else helper
|
|
1649
|
+
result = getattr(result, attr_name, None)
|
|
1650
|
+
|
|
1651
|
+
# === NAME HELPERS ===
|
|
1652
|
+
# General name filter for any object type
|
|
1653
|
+
elif filter_type == 'name':
|
|
1654
|
+
from .cssl_types import CSSLInstance
|
|
1655
|
+
target_name = filter_val if filter_val else helper
|
|
1656
|
+
|
|
1657
|
+
if isinstance(result, CSSLInstance):
|
|
1658
|
+
if result._class.name == target_name:
|
|
1659
|
+
pass # Keep result
|
|
1660
|
+
else:
|
|
1661
|
+
found = None
|
|
1662
|
+
for name, member in result._members.items():
|
|
1663
|
+
if isinstance(member, CSSLInstance) and member._class.name == target_name:
|
|
1664
|
+
found = member
|
|
1665
|
+
break
|
|
1666
|
+
result = found
|
|
1667
|
+
elif isinstance(result, dict):
|
|
1668
|
+
result = result.get(target_name)
|
|
1669
|
+
elif isinstance(result, list):
|
|
1670
|
+
result = [item for item in result if str(item) == target_name or (hasattr(item, 'name') and item.name == target_name)]
|
|
1671
|
+
elif hasattr(result, target_name):
|
|
1672
|
+
result = getattr(result, target_name)
|
|
1673
|
+
elif hasattr(result, '__class__') and result.__class__.__name__ == target_name:
|
|
1674
|
+
pass # Keep result if class name matches
|
|
1675
|
+
else:
|
|
1676
|
+
result = None
|
|
1677
|
+
|
|
1499
1678
|
return result
|
|
1500
1679
|
|
|
1501
1680
|
def _exec_inject(self, node: ASTNode) -> Any:
|
|
@@ -1553,7 +1732,15 @@ class CSSLRuntime:
|
|
|
1553
1732
|
final_value = source
|
|
1554
1733
|
elif mode == 'add':
|
|
1555
1734
|
# Copy & add - preserve target and add source
|
|
1556
|
-
|
|
1735
|
+
from .cssl_types import CSSLInstance
|
|
1736
|
+
|
|
1737
|
+
# Special handling for CSSLInstance - merge classes
|
|
1738
|
+
if isinstance(current_value, CSSLInstance) and isinstance(source, CSSLInstance):
|
|
1739
|
+
# Add the new class instance as a member with class name as key
|
|
1740
|
+
class_name = source._class.name
|
|
1741
|
+
current_value._members[class_name] = source
|
|
1742
|
+
final_value = current_value
|
|
1743
|
+
elif isinstance(current_value, list):
|
|
1557
1744
|
if isinstance(source, list):
|
|
1558
1745
|
final_value = current_value + source
|
|
1559
1746
|
else:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "IncludeCPP"
|
|
7
|
-
version = "3.7.
|
|
7
|
+
version = "3.7.19"
|
|
8
8
|
description = "Professional C++ Python bindings with type-generic templates, pystubs and native threading"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{includecpp-3.7.18 → includecpp-3.7.19}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|