IncludeCPP 3.7.16__tar.gz → 3.7.22__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 (59) hide show
  1. {includecpp-3.7.16 → includecpp-3.7.22}/IncludeCPP.egg-info/PKG-INFO +1 -1
  2. {includecpp-3.7.16 → includecpp-3.7.22}/PKG-INFO +1 -1
  3. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/__init__.py +1 -1
  4. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/cli/commands.py +7 -1
  5. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/__init__.py +6 -1
  6. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_builtins.py +198 -6
  7. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_builtins.pyi +79 -0
  8. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_parser.py +62 -6
  9. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_runtime.py +390 -23
  10. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_types.py +74 -1
  11. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl_bridge.py +64 -6
  12. {includecpp-3.7.16 → includecpp-3.7.22}/pyproject.toml +1 -1
  13. {includecpp-3.7.16 → includecpp-3.7.22}/IncludeCPP.egg-info/SOURCES.txt +0 -0
  14. {includecpp-3.7.16 → includecpp-3.7.22}/IncludeCPP.egg-info/dependency_links.txt +0 -0
  15. {includecpp-3.7.16 → includecpp-3.7.22}/IncludeCPP.egg-info/entry_points.txt +0 -0
  16. {includecpp-3.7.16 → includecpp-3.7.22}/IncludeCPP.egg-info/requires.txt +0 -0
  17. {includecpp-3.7.16 → includecpp-3.7.22}/IncludeCPP.egg-info/top_level.txt +0 -0
  18. {includecpp-3.7.16 → includecpp-3.7.22}/LICENSE +0 -0
  19. {includecpp-3.7.16 → includecpp-3.7.22}/MANIFEST.in +0 -0
  20. {includecpp-3.7.16 → includecpp-3.7.22}/README.md +0 -0
  21. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/__init__.pyi +0 -0
  22. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/__main__.py +0 -0
  23. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/cli/__init__.py +0 -0
  24. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/cli/config_parser.py +0 -0
  25. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/__init__.py +0 -0
  26. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/ai_integration.py +0 -0
  27. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/build_manager.py +0 -0
  28. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cpp_api.py +0 -0
  29. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cpp_api.pyi +0 -0
  30. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cppy_converter.py +0 -0
  31. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +0 -0
  32. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_events.py +0 -0
  33. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_modules.py +0 -0
  34. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl/cssl_syntax.py +0 -0
  35. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/cssl_bridge.pyi +0 -0
  36. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/error_catalog.py +0 -0
  37. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/error_formatter.py +0 -0
  38. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/exceptions.py +0 -0
  39. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/path_discovery.py +0 -0
  40. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/project_ui.py +0 -0
  41. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/core/settings_ui.py +0 -0
  42. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/generator/__init__.py +0 -0
  43. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/generator/parser.cpp +0 -0
  44. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/generator/parser.h +0 -0
  45. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/generator/type_resolver.cpp +0 -0
  46. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/generator/type_resolver.h +0 -0
  47. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/py.typed +0 -0
  48. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/templates/cpp.proj.template +0 -0
  49. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/__init__.py +0 -0
  50. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/__init__.py +0 -0
  51. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/images/cssl.png +0 -0
  52. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
  53. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/language-configuration.json +0 -0
  54. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/package.json +0 -0
  55. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/snippets/cssl.snippets.json +0 -0
  56. {includecpp-3.7.16 → includecpp-3.7.22}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +0 -0
  57. {includecpp-3.7.16 → includecpp-3.7.22}/requirements.txt +0 -0
  58. {includecpp-3.7.16 → includecpp-3.7.22}/setup.cfg +0 -0
  59. {includecpp-3.7.16 → includecpp-3.7.22}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 3.7.16
3
+ Version: 3.7.22
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 3.7.16
3
+ Version: 3.7.22
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -2,7 +2,7 @@ from .core.cpp_api import CppApi
2
2
  from .core import cssl_bridge as CSSL
3
3
  import warnings
4
4
 
5
- __version__ = "3.7.16"
5
+ __version__ = "3.7.22"
6
6
  __all__ = ["CppApi", "CSSL"]
7
7
 
8
8
  # Module-level cache for C++ modules
@@ -7720,7 +7720,13 @@ def cssl_doc(search, list_sections):
7720
7720
  click.echo("Or use: includecpp cssl doc --list")
7721
7721
  else:
7722
7722
  # Full documentation mode
7723
- click.echo_via_pager(content)
7723
+ # Replace Unicode characters that may not be supported on all terminals
7724
+ safe_content = content.replace('✓', '[OK]').replace('✗', '[X]').replace('→', '->').replace('←', '<-').replace('•', '*').replace('─', '-').replace('│', '|').replace('└', '+').replace('├', '+').replace('▸', '>').replace('▾', 'v')
7725
+ try:
7726
+ click.echo_via_pager(safe_content)
7727
+ except UnicodeEncodeError:
7728
+ # Fallback: encode with errors='replace'
7729
+ click.echo(safe_content.encode('ascii', errors='replace').decode('ascii'))
7724
7730
  else:
7725
7731
  click.secho("Documentation file not found.", fg='yellow')
7726
7732
  click.echo("Looking for: CSSL_DOCUMENTATION.md")
@@ -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 CSSLRuntime, CSSLRuntimeError, CSSLServiceRunner, run_cssl, run_cssl_file
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',
@@ -307,6 +307,10 @@ class CSSLBuiltins:
307
307
  self._functions['dataspace'] = self.builtin_dataspace
308
308
  self._functions['openquote'] = self.builtin_openquote
309
309
  self._functions['OpenFind'] = self.builtin_openfind
310
+ self._functions['vector'] = self.builtin_vector
311
+ self._functions['array'] = self.builtin_array
312
+ self._functions['stack'] = self.builtin_stack
313
+ self._functions['map'] = self.builtin_map
310
314
 
311
315
  # Print aliases for CSSL
312
316
  self._functions['printl'] = self.builtin_println # CSSL uses printl for println
@@ -433,13 +437,50 @@ class CSSLBuiltins:
433
437
  # ============= Type Checking =============
434
438
 
435
439
  def builtin_typeof(self, value: Any) -> str:
436
- """Get type name"""
440
+ """Get type name - returns CSSL-specific type names for CSSL types"""
437
441
  if value is None:
438
442
  return 'null'
443
+
444
+ # Check CSSL-specific types first
445
+ from .cssl_types import (Vector, Array, Stack, DataStruct,
446
+ List as CSSLList, Dictionary, Map,
447
+ Shuffled, Iterator, Combo, DataSpace,
448
+ OpenQuote, Parameter, CSSLInstance)
449
+
450
+ if isinstance(value, Vector):
451
+ return 'vector'
452
+ elif isinstance(value, Array):
453
+ return 'array'
454
+ elif isinstance(value, Stack):
455
+ return 'stack'
456
+ elif isinstance(value, DataStruct):
457
+ return 'datastruct'
458
+ elif isinstance(value, CSSLList):
459
+ return 'list'
460
+ elif isinstance(value, Dictionary):
461
+ return 'dictionary'
462
+ elif isinstance(value, Map):
463
+ return 'map'
464
+ elif isinstance(value, Shuffled):
465
+ return 'shuffled'
466
+ elif isinstance(value, Iterator):
467
+ return 'iterator'
468
+ elif isinstance(value, Combo):
469
+ return 'combo'
470
+ elif isinstance(value, DataSpace):
471
+ return 'dataspace'
472
+ elif isinstance(value, OpenQuote):
473
+ return 'openquote'
474
+ elif isinstance(value, Parameter):
475
+ return 'parameter'
476
+ elif isinstance(value, CSSLInstance):
477
+ return value._class.name
478
+
479
+ # Python types as fallback
439
480
  type_map = {
440
481
  int: 'int',
441
482
  float: 'float',
442
- str: 'str',
483
+ str: 'string',
443
484
  bool: 'bool',
444
485
  list: 'list',
445
486
  dict: 'dict',
@@ -1044,6 +1085,13 @@ class CSSLBuiltins:
1044
1085
  Usage: instance::getMethods(@module) or instance::getMethods($obj)
1045
1086
  Returns list of method names.
1046
1087
  """
1088
+ from .cssl_types import CSSLInstance
1089
+
1090
+ # Handle CSSL class instances
1091
+ if isinstance(obj, CSSLInstance):
1092
+ return list(obj._class.methods.keys())
1093
+
1094
+ # Handle Python objects
1047
1095
  import inspect
1048
1096
  methods = []
1049
1097
  for name in dir(obj):
@@ -1056,8 +1104,20 @@ class CSSLBuiltins:
1056
1104
  def builtin_instance_getClasses(self, obj: Any) -> list:
1057
1105
  """Get all classes from an object/module.
1058
1106
  Usage: instance::getClasses(@module)
1059
- Returns list of class names.
1107
+ Returns list of class names (including merged classes).
1060
1108
  """
1109
+ from .cssl_types import CSSLInstance
1110
+
1111
+ # Handle CSSL class instances
1112
+ if isinstance(obj, CSSLInstance):
1113
+ classes = [obj._class.name] # Primary class
1114
+ # Check for merged class instances in members
1115
+ for name, member in obj._members.items():
1116
+ if isinstance(member, CSSLInstance):
1117
+ classes.append(member._class.name)
1118
+ return classes
1119
+
1120
+ # Handle Python objects
1061
1121
  import inspect
1062
1122
  classes = []
1063
1123
  for name in dir(obj):
@@ -1070,8 +1130,20 @@ class CSSLBuiltins:
1070
1130
  def builtin_instance_getVars(self, obj: Any) -> list:
1071
1131
  """Get all variables/attributes (non-callable) from an object.
1072
1132
  Usage: instance::getVars(@module)
1073
- Returns list of variable names.
1133
+ Returns list of variable names (excludes merged class instances).
1074
1134
  """
1135
+ from .cssl_types import CSSLInstance
1136
+
1137
+ # Handle CSSL class instances
1138
+ if isinstance(obj, CSSLInstance):
1139
+ vars_list = []
1140
+ for name, member in obj._members.items():
1141
+ # Exclude merged class instances
1142
+ if not isinstance(member, CSSLInstance):
1143
+ vars_list.append(name)
1144
+ return vars_list
1145
+
1146
+ # Handle Python objects
1075
1147
  vars_list = []
1076
1148
  for name in dir(obj):
1077
1149
  if not name.startswith('_'):
@@ -1085,12 +1157,31 @@ class CSSLBuiltins:
1085
1157
  Usage: instance::getAll(@module)
1086
1158
  Returns dict with 'methods', 'classes', 'vars' keys.
1087
1159
  """
1088
- import inspect
1160
+ from .cssl_types import CSSLInstance
1161
+
1089
1162
  result = {
1090
1163
  'methods': [],
1091
1164
  'classes': [],
1092
1165
  'vars': []
1093
1166
  }
1167
+
1168
+ # Handle CSSL class instances
1169
+ if isinstance(obj, CSSLInstance):
1170
+ result['methods'] = list(obj._class.methods.keys())
1171
+ result['classes'] = [obj._class.name]
1172
+
1173
+ # Separate regular vars from merged class instances
1174
+ for name, member in obj._members.items():
1175
+ if isinstance(member, CSSLInstance):
1176
+ # Merged class - add to classes list
1177
+ result['classes'].append(member._class.name)
1178
+ else:
1179
+ # Regular variable
1180
+ result['vars'].append(name)
1181
+ return result
1182
+
1183
+ # Handle Python objects
1184
+ import inspect
1094
1185
  for name in dir(obj):
1095
1186
  if not name.startswith('_'):
1096
1187
  attr = getattr(obj, name, None)
@@ -1106,21 +1197,46 @@ class CSSLBuiltins:
1106
1197
  """Dynamically call a method on an object.
1107
1198
  Usage: instance::call(@module, 'methodName', arg1, arg2)
1108
1199
  """
1200
+ from .cssl_types import CSSLInstance
1201
+
1202
+ # Handle CSSL class instances
1203
+ if isinstance(obj, CSSLInstance):
1204
+ if obj.has_method(method_name):
1205
+ # Need runtime to call the method
1206
+ if self.runtime:
1207
+ return self.runtime._call_method(obj, obj.get_method(method_name), list(args), kwargs or {})
1208
+ raise RuntimeError(f"Method '{method_name}' not found on CSSL instance")
1209
+
1210
+ # Handle Python objects
1109
1211
  method = getattr(obj, method_name, None)
1110
1212
  if method and callable(method):
1111
1213
  return method(*args, **kwargs)
1112
1214
  raise RuntimeError(f"Method '{method_name}' not found on object")
1113
1215
 
1114
1216
  def builtin_instance_has(self, obj: Any, name: str) -> bool:
1115
- """Check if object has an attribute.
1217
+ """Check if object has an attribute or method.
1116
1218
  Usage: instance::has(@module, 'methodName')
1117
1219
  """
1220
+ from .cssl_types import CSSLInstance
1221
+
1222
+ # Handle CSSL class instances
1223
+ if isinstance(obj, CSSLInstance):
1224
+ return obj.has_member(name) or obj.has_method(name)
1225
+
1226
+ # Handle Python objects
1118
1227
  return hasattr(obj, name)
1119
1228
 
1120
1229
  def builtin_instance_type(self, obj: Any) -> str:
1121
1230
  """Get the type name of an object.
1122
1231
  Usage: instance::type(@module)
1123
1232
  """
1233
+ from .cssl_types import CSSLInstance
1234
+
1235
+ # Handle CSSL class instances
1236
+ if isinstance(obj, CSSLInstance):
1237
+ return obj._class.name
1238
+
1239
+ # Handle Python objects
1124
1240
  return type(obj).__name__
1125
1241
 
1126
1242
  def builtin_isavailable(self, name_or_obj: Any) -> bool:
@@ -1140,6 +1256,50 @@ class CSSLBuiltins:
1140
1256
  # Otherwise, check if the object is not None (for $name or instance<"name">)
1141
1257
  return name_or_obj is not None
1142
1258
 
1259
+ # ============= Filter Registration Functions =============
1260
+
1261
+ def builtin_filter_register(self, filter_type: str, helper: str, callback: Any) -> bool:
1262
+ """Register a custom filter.
1263
+ Usage: filter::register("mytype", "where", myCallback)
1264
+
1265
+ The callback receives (source, filter_value, runtime) and returns filtered result.
1266
+ Use "*" as helper for catch-all.
1267
+
1268
+ Example:
1269
+ define myFilter(source, value, runtime) {
1270
+ return source + value;
1271
+ }
1272
+ filter::register("custom", "add", myFilter);
1273
+
1274
+ result <==[custom::add=10] 5; // result = 15
1275
+ """
1276
+ from .cssl_runtime import register_filter
1277
+ register_filter(filter_type, helper, callback)
1278
+ return True
1279
+
1280
+ def builtin_filter_unregister(self, filter_type: str, helper: str) -> bool:
1281
+ """Unregister a custom filter.
1282
+ Usage: filter::unregister("mytype", "where")
1283
+ """
1284
+ from .cssl_runtime import unregister_filter
1285
+ return unregister_filter(filter_type, helper)
1286
+
1287
+ def builtin_filter_list(self) -> list:
1288
+ """List all registered custom filters.
1289
+ Usage: filter::list()
1290
+ Returns list of filter keys like ["mytype::where", "custom::*"]
1291
+ """
1292
+ from .cssl_runtime import get_custom_filters
1293
+ return list(get_custom_filters().keys())
1294
+
1295
+ def builtin_filter_exists(self, filter_type: str, helper: str) -> bool:
1296
+ """Check if a custom filter exists.
1297
+ Usage: filter::exists("mytype", "where")
1298
+ """
1299
+ from .cssl_runtime import get_custom_filters
1300
+ key = f"{filter_type}::{helper}"
1301
+ return key in get_custom_filters()
1302
+
1143
1303
  # ============= Regex Functions =============
1144
1304
 
1145
1305
  def builtin_match(self, pattern: str, string: str) -> Optional[dict]:
@@ -2203,6 +2363,38 @@ class CSSLBuiltins:
2203
2363
  from .cssl_types import OpenQuote
2204
2364
  return OpenQuote(db_ref)
2205
2365
 
2366
+ def builtin_vector(self, element_type: str = 'dynamic') -> Any:
2367
+ """Create a vector container.
2368
+
2369
+ Usage: vector<int> myVector; or vector('int')
2370
+ """
2371
+ from .cssl_types import Vector
2372
+ return Vector(element_type)
2373
+
2374
+ def builtin_array(self, element_type: str = 'dynamic') -> Any:
2375
+ """Create an array container.
2376
+
2377
+ Usage: array<string> myArray; or array('string')
2378
+ """
2379
+ from .cssl_types import Array
2380
+ return Array(element_type)
2381
+
2382
+ def builtin_stack(self, element_type: str = 'dynamic') -> Any:
2383
+ """Create a stack container.
2384
+
2385
+ Usage: stack<int> myStack; or stack('int')
2386
+ """
2387
+ from .cssl_types import Stack
2388
+ return Stack(element_type)
2389
+
2390
+ def builtin_map(self, key_type: str = 'dynamic', value_type: str = 'dynamic') -> Any:
2391
+ """Create a map container.
2392
+
2393
+ Usage: map<string, int> myMap; or map('string', 'int')
2394
+ """
2395
+ from .cssl_types import Map
2396
+ return Map(key_type, value_type)
2397
+
2206
2398
  def builtin_openfind(self, combo_or_type: Any, index: int = 0, params: list = None) -> Any:
2207
2399
  """Find open parameter by type or combo space.
2208
2400
 
@@ -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
  # =============================================================================
@@ -252,8 +252,15 @@ class CSSLLexer:
252
252
  # $<name> shared object reference
253
253
  self._read_shared_ref()
254
254
  elif char == '%':
255
- # %<name> captured reference (for infusion)
256
- self._read_captured_ref()
255
+ # Check if this is %<name> captured reference or % modulo operator
256
+ next_char = self._peek(1)
257
+ if next_char and (next_char.isalpha() or next_char == '_'):
258
+ # %<name> captured reference (for infusion)
259
+ self._read_captured_ref()
260
+ else:
261
+ # % modulo operator
262
+ self._add_token(TokenType.MODULO, '%')
263
+ self._advance()
257
264
  elif char == '&':
258
265
  # & for references
259
266
  if self._peek(1) == '&':
@@ -321,9 +328,6 @@ class CSSLLexer:
321
328
  else:
322
329
  # Already handled by // comment check above, but just in case
323
330
  self._skip_comment()
324
- elif char == '%':
325
- self._add_token(TokenType.MODULO, '%')
326
- self._advance()
327
331
  elif char == '<':
328
332
  self._read_less_than()
329
333
  elif char == '>':
@@ -848,7 +852,7 @@ class CSSLParser:
848
852
  if self._match_keyword('open'):
849
853
  param_info['open'] = True
850
854
 
851
- # Handle type annotations
855
+ # Handle type annotations (builtin types like int, string, etc.)
852
856
  if self._check(TokenType.KEYWORD) and self._is_type_keyword(self._current().value):
853
857
  param_info['type'] = self._advance().value
854
858
 
@@ -872,6 +876,39 @@ class CSSLParser:
872
876
  self._advance()
873
877
  param_info['generic'] = ''.join(generic_parts)
874
878
 
879
+ # Handle custom class types (identifier followed by another identifier = type + name)
880
+ elif self._check(TokenType.IDENTIFIER):
881
+ # Look ahead: if next token is also an identifier, current is the type
882
+ saved_pos = self.pos
883
+ potential_type = self._advance().value
884
+
885
+ # Check for generic type parameter <T> on custom type
886
+ if self._check(TokenType.COMPARE_LT):
887
+ self._advance()
888
+ generic_parts = []
889
+ depth = 1
890
+ while depth > 0 and not self._is_at_end():
891
+ if self._check(TokenType.COMPARE_LT):
892
+ depth += 1
893
+ generic_parts.append('<')
894
+ elif self._check(TokenType.COMPARE_GT):
895
+ depth -= 1
896
+ if depth > 0:
897
+ generic_parts.append('>')
898
+ elif self._check(TokenType.COMMA):
899
+ generic_parts.append(',')
900
+ else:
901
+ generic_parts.append(self._current().value)
902
+ self._advance()
903
+ param_info['generic'] = ''.join(generic_parts)
904
+
905
+ # If followed by identifier, this is "Type name" pattern
906
+ if self._check(TokenType.IDENTIFIER):
907
+ param_info['type'] = potential_type
908
+ else:
909
+ # Not a type, restore position - this is just a param name
910
+ self.pos = saved_pos
911
+
875
912
  # Handle reference operator &
876
913
  if self._match(TokenType.AMPERSAND):
877
914
  param_info['ref'] = True
@@ -2118,6 +2155,11 @@ class CSSLParser:
2118
2155
  elif self._match(TokenType.COMPARE_GE):
2119
2156
  right = self._parse_term()
2120
2157
  left = ASTNode('binary', value={'op': '>=', 'left': left, 'right': right})
2158
+ elif self._check(TokenType.KEYWORD) and self._peek().value == 'in':
2159
+ # 'in' operator for containment: item in list
2160
+ self._advance() # consume 'in'
2161
+ right = self._parse_term()
2162
+ left = ASTNode('binary', value={'op': 'in', 'left': left, 'right': right})
2121
2163
  else:
2122
2164
  break
2123
2165
 
@@ -2504,6 +2546,20 @@ class CSSLParser:
2504
2546
 
2505
2547
  self._expect(TokenType.BLOCK_END) # consume }
2506
2548
 
2549
+ # Check for array-style initialization: vector<int>[1, 2, 3], array<string>["a", "b"]
2550
+ elif self._check(TokenType.BRACKET_START):
2551
+ self._advance() # consume [
2552
+ init_values = []
2553
+
2554
+ while not self._check(TokenType.BRACKET_END) and not self._is_at_end():
2555
+ init_values.append(self._parse_expression())
2556
+
2557
+ # Optional comma
2558
+ if self._check(TokenType.COMMA):
2559
+ self._advance()
2560
+
2561
+ self._expect(TokenType.BRACKET_END) # consume ]
2562
+
2507
2563
  return ASTNode('type_instantiation', value={
2508
2564
  'type': name,
2509
2565
  'element_type': element_type,