IncludeCPP 3.7.19__tar.gz → 3.7.21__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.19 → includecpp-3.7.21}/IncludeCPP.egg-info/PKG-INFO +1 -1
- {includecpp-3.7.19 → includecpp-3.7.21}/PKG-INFO +1 -1
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/__init__.py +1 -1
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_builtins.py +75 -2
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_parser.py +53 -1
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_runtime.py +75 -16
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_types.py +70 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl_bridge.py +13 -6
- {includecpp-3.7.19 → includecpp-3.7.21}/pyproject.toml +1 -1
- {includecpp-3.7.19 → includecpp-3.7.21}/IncludeCPP.egg-info/SOURCES.txt +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/IncludeCPP.egg-info/dependency_links.txt +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/IncludeCPP.egg-info/entry_points.txt +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/IncludeCPP.egg-info/requires.txt +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/IncludeCPP.egg-info/top_level.txt +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/LICENSE +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/MANIFEST.in +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/README.md +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/__init__.pyi +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/__main__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/cli/__init__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/cli/commands.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/cli/config_parser.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/__init__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/ai_integration.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/build_manager.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cpp_api.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cpp_api.pyi +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cppy_converter.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/__init__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_builtins.pyi +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_events.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_modules.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl/cssl_syntax.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/cssl_bridge.pyi +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/error_catalog.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/error_formatter.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/exceptions.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/path_discovery.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/project_ui.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/core/settings_ui.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/generator/__init__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/generator/parser.cpp +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/generator/parser.h +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/generator/type_resolver.cpp +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/generator/type_resolver.h +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/py.typed +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/templates/cpp.proj.template +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/__init__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/__init__.py +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/images/cssl.png +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/language-configuration.json +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/package.json +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/snippets/cssl.snippets.json +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/requirements.txt +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/setup.cfg +0 -0
- {includecpp-3.7.19 → includecpp-3.7.21}/setup.py +0 -0
|
@@ -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: '
|
|
483
|
+
str: 'string',
|
|
443
484
|
bool: 'bool',
|
|
444
485
|
list: 'list',
|
|
445
486
|
dict: 'dict',
|
|
@@ -2322,6 +2363,38 @@ class CSSLBuiltins:
|
|
|
2322
2363
|
from .cssl_types import OpenQuote
|
|
2323
2364
|
return OpenQuote(db_ref)
|
|
2324
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
|
+
|
|
2325
2398
|
def builtin_openfind(self, combo_or_type: Any, index: int = 0, params: list = None) -> Any:
|
|
2326
2399
|
"""Find open parameter by type or combo space.
|
|
2327
2400
|
|
|
@@ -848,7 +848,7 @@ class CSSLParser:
|
|
|
848
848
|
if self._match_keyword('open'):
|
|
849
849
|
param_info['open'] = True
|
|
850
850
|
|
|
851
|
-
# Handle type annotations
|
|
851
|
+
# Handle type annotations (builtin types like int, string, etc.)
|
|
852
852
|
if self._check(TokenType.KEYWORD) and self._is_type_keyword(self._current().value):
|
|
853
853
|
param_info['type'] = self._advance().value
|
|
854
854
|
|
|
@@ -872,6 +872,39 @@ class CSSLParser:
|
|
|
872
872
|
self._advance()
|
|
873
873
|
param_info['generic'] = ''.join(generic_parts)
|
|
874
874
|
|
|
875
|
+
# Handle custom class types (identifier followed by another identifier = type + name)
|
|
876
|
+
elif self._check(TokenType.IDENTIFIER):
|
|
877
|
+
# Look ahead: if next token is also an identifier, current is the type
|
|
878
|
+
saved_pos = self.pos
|
|
879
|
+
potential_type = self._advance().value
|
|
880
|
+
|
|
881
|
+
# Check for generic type parameter <T> on custom type
|
|
882
|
+
if self._check(TokenType.COMPARE_LT):
|
|
883
|
+
self._advance()
|
|
884
|
+
generic_parts = []
|
|
885
|
+
depth = 1
|
|
886
|
+
while depth > 0 and not self._is_at_end():
|
|
887
|
+
if self._check(TokenType.COMPARE_LT):
|
|
888
|
+
depth += 1
|
|
889
|
+
generic_parts.append('<')
|
|
890
|
+
elif self._check(TokenType.COMPARE_GT):
|
|
891
|
+
depth -= 1
|
|
892
|
+
if depth > 0:
|
|
893
|
+
generic_parts.append('>')
|
|
894
|
+
elif self._check(TokenType.COMMA):
|
|
895
|
+
generic_parts.append(',')
|
|
896
|
+
else:
|
|
897
|
+
generic_parts.append(self._current().value)
|
|
898
|
+
self._advance()
|
|
899
|
+
param_info['generic'] = ''.join(generic_parts)
|
|
900
|
+
|
|
901
|
+
# If followed by identifier, this is "Type name" pattern
|
|
902
|
+
if self._check(TokenType.IDENTIFIER):
|
|
903
|
+
param_info['type'] = potential_type
|
|
904
|
+
else:
|
|
905
|
+
# Not a type, restore position - this is just a param name
|
|
906
|
+
self.pos = saved_pos
|
|
907
|
+
|
|
875
908
|
# Handle reference operator &
|
|
876
909
|
if self._match(TokenType.AMPERSAND):
|
|
877
910
|
param_info['ref'] = True
|
|
@@ -2118,6 +2151,11 @@ class CSSLParser:
|
|
|
2118
2151
|
elif self._match(TokenType.COMPARE_GE):
|
|
2119
2152
|
right = self._parse_term()
|
|
2120
2153
|
left = ASTNode('binary', value={'op': '>=', 'left': left, 'right': right})
|
|
2154
|
+
elif self._check(TokenType.KEYWORD) and self._peek().value == 'in':
|
|
2155
|
+
# 'in' operator for containment: item in list
|
|
2156
|
+
self._advance() # consume 'in'
|
|
2157
|
+
right = self._parse_term()
|
|
2158
|
+
left = ASTNode('binary', value={'op': 'in', 'left': left, 'right': right})
|
|
2121
2159
|
else:
|
|
2122
2160
|
break
|
|
2123
2161
|
|
|
@@ -2504,6 +2542,20 @@ class CSSLParser:
|
|
|
2504
2542
|
|
|
2505
2543
|
self._expect(TokenType.BLOCK_END) # consume }
|
|
2506
2544
|
|
|
2545
|
+
# Check for array-style initialization: vector<int>[1, 2, 3], array<string>["a", "b"]
|
|
2546
|
+
elif self._check(TokenType.BRACKET_START):
|
|
2547
|
+
self._advance() # consume [
|
|
2548
|
+
init_values = []
|
|
2549
|
+
|
|
2550
|
+
while not self._check(TokenType.BRACKET_END) and not self._is_at_end():
|
|
2551
|
+
init_values.append(self._parse_expression())
|
|
2552
|
+
|
|
2553
|
+
# Optional comma
|
|
2554
|
+
if self._check(TokenType.COMMA):
|
|
2555
|
+
self._advance()
|
|
2556
|
+
|
|
2557
|
+
self._expect(TokenType.BRACKET_END) # consume ]
|
|
2558
|
+
|
|
2507
2559
|
return ASTNode('type_instantiation', value={
|
|
2508
2560
|
'type': name,
|
|
2509
2561
|
'element_type': element_type,
|
|
@@ -830,8 +830,18 @@ class CSSLRuntime:
|
|
|
830
830
|
if hasattr(instance, 'append'):
|
|
831
831
|
instance.append(init_value)
|
|
832
832
|
|
|
833
|
+
# Check for global modifier
|
|
834
|
+
modifiers = decl.get('modifiers', [])
|
|
835
|
+
is_global = 'global' in modifiers
|
|
836
|
+
|
|
833
837
|
# Store in scope
|
|
834
838
|
self.scope.set(var_name, instance)
|
|
839
|
+
|
|
840
|
+
# If global, also store in promoted_globals and global_scope
|
|
841
|
+
if is_global:
|
|
842
|
+
self._promoted_globals[var_name] = instance
|
|
843
|
+
self.global_scope.set(var_name, instance)
|
|
844
|
+
|
|
835
845
|
return instance
|
|
836
846
|
|
|
837
847
|
def _exec_instance_declaration(self, node: ASTNode) -> Any:
|
|
@@ -978,6 +988,14 @@ class CSSLRuntime:
|
|
|
978
988
|
result = self._evaluate(inner.value)
|
|
979
989
|
return result
|
|
980
990
|
|
|
991
|
+
# Handle typed declaration: global datastruct<int> data;
|
|
992
|
+
elif inner.type == 'typed_declaration':
|
|
993
|
+
# Add global modifier to the declaration
|
|
994
|
+
if isinstance(inner.value, dict):
|
|
995
|
+
inner.value['modifiers'] = inner.value.get('modifiers', []) + ['global']
|
|
996
|
+
result = self._exec_typed_declaration(inner)
|
|
997
|
+
return result
|
|
998
|
+
|
|
981
999
|
# Fallback: execute normally
|
|
982
1000
|
return self._execute_node(inner)
|
|
983
1001
|
|
|
@@ -1756,9 +1774,14 @@ class CSSLRuntime:
|
|
|
1756
1774
|
elif mode == 'move':
|
|
1757
1775
|
# Move & remove from source
|
|
1758
1776
|
final_value = source
|
|
1759
|
-
# Clear the source
|
|
1760
|
-
if isinstance(source_node, ASTNode)
|
|
1761
|
-
|
|
1777
|
+
# Clear the source - handle all node types
|
|
1778
|
+
if isinstance(source_node, ASTNode):
|
|
1779
|
+
if source_node.type == 'identifier':
|
|
1780
|
+
self.scope.set(source_node.value, None)
|
|
1781
|
+
elif source_node.type == 'module_ref':
|
|
1782
|
+
self._set_module_value(source_node.value, None)
|
|
1783
|
+
elif source_node.type == 'member_access':
|
|
1784
|
+
self._set_member(source_node, None)
|
|
1762
1785
|
else:
|
|
1763
1786
|
final_value = source
|
|
1764
1787
|
|
|
@@ -1830,9 +1853,14 @@ class CSSLRuntime:
|
|
|
1830
1853
|
final_value = [current_value, source]
|
|
1831
1854
|
elif mode == 'move':
|
|
1832
1855
|
final_value = source
|
|
1833
|
-
# Clear the source
|
|
1834
|
-
if isinstance(source_node, ASTNode)
|
|
1835
|
-
|
|
1856
|
+
# Clear the source - handle all node types
|
|
1857
|
+
if isinstance(source_node, ASTNode):
|
|
1858
|
+
if source_node.type == 'identifier':
|
|
1859
|
+
self.scope.set(source_node.value, None)
|
|
1860
|
+
elif source_node.type == 'module_ref':
|
|
1861
|
+
self._set_module_value(source_node.value, None)
|
|
1862
|
+
elif source_node.type == 'member_access':
|
|
1863
|
+
self._set_member(source_node, None)
|
|
1836
1864
|
else:
|
|
1837
1865
|
final_value = source
|
|
1838
1866
|
|
|
@@ -2047,6 +2075,10 @@ class CSSLRuntime:
|
|
|
2047
2075
|
"""Execute expression statement"""
|
|
2048
2076
|
return self._evaluate(node.value)
|
|
2049
2077
|
|
|
2078
|
+
def _exec_type_instantiation(self, node: ASTNode) -> Any:
|
|
2079
|
+
"""Execute type instantiation as statement (e.g., vector<int>)"""
|
|
2080
|
+
return self._evaluate(node)
|
|
2081
|
+
|
|
2050
2082
|
def _exec_await(self, node: ASTNode) -> Any:
|
|
2051
2083
|
"""Execute await statement - waits for expression to complete"""
|
|
2052
2084
|
# Evaluate the awaited expression
|
|
@@ -2128,12 +2160,13 @@ class CSSLRuntime:
|
|
|
2128
2160
|
return value
|
|
2129
2161
|
|
|
2130
2162
|
if node.type == 'module_ref':
|
|
2131
|
-
#
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
value = self._promoted_globals.get(node.value)
|
|
2163
|
+
# User-defined globals have priority over SDK modules
|
|
2164
|
+
# Check promoted globals first, then global scope, then SDK modules
|
|
2165
|
+
value = self._promoted_globals.get(node.value)
|
|
2135
2166
|
if value is None:
|
|
2136
2167
|
value = self.global_scope.get(node.value)
|
|
2168
|
+
if value is None:
|
|
2169
|
+
value = self.get_module(node.value) # SDK modules as fallback
|
|
2137
2170
|
return value
|
|
2138
2171
|
|
|
2139
2172
|
if node.type == 'self_ref':
|
|
@@ -2217,12 +2250,28 @@ class CSSLRuntime:
|
|
|
2217
2250
|
value_type = node.value.get('value_type') # For map<K, V>
|
|
2218
2251
|
init_values = node.value.get('init_values') # For inline init: map<K,V>{...}
|
|
2219
2252
|
|
|
2253
|
+
# Helper to populate container with init values
|
|
2254
|
+
def _populate_container(container, init_vals):
|
|
2255
|
+
if init_vals and isinstance(init_vals, list):
|
|
2256
|
+
for val_node in init_vals:
|
|
2257
|
+
val = self._evaluate(val_node) if isinstance(val_node, ASTNode) else val_node
|
|
2258
|
+
if hasattr(container, 'push'):
|
|
2259
|
+
container.push(val)
|
|
2260
|
+
elif hasattr(container, 'add'):
|
|
2261
|
+
container.add(val)
|
|
2262
|
+
elif hasattr(container, 'append'):
|
|
2263
|
+
container.append(val)
|
|
2264
|
+
return container
|
|
2265
|
+
|
|
2220
2266
|
if type_name == 'stack':
|
|
2221
|
-
|
|
2267
|
+
s = Stack(element_type)
|
|
2268
|
+
return _populate_container(s, init_values)
|
|
2222
2269
|
elif type_name == 'vector':
|
|
2223
|
-
|
|
2270
|
+
v = Vector(element_type)
|
|
2271
|
+
return _populate_container(v, init_values)
|
|
2224
2272
|
elif type_name == 'datastruct':
|
|
2225
|
-
|
|
2273
|
+
d = DataStruct(element_type)
|
|
2274
|
+
return _populate_container(d, init_values)
|
|
2226
2275
|
elif type_name == 'shuffled':
|
|
2227
2276
|
return Shuffled(element_type)
|
|
2228
2277
|
elif type_name == 'iterator':
|
|
@@ -2234,9 +2283,11 @@ class CSSLRuntime:
|
|
|
2234
2283
|
elif type_name == 'openquote':
|
|
2235
2284
|
return OpenQuote()
|
|
2236
2285
|
elif type_name == 'array':
|
|
2237
|
-
|
|
2286
|
+
a = Array(element_type)
|
|
2287
|
+
return _populate_container(a, init_values)
|
|
2238
2288
|
elif type_name == 'list':
|
|
2239
|
-
|
|
2289
|
+
l = List(element_type)
|
|
2290
|
+
return _populate_container(l, init_values)
|
|
2240
2291
|
elif type_name in ('dictionary', 'dict'):
|
|
2241
2292
|
return Dictionary(element_type)
|
|
2242
2293
|
elif type_name == 'map':
|
|
@@ -3023,12 +3074,20 @@ class CSSLRuntime:
|
|
|
3023
3074
|
pass
|
|
3024
3075
|
|
|
3025
3076
|
def _set_module_value(self, path: str, value: Any):
|
|
3026
|
-
"""Set a value on a module path"""
|
|
3077
|
+
"""Set a value on a module path or promoted global"""
|
|
3027
3078
|
parts = path.split('.')
|
|
3028
3079
|
if len(parts) < 2:
|
|
3080
|
+
# Single name (no dots) - set in promoted_globals and global_scope
|
|
3081
|
+
self._promoted_globals[path] = value
|
|
3082
|
+
self.global_scope.set(path, value)
|
|
3029
3083
|
return
|
|
3030
3084
|
|
|
3031
3085
|
obj = self._modules.get(parts[0])
|
|
3086
|
+
# Also check promoted_globals for the base object
|
|
3087
|
+
if obj is None:
|
|
3088
|
+
obj = self._promoted_globals.get(parts[0])
|
|
3089
|
+
if obj is None:
|
|
3090
|
+
obj = self.global_scope.get(parts[0])
|
|
3032
3091
|
if obj is None:
|
|
3033
3092
|
return
|
|
3034
3093
|
|
|
@@ -64,6 +64,33 @@ class DataStruct(list):
|
|
|
64
64
|
return target_type(self[0])
|
|
65
65
|
return None
|
|
66
66
|
|
|
67
|
+
def length(self) -> int:
|
|
68
|
+
"""Return datastruct length"""
|
|
69
|
+
return len(self)
|
|
70
|
+
|
|
71
|
+
def size(self) -> int:
|
|
72
|
+
"""Return datastruct size (alias for length)"""
|
|
73
|
+
return len(self)
|
|
74
|
+
|
|
75
|
+
def push(self, item: Any) -> 'DataStruct':
|
|
76
|
+
"""Push item to datastruct (alias for add)"""
|
|
77
|
+
self.append(item)
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def isEmpty(self) -> bool:
|
|
81
|
+
"""Check if datastruct is empty"""
|
|
82
|
+
return len(self) == 0
|
|
83
|
+
|
|
84
|
+
def contains(self, item: Any) -> bool:
|
|
85
|
+
"""Check if datastruct contains item"""
|
|
86
|
+
return item in self
|
|
87
|
+
|
|
88
|
+
def at(self, index: int) -> Any:
|
|
89
|
+
"""Get item at index (safe access)"""
|
|
90
|
+
if 0 <= index < len(self):
|
|
91
|
+
return self[index]
|
|
92
|
+
return None
|
|
93
|
+
|
|
67
94
|
def begin(self) -> int:
|
|
68
95
|
"""Return iterator to beginning (C++ style)"""
|
|
69
96
|
return 0
|
|
@@ -99,6 +126,16 @@ class Stack(list):
|
|
|
99
126
|
self.append(item)
|
|
100
127
|
return self
|
|
101
128
|
|
|
129
|
+
def pop(self) -> Any:
|
|
130
|
+
"""Pop and return top element from stack"""
|
|
131
|
+
if len(self) == 0:
|
|
132
|
+
return None
|
|
133
|
+
return super().pop()
|
|
134
|
+
|
|
135
|
+
def pop_back(self) -> Any:
|
|
136
|
+
"""Pop and return top element (alias for pop)"""
|
|
137
|
+
return self.pop()
|
|
138
|
+
|
|
102
139
|
def peek(self) -> Any:
|
|
103
140
|
"""View top item without removing"""
|
|
104
141
|
return self[-1] if self else None
|
|
@@ -701,6 +738,39 @@ class List(list):
|
|
|
701
738
|
self.extend([value] * count)
|
|
702
739
|
return self
|
|
703
740
|
|
|
741
|
+
def map(self, func: Callable[[Any], Any]) -> 'List':
|
|
742
|
+
"""Apply function to all elements"""
|
|
743
|
+
result = List(self._element_type)
|
|
744
|
+
result.extend(func(item) for item in self)
|
|
745
|
+
return result
|
|
746
|
+
|
|
747
|
+
def filter(self, predicate: Callable[[Any], bool]) -> 'List':
|
|
748
|
+
"""Filter elements by predicate"""
|
|
749
|
+
result = List(self._element_type)
|
|
750
|
+
result.extend(item for item in self if predicate(item))
|
|
751
|
+
return result
|
|
752
|
+
|
|
753
|
+
def forEach(self, func: Callable[[Any], None]) -> 'List':
|
|
754
|
+
"""Execute function for each element"""
|
|
755
|
+
for item in self:
|
|
756
|
+
func(item)
|
|
757
|
+
return self
|
|
758
|
+
|
|
759
|
+
def reduce(self, func: Callable[[Any, Any], Any], initial: Any = None) -> Any:
|
|
760
|
+
"""Reduce list to single value"""
|
|
761
|
+
from functools import reduce as py_reduce
|
|
762
|
+
if initial is None:
|
|
763
|
+
return py_reduce(func, self)
|
|
764
|
+
return py_reduce(func, self, initial)
|
|
765
|
+
|
|
766
|
+
def every(self, predicate: Callable[[Any], bool]) -> bool:
|
|
767
|
+
"""Check if all elements match predicate"""
|
|
768
|
+
return all(predicate(item) for item in self)
|
|
769
|
+
|
|
770
|
+
def some(self, predicate: Callable[[Any], bool]) -> bool:
|
|
771
|
+
"""Check if any element matches predicate"""
|
|
772
|
+
return any(predicate(item) for item in self)
|
|
773
|
+
|
|
704
774
|
def begin(self) -> int:
|
|
705
775
|
"""Return iterator to beginning"""
|
|
706
776
|
return 0
|
|
@@ -422,12 +422,19 @@ class CsslLang:
|
|
|
422
422
|
"""
|
|
423
423
|
runtime = self._get_runtime()
|
|
424
424
|
|
|
425
|
-
# Check if it's a file path
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
425
|
+
# Check if it's a file path (not code)
|
|
426
|
+
# Code detection: contains newlines, semicolons, or braces = definitely code
|
|
427
|
+
is_likely_code = '\n' in path_or_code or ';' in path_or_code or '{' in path_or_code
|
|
428
|
+
source = path_or_code
|
|
429
|
+
|
|
430
|
+
if not is_likely_code:
|
|
431
|
+
try:
|
|
432
|
+
path = Path(path_or_code)
|
|
433
|
+
if path.exists() and path.suffix in ('.cssl', '.cssl-mod', '.cssl-pl'):
|
|
434
|
+
source = path.read_text(encoding='utf-8')
|
|
435
|
+
except OSError:
|
|
436
|
+
# Path too long or invalid - treat as code
|
|
437
|
+
pass
|
|
431
438
|
|
|
432
439
|
# Set arguments in runtime scope
|
|
433
440
|
from .cssl import Parameter
|
|
@@ -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.21"
|
|
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
|
{includecpp-3.7.19 → includecpp-3.7.21}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|