IncludeCPP 3.8.8__py3-none-any.whl → 3.8.9__py3-none-any.whl
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/__init__.py +1 -1
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +100 -1
- includecpp/core/cssl/cssl_parser.py +76 -6
- includecpp/core/cssl/cssl_runtime.py +136 -0
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +25 -0
- {includecpp-3.8.8.dist-info → includecpp-3.8.9.dist-info}/METADATA +1 -1
- {includecpp-3.8.8.dist-info → includecpp-3.8.9.dist-info}/RECORD +11 -11
- {includecpp-3.8.8.dist-info → includecpp-3.8.9.dist-info}/WHEEL +0 -0
- {includecpp-3.8.8.dist-info → includecpp-3.8.9.dist-info}/entry_points.txt +0 -0
- {includecpp-3.8.8.dist-info → includecpp-3.8.9.dist-info}/licenses/LICENSE +0 -0
- {includecpp-3.8.8.dist-info → includecpp-3.8.9.dist-info}/top_level.txt +0 -0
includecpp/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CSSL - C-Style Scripting Language
|
|
2
2
|
|
|
3
|
-
> Version 3.8.
|
|
3
|
+
> Version 3.8.9 | A modern scripting language with C++-style syntax and unique features like CodeInfusion, BruteInjection, and Python Interop.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -2007,6 +2007,101 @@ class Derived : extends Base {
|
|
|
2007
2007
|
}
|
|
2008
2008
|
```
|
|
2009
2009
|
|
|
2010
|
+
### Append Mode with `++` Operator
|
|
2011
|
+
|
|
2012
|
+
The `++` append operator allows you to extend constructors and functions by keeping the original code and adding new code. This is useful for extending behavior without completely replacing it.
|
|
2013
|
+
|
|
2014
|
+
#### Basic Function Append
|
|
2015
|
+
|
|
2016
|
+
```cssl
|
|
2017
|
+
// Original function
|
|
2018
|
+
define BaseFunc() {
|
|
2019
|
+
printl("Base functionality");
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
// Append to BaseFunc - keeps original + adds new
|
|
2023
|
+
define ExtendedFunc() &BaseFunc ++ {
|
|
2024
|
+
printl("Extended functionality");
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
ExtendedFunc();
|
|
2028
|
+
// Output:
|
|
2029
|
+
// Base functionality
|
|
2030
|
+
// Extended functionality
|
|
2031
|
+
```
|
|
2032
|
+
|
|
2033
|
+
#### Constructor Append with Class Reference
|
|
2034
|
+
|
|
2035
|
+
```cssl
|
|
2036
|
+
class MyClass {
|
|
2037
|
+
constr MyClassConstructor() {
|
|
2038
|
+
printl("MyClass constructor");
|
|
2039
|
+
this->value = 10;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
class BetterClass :: extends MyClass {
|
|
2044
|
+
// Append to specific parent constructor
|
|
2045
|
+
constr BetterConstructor() &MyClass::MyClassConstructor ++ {
|
|
2046
|
+
printl("BetterClass - added code");
|
|
2047
|
+
this->extra = 20;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
$instance = new BetterClass();
|
|
2052
|
+
// Output:
|
|
2053
|
+
// MyClass constructor
|
|
2054
|
+
// BetterClass - added code
|
|
2055
|
+
printl($instance.value); // 10
|
|
2056
|
+
printl($instance.extra); // 20
|
|
2057
|
+
```
|
|
2058
|
+
|
|
2059
|
+
#### Method Append
|
|
2060
|
+
|
|
2061
|
+
```cssl
|
|
2062
|
+
class Parent {
|
|
2063
|
+
define greet() {
|
|
2064
|
+
printl("Hello from Parent");
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
class Child :: extends Parent {
|
|
2069
|
+
// Append to parent method
|
|
2070
|
+
define betterGreet() &Parent::greet ++ {
|
|
2071
|
+
printl("And also from Child!");
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
$child = new Child();
|
|
2076
|
+
$child.betterGreet();
|
|
2077
|
+
// Output:
|
|
2078
|
+
// Hello from Parent
|
|
2079
|
+
// And also from Child!
|
|
2080
|
+
```
|
|
2081
|
+
|
|
2082
|
+
#### Dynamic Instance Reference
|
|
2083
|
+
|
|
2084
|
+
You can also reference methods from instances using `&$instanceVar::member`:
|
|
2085
|
+
|
|
2086
|
+
```cssl
|
|
2087
|
+
global $myInstance = new SomeClass();
|
|
2088
|
+
|
|
2089
|
+
class Extended {
|
|
2090
|
+
define extendedMethod() &$myInstance::originalMethod ++ {
|
|
2091
|
+
printl("Added to instance method");
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
```
|
|
2095
|
+
|
|
2096
|
+
#### Append Mode Syntax Summary
|
|
2097
|
+
|
|
2098
|
+
| Syntax | Description |
|
|
2099
|
+
|--------|-------------|
|
|
2100
|
+
| `&FunctionName ++` | Append to a function |
|
|
2101
|
+
| `&ClassName::member ++` | Append to a class member (constructor/method) |
|
|
2102
|
+
| `&$instanceVar::member ++` | Append to an instance member |
|
|
2103
|
+
| `&ClassName::constructors ++` | Append to all constructors of a class |
|
|
2104
|
+
|
|
2010
2105
|
---
|
|
2011
2106
|
|
|
2012
2107
|
## Map Container
|
|
@@ -2375,6 +2470,7 @@ print(result) # ["Missing colon after def"]
|
|
|
2375
2470
|
| `-<==` | BruteInjection | Move data |
|
|
2376
2471
|
| `==>` | BruteInjection | Replace data |
|
|
2377
2472
|
| `==>-` | BruteInjection | Remove matching items |
|
|
2473
|
+
| `++` | AppendMode | Append to parent (with `&ref`) |
|
|
2378
2474
|
|
|
2379
2475
|
### Special Syntax
|
|
2380
2476
|
|
|
@@ -2386,6 +2482,9 @@ print(result) # ["Missing colon after def"]
|
|
|
2386
2482
|
| `$name` | Access shared Python object |
|
|
2387
2483
|
| `s@name` | Self-reference to struct |
|
|
2388
2484
|
| `r@name` | Global variable declaration |
|
|
2485
|
+
| `&ClassName::member` | Reference class member for append mode |
|
|
2486
|
+
| `&$instance::member` | Reference instance member for append mode |
|
|
2487
|
+
| `&FunctionName ++` | Append to function (keeps old + adds new) |
|
|
2389
2488
|
|
|
2390
2489
|
---
|
|
2391
2490
|
|
|
@@ -110,6 +110,9 @@ class TokenType(Enum):
|
|
|
110
110
|
EOF = auto()
|
|
111
111
|
# Super-functions for .cssl-pl payload files (v3.8.0)
|
|
112
112
|
SUPER_FUNC = auto() # #$run(), #$exec(), #$printl() - pre-execution hooks
|
|
113
|
+
# Append operator for constructor/function extension
|
|
114
|
+
PLUS_PLUS = auto() # ++ for constructor/function append (keeps old + adds new)
|
|
115
|
+
MINUS_MINUS = auto() # -- for potential future use
|
|
113
116
|
|
|
114
117
|
|
|
115
118
|
KEYWORDS = {
|
|
@@ -307,8 +310,13 @@ class CSSLLexer:
|
|
|
307
310
|
self._add_token(TokenType.DOT, '.')
|
|
308
311
|
self._advance()
|
|
309
312
|
elif char == '+':
|
|
313
|
+
# Check for ++ (append operator for constructor/function extension)
|
|
314
|
+
if self._peek(1) == '+':
|
|
315
|
+
self._add_token(TokenType.PLUS_PLUS, '++')
|
|
316
|
+
self._advance()
|
|
317
|
+
self._advance()
|
|
310
318
|
# Check for BruteForce Injection: +<== or +<<==
|
|
311
|
-
|
|
319
|
+
elif self._peek(1) == '<' and self._peek(2) == '<' and self._peek(3) == '=' and self._peek(4) == '=':
|
|
312
320
|
self._add_token(TokenType.INFUSE_PLUS_LEFT, '+<<==')
|
|
313
321
|
for _ in range(5): self._advance()
|
|
314
322
|
elif self._peek(1) == '<' and self._peek(2) == '=' and self._peek(3) == '=':
|
|
@@ -1491,11 +1499,13 @@ class CSSLParser:
|
|
|
1491
1499
|
|
|
1492
1500
|
Syntax:
|
|
1493
1501
|
constr ConstructorName() { ... }
|
|
1502
|
+
constr ConstructorName() ++ { ... } // Append: keeps parent constructor + adds new code
|
|
1503
|
+
constr ConstructorName() &ParentClass::constructors ++ { ... } // Append specific parent constructor
|
|
1494
1504
|
constr ConstructorName() : extends ParentClass::ConstructorName { ... }
|
|
1495
1505
|
constr ConstructorName() : extends ParentClass::ConstructorName : overwrites ParentClass::ConstructorName { ... }
|
|
1496
1506
|
|
|
1497
|
-
|
|
1498
|
-
|
|
1507
|
+
The ++ operator means: execute parent's version first, then execute this code (append mode).
|
|
1508
|
+
The &ClassName::member syntax references a specific member from the overwritten class.
|
|
1499
1509
|
"""
|
|
1500
1510
|
# Get constructor name
|
|
1501
1511
|
if not self._check(TokenType.IDENTIFIER):
|
|
@@ -1503,7 +1513,6 @@ class CSSLParser:
|
|
|
1503
1513
|
constr_name = self._advance().value
|
|
1504
1514
|
|
|
1505
1515
|
# Parse method-level extends/overwrites with :: syntax
|
|
1506
|
-
# constr Name() :: extends Parent::Name :: overwrites Parent::Name { ... }
|
|
1507
1516
|
extends_target = None
|
|
1508
1517
|
extends_class_ref = None
|
|
1509
1518
|
extends_method_ref = None
|
|
@@ -1511,12 +1520,39 @@ class CSSLParser:
|
|
|
1511
1520
|
overwrites_class_ref = None
|
|
1512
1521
|
overwrites_method_ref = None
|
|
1513
1522
|
|
|
1523
|
+
# New: Append mode and reference tracking
|
|
1524
|
+
append_mode = False # ++ operator: keep parent code + add new
|
|
1525
|
+
append_ref_class = None # &ClassName part
|
|
1526
|
+
append_ref_member = None # ::member part (constructors, functionName, etc.)
|
|
1527
|
+
|
|
1514
1528
|
# Parse parameters
|
|
1515
1529
|
params = []
|
|
1516
1530
|
if self._match(TokenType.PAREN_START):
|
|
1517
1531
|
params = self._parse_parameter_list()
|
|
1518
1532
|
self._expect(TokenType.PAREN_END)
|
|
1519
1533
|
|
|
1534
|
+
# Check for &ClassName::member reference (for targeting specific parent member)
|
|
1535
|
+
# Syntax: constr Name() &ParentClass::constructors ++ { ... }
|
|
1536
|
+
if self._match(TokenType.AMPERSAND):
|
|
1537
|
+
# Parse the class reference
|
|
1538
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1539
|
+
append_ref_class = self._advance().value
|
|
1540
|
+
elif self._check(TokenType.SHARED_REF):
|
|
1541
|
+
append_ref_class = f'${self._advance().value}'
|
|
1542
|
+
else:
|
|
1543
|
+
raise CSSLSyntaxError("Expected class name after '&' in constructor reference")
|
|
1544
|
+
|
|
1545
|
+
# Check for ::member
|
|
1546
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1547
|
+
if self._check(TokenType.IDENTIFIER) or self._check(TokenType.KEYWORD):
|
|
1548
|
+
append_ref_member = self._advance().value
|
|
1549
|
+
else:
|
|
1550
|
+
raise CSSLSyntaxError("Expected member name after '::' in constructor reference")
|
|
1551
|
+
|
|
1552
|
+
# Check for ++ append operator
|
|
1553
|
+
if self._match(TokenType.PLUS_PLUS):
|
|
1554
|
+
append_mode = True
|
|
1555
|
+
|
|
1520
1556
|
# Check for method-level extends/overwrites with :: or :
|
|
1521
1557
|
if self._match(TokenType.DOUBLE_COLON) or self._match(TokenType.COLON):
|
|
1522
1558
|
while True:
|
|
@@ -1563,7 +1599,11 @@ class CSSLParser:
|
|
|
1563
1599
|
'extends_method': extends_method_ref,
|
|
1564
1600
|
'overwrites_target': overwrites_target,
|
|
1565
1601
|
'overwrites_class': overwrites_class_ref,
|
|
1566
|
-
'overwrites_method': overwrites_method_ref
|
|
1602
|
+
'overwrites_method': overwrites_method_ref,
|
|
1603
|
+
# New append mode fields
|
|
1604
|
+
'append_mode': append_mode,
|
|
1605
|
+
'append_ref_class': append_ref_class,
|
|
1606
|
+
'append_ref_member': append_ref_member
|
|
1567
1607
|
}, children=body)
|
|
1568
1608
|
|
|
1569
1609
|
def _parse_qualified_method_ref(self) -> str:
|
|
@@ -1769,6 +1809,32 @@ class CSSLParser:
|
|
|
1769
1809
|
break
|
|
1770
1810
|
self._expect(TokenType.PAREN_END)
|
|
1771
1811
|
|
|
1812
|
+
# New: Append mode and reference tracking for functions
|
|
1813
|
+
# Syntax: define XYZ(int zahl) &overwrittenclass::functionyouwanttokeep ++ { ... }
|
|
1814
|
+
append_mode = False
|
|
1815
|
+
append_ref_class = None
|
|
1816
|
+
append_ref_member = None
|
|
1817
|
+
|
|
1818
|
+
# Check for &ClassName::member reference
|
|
1819
|
+
if self._match(TokenType.AMPERSAND):
|
|
1820
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1821
|
+
append_ref_class = self._advance().value
|
|
1822
|
+
elif self._check(TokenType.SHARED_REF):
|
|
1823
|
+
append_ref_class = f'${self._advance().value}'
|
|
1824
|
+
else:
|
|
1825
|
+
raise CSSLSyntaxError("Expected class name after '&' in function reference")
|
|
1826
|
+
|
|
1827
|
+
# Check for ::member
|
|
1828
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1829
|
+
if self._check(TokenType.IDENTIFIER) or self._check(TokenType.KEYWORD):
|
|
1830
|
+
append_ref_member = self._advance().value
|
|
1831
|
+
else:
|
|
1832
|
+
raise CSSLSyntaxError("Expected member name after '::' in function reference")
|
|
1833
|
+
|
|
1834
|
+
# Check for ++ append operator
|
|
1835
|
+
if self._match(TokenType.PLUS_PLUS):
|
|
1836
|
+
append_mode = True
|
|
1837
|
+
|
|
1772
1838
|
node = ASTNode('function', value={
|
|
1773
1839
|
'name': name,
|
|
1774
1840
|
'params': params,
|
|
@@ -1781,7 +1847,11 @@ class CSSLParser:
|
|
|
1781
1847
|
'extends_class': extends_class_ref,
|
|
1782
1848
|
'extends_method': extends_method_ref,
|
|
1783
1849
|
'overwrites_class': overwrites_class_ref,
|
|
1784
|
-
'overwrites_method': overwrites_method_ref
|
|
1850
|
+
'overwrites_method': overwrites_method_ref,
|
|
1851
|
+
# New append mode fields
|
|
1852
|
+
'append_mode': append_mode,
|
|
1853
|
+
'append_ref_class': append_ref_class,
|
|
1854
|
+
'append_ref_member': append_ref_member
|
|
1785
1855
|
}, children=[])
|
|
1786
1856
|
self._expect(TokenType.BLOCK_START)
|
|
1787
1857
|
|
|
@@ -1290,6 +1290,17 @@ class CSSLRuntime:
|
|
|
1290
1290
|
self.scope = new_scope
|
|
1291
1291
|
|
|
1292
1292
|
try:
|
|
1293
|
+
# Handle append mode (++) - execute referenced function first
|
|
1294
|
+
append_mode = func_info.get('append_mode', False)
|
|
1295
|
+
append_ref_class = func_info.get('append_ref_class')
|
|
1296
|
+
append_ref_member = func_info.get('append_ref_member')
|
|
1297
|
+
|
|
1298
|
+
if append_mode and append_ref_class:
|
|
1299
|
+
self._execute_append_reference(
|
|
1300
|
+
None, append_ref_class, append_ref_member,
|
|
1301
|
+
args, kwargs, {}, is_constructor=False
|
|
1302
|
+
)
|
|
1303
|
+
|
|
1293
1304
|
for child in func_node.children:
|
|
1294
1305
|
# Check if exit() was called
|
|
1295
1306
|
if not self._running:
|
|
@@ -3271,17 +3282,122 @@ class CSSLRuntime:
|
|
|
3271
3282
|
except TypeError:
|
|
3272
3283
|
pass
|
|
3273
3284
|
|
|
3285
|
+
def _execute_append_reference(self, instance: CSSLInstance, ref_class: str, ref_member: str,
|
|
3286
|
+
args: list, kwargs: dict, param_values: dict, is_constructor: bool = True):
|
|
3287
|
+
"""Execute referenced parent constructor/method for append mode (++).
|
|
3288
|
+
|
|
3289
|
+
Resolves the class/instance reference and executes the specified member.
|
|
3290
|
+
Supports:
|
|
3291
|
+
- Static class references: &ClassName::member
|
|
3292
|
+
- Dynamic instance references: &$instanceVar::member
|
|
3293
|
+
- Direct function references: &FunctionName (for define functions)
|
|
3294
|
+
|
|
3295
|
+
Args:
|
|
3296
|
+
instance: Current class instance (can be None for standalone functions)
|
|
3297
|
+
ref_class: Referenced class name, $instanceVar, or function name
|
|
3298
|
+
ref_member: Member name (constructor name, 'constructors', or method name) - can be None
|
|
3299
|
+
args: Arguments to pass
|
|
3300
|
+
kwargs: Keyword arguments to pass
|
|
3301
|
+
param_values: Parameter values from class params
|
|
3302
|
+
is_constructor: True if looking for constructor, False for method
|
|
3303
|
+
"""
|
|
3304
|
+
from .cssl_builtins import CSSLizedPythonObject
|
|
3305
|
+
|
|
3306
|
+
# Handle direct function reference: &FunctionName ++ (no ::member part)
|
|
3307
|
+
if ref_member is None and not is_constructor:
|
|
3308
|
+
# ref_class is actually a function name
|
|
3309
|
+
func_name = ref_class
|
|
3310
|
+
if func_name.startswith('$'):
|
|
3311
|
+
func_name = func_name[1:]
|
|
3312
|
+
|
|
3313
|
+
# Look for the function in scope
|
|
3314
|
+
func = self.scope.get(func_name) or self.global_scope.get(func_name)
|
|
3315
|
+
if func is not None:
|
|
3316
|
+
if isinstance(func, ASTNode) and func.type in ('function', 'FUNCTION'):
|
|
3317
|
+
# Execute the referenced function
|
|
3318
|
+
if instance:
|
|
3319
|
+
self._call_method(instance, func, args, kwargs)
|
|
3320
|
+
else:
|
|
3321
|
+
self._call_function(func, args, kwargs)
|
|
3322
|
+
elif callable(func):
|
|
3323
|
+
# It's a callable (Python function or lambda)
|
|
3324
|
+
func(*args, **kwargs)
|
|
3325
|
+
return
|
|
3326
|
+
|
|
3327
|
+
# Resolve the class/instance reference
|
|
3328
|
+
if ref_class.startswith('$'):
|
|
3329
|
+
# Dynamic instance reference: &$instanceVar::member
|
|
3330
|
+
var_name = ref_class[1:]
|
|
3331
|
+
ref_obj = self.scope.get(var_name) or self.global_scope.get(var_name)
|
|
3332
|
+
if ref_obj is None:
|
|
3333
|
+
return # Instance not found, skip silently
|
|
3334
|
+
|
|
3335
|
+
if isinstance(ref_obj, CSSLInstance):
|
|
3336
|
+
# Get the class definition from the instance
|
|
3337
|
+
target_class = ref_obj.class_def
|
|
3338
|
+
elif isinstance(ref_obj, CSSLClass):
|
|
3339
|
+
target_class = ref_obj
|
|
3340
|
+
else:
|
|
3341
|
+
return # Not a valid reference
|
|
3342
|
+
else:
|
|
3343
|
+
# Static class reference: &ClassName::member
|
|
3344
|
+
target_class = self.scope.get(ref_class) or self.global_scope.get(ref_class)
|
|
3345
|
+
|
|
3346
|
+
if target_class is None:
|
|
3347
|
+
return # Class not found, skip silently
|
|
3348
|
+
|
|
3349
|
+
# Handle different target types
|
|
3350
|
+
if isinstance(target_class, CSSLInstance):
|
|
3351
|
+
# Referenced an instance variable directly
|
|
3352
|
+
target_class = target_class.class_def
|
|
3353
|
+
|
|
3354
|
+
if not isinstance(target_class, CSSLClass):
|
|
3355
|
+
return # Not a CSSL class
|
|
3356
|
+
|
|
3357
|
+
# Find and execute the referenced member
|
|
3358
|
+
if is_constructor:
|
|
3359
|
+
# Looking for a constructor
|
|
3360
|
+
if ref_member == 'constructors' or ref_member is None:
|
|
3361
|
+
# Execute all constructors from the referenced class
|
|
3362
|
+
for constr in getattr(target_class, 'constructors', []):
|
|
3363
|
+
self._call_constructor(instance, constr, args, kwargs, param_values)
|
|
3364
|
+
else:
|
|
3365
|
+
# Execute specific constructor by name
|
|
3366
|
+
for constr in getattr(target_class, 'constructors', []):
|
|
3367
|
+
if constr.value.get('name') == ref_member:
|
|
3368
|
+
self._call_constructor(instance, constr, args, kwargs, param_values)
|
|
3369
|
+
break
|
|
3370
|
+
else:
|
|
3371
|
+
# Looking for a method (define function)
|
|
3372
|
+
if ref_member:
|
|
3373
|
+
# Find method in class
|
|
3374
|
+
for member in getattr(target_class, 'members', []):
|
|
3375
|
+
if member.type in ('function', 'FUNCTION') and member.value.get('name') == ref_member:
|
|
3376
|
+
self._call_method(instance, member, args, kwargs)
|
|
3377
|
+
break
|
|
3378
|
+
# Also check in methods dict if available
|
|
3379
|
+
methods = getattr(target_class, 'methods', {})
|
|
3380
|
+
if ref_member in methods:
|
|
3381
|
+
method_node = methods[ref_member]
|
|
3382
|
+
self._call_method(instance, method_node, args, kwargs)
|
|
3383
|
+
|
|
3274
3384
|
def _call_constructor(self, instance: CSSLInstance, constr_node: ASTNode,
|
|
3275
3385
|
args: list, kwargs: dict, param_values: dict):
|
|
3276
3386
|
"""Call a constructor defined with 'constr' keyword.
|
|
3277
3387
|
|
|
3278
3388
|
Handles constructor extends/overwrites and sets up the instance scope.
|
|
3389
|
+
Supports append mode (++) for keeping parent code and adding new code.
|
|
3279
3390
|
"""
|
|
3280
3391
|
constr_info = constr_node.value
|
|
3281
3392
|
constr_params = constr_info.get('params', [])
|
|
3282
3393
|
extends_class = constr_info.get('extends_class')
|
|
3283
3394
|
extends_method = constr_info.get('extends_method')
|
|
3284
3395
|
|
|
3396
|
+
# Append mode: ++ operator for keeping parent code + adding new
|
|
3397
|
+
append_mode = constr_info.get('append_mode', False)
|
|
3398
|
+
append_ref_class = constr_info.get('append_ref_class') # &ClassName or &$instanceVar
|
|
3399
|
+
append_ref_member = constr_info.get('append_ref_member') # ::constructorName or ::methodName
|
|
3400
|
+
|
|
3285
3401
|
# Save previous instance context
|
|
3286
3402
|
prev_instance = self._current_instance
|
|
3287
3403
|
self._current_instance = instance
|
|
@@ -3313,6 +3429,13 @@ class CSSLRuntime:
|
|
|
3313
3429
|
self._call_constructor(instance, constr, args, kwargs, param_values)
|
|
3314
3430
|
break
|
|
3315
3431
|
|
|
3432
|
+
# Handle append mode (++) - execute referenced parent member first
|
|
3433
|
+
if append_mode and append_ref_class:
|
|
3434
|
+
self._execute_append_reference(
|
|
3435
|
+
instance, append_ref_class, append_ref_member,
|
|
3436
|
+
args, kwargs, param_values, is_constructor=True
|
|
3437
|
+
)
|
|
3438
|
+
|
|
3316
3439
|
# Execute constructor body
|
|
3317
3440
|
prev_scope = self.scope
|
|
3318
3441
|
self.scope = new_scope
|
|
@@ -3376,12 +3499,18 @@ class CSSLRuntime:
|
|
|
3376
3499
|
"""Call a method on an instance with 'this' context.
|
|
3377
3500
|
|
|
3378
3501
|
Sets up the instance as the current 'this' context and executes the method.
|
|
3502
|
+
Supports append mode (++) for keeping parent code and adding new code.
|
|
3379
3503
|
"""
|
|
3380
3504
|
kwargs = kwargs or {}
|
|
3381
3505
|
func_info = method_node.value
|
|
3382
3506
|
params = func_info.get('params', [])
|
|
3383
3507
|
modifiers = func_info.get('modifiers', [])
|
|
3384
3508
|
|
|
3509
|
+
# Append mode: ++ operator for keeping parent code + adding new
|
|
3510
|
+
append_mode = func_info.get('append_mode', False)
|
|
3511
|
+
append_ref_class = func_info.get('append_ref_class') # &ClassName or &$instanceVar
|
|
3512
|
+
append_ref_member = func_info.get('append_ref_member') # ::methodName
|
|
3513
|
+
|
|
3385
3514
|
# Check for undefined modifier
|
|
3386
3515
|
is_undefined = 'undefined' in modifiers
|
|
3387
3516
|
|
|
@@ -3408,6 +3537,13 @@ class CSSLRuntime:
|
|
|
3408
3537
|
self._current_instance = instance
|
|
3409
3538
|
|
|
3410
3539
|
try:
|
|
3540
|
+
# Handle append mode (++) - execute referenced parent method first
|
|
3541
|
+
if append_mode and append_ref_class:
|
|
3542
|
+
self._execute_append_reference(
|
|
3543
|
+
instance, append_ref_class, append_ref_member,
|
|
3544
|
+
args, kwargs, {}, is_constructor=False
|
|
3545
|
+
)
|
|
3546
|
+
|
|
3411
3547
|
for child in method_node.children:
|
|
3412
3548
|
if not self._running:
|
|
3413
3549
|
break
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
{ "include": "#comments" },
|
|
8
8
|
{ "include": "#strings" },
|
|
9
9
|
{ "include": "#numbers" },
|
|
10
|
+
{ "include": "#append-operator" },
|
|
11
|
+
{ "include": "#append-reference" },
|
|
10
12
|
{ "include": "#class-definition" },
|
|
11
13
|
{ "include": "#function-definitions" },
|
|
12
14
|
{ "include": "#constructor-definition" },
|
|
@@ -35,6 +37,29 @@
|
|
|
35
37
|
{ "include": "#variables" }
|
|
36
38
|
],
|
|
37
39
|
"repository": {
|
|
40
|
+
"append-operator": {
|
|
41
|
+
"patterns": [
|
|
42
|
+
{
|
|
43
|
+
"comment": "++ append operator for constructor/function extension - orange",
|
|
44
|
+
"name": "constant.character.escape.infuse.cssl",
|
|
45
|
+
"match": "\\+\\+(?=\\s*\\{)"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"append-reference": {
|
|
50
|
+
"patterns": [
|
|
51
|
+
{
|
|
52
|
+
"comment": "&ClassName::member or &$var::member - all yellow for append reference",
|
|
53
|
+
"name": "entity.name.tag.super.cssl",
|
|
54
|
+
"match": "&(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(::)([a-zA-Z_][a-zA-Z0-9_]*)"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"comment": "&FunctionName - yellow for direct function reference",
|
|
58
|
+
"name": "entity.name.tag.super.cssl",
|
|
59
|
+
"match": "&([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*\\+\\+)"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
38
63
|
"non-null-declarations": {
|
|
39
64
|
"patterns": [
|
|
40
65
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
includecpp/__init__.py,sha256=
|
|
1
|
+
includecpp/__init__.py,sha256=bKXVpFFAmREaA5tWkovN7kfgZV0Pv18AJZBwMP1Gwi0,1672
|
|
2
2
|
includecpp/__init__.pyi,sha256=uSDYlbqd2TinmrdepmE_zvN25jd3Co2cgyPzXgDpopM,7193
|
|
3
3
|
includecpp/__main__.py,sha256=d6QK0PkvUe1ENofpmHRAg3bwNbZr8PiRscfI3-WRfVg,72
|
|
4
4
|
includecpp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -19,14 +19,14 @@ includecpp/core/exceptions.py,sha256=szeF4qdzi_q8hBBZi7mJxkliyQ0crplkLYe0ymlBGtk
|
|
|
19
19
|
includecpp/core/path_discovery.py,sha256=jI0oSq6Hsd4LKXmU4dOiGSrXcEO_KWMXfQ5_ylBmXvU,2561
|
|
20
20
|
includecpp/core/project_ui.py,sha256=la2EQZKmUkJGuJxnbs09hH1ZhBh9bfndo6okzZsk2dQ,141134
|
|
21
21
|
includecpp/core/settings_ui.py,sha256=B2SlwgdplF2KiBk5UYf2l8Jjifjd0F-FmBP0DPsVCEQ,11798
|
|
22
|
-
includecpp/core/cssl/CSSL_DOCUMENTATION.md,sha256=
|
|
22
|
+
includecpp/core/cssl/CSSL_DOCUMENTATION.md,sha256=ffeW2QwWCcZLB_Sx583imqaSeo4DpPun_c2E43eTnYw,50536
|
|
23
23
|
includecpp/core/cssl/__init__.py,sha256=scDXRBNK2L6A8qmlpNyaqQj6BFcSfPInBlucdeNfMF0,1975
|
|
24
24
|
includecpp/core/cssl/cssl_builtins.py,sha256=oPsPyQk5b0b1I02Y80oIaDX39GOeG32-nBPEqwbo_Pw,105110
|
|
25
25
|
includecpp/core/cssl/cssl_builtins.pyi,sha256=3ai2V4LyhzPBhAKjRRf0rLVu_bg9ECmTfTkdFKM64iA,127430
|
|
26
26
|
includecpp/core/cssl/cssl_events.py,sha256=nupIcXW_Vjdud7zCU6hdwkQRQ0MujlPM7Tk2u7eDAiY,21013
|
|
27
27
|
includecpp/core/cssl/cssl_modules.py,sha256=cUg0-zdymMnWWTsA_BUrW5dx4R04dHpKcUhm-Wfiwwo,103006
|
|
28
|
-
includecpp/core/cssl/cssl_parser.py,sha256=
|
|
29
|
-
includecpp/core/cssl/cssl_runtime.py,sha256=
|
|
28
|
+
includecpp/core/cssl/cssl_parser.py,sha256=BGS_rGZ2Jh7bp3JmUL-h-Jed_pTtNFMomLKB2P6qklQ,140173
|
|
29
|
+
includecpp/core/cssl/cssl_runtime.py,sha256=nub0UA4wtjhYPDQ61Jq6UKH1pVqwH3I7yb-Gmz7fWM0,184679
|
|
30
30
|
includecpp/core/cssl/cssl_syntax.py,sha256=bgo3NFehoPTQa5dqwNd_CstkVGVCNYAXbGYUcu5BEN0,16982
|
|
31
31
|
includecpp/core/cssl/cssl_types.py,sha256=7jbrtZf3xmVQJA_mnL9iYrmdjhjuc4--mxxNigi7fsk,53425
|
|
32
32
|
includecpp/generator/__init__.py,sha256=Rsy41bwimaEloD3gDRR_znPfIJzIsCFuWZgCTJBLJlc,62
|
|
@@ -43,10 +43,10 @@ includecpp/vscode/cssl/package.json,sha256=5MCJts7zYIgF8EdWcBnn98deIMyZamlGXvt1a
|
|
|
43
43
|
includecpp/vscode/cssl/images/cssl.png,sha256=BxAGsnfS0ZzzCvqV6Zb1OAJAZpDUoXlR86MsvUGlSZw,510
|
|
44
44
|
includecpp/vscode/cssl/images/cssl_pl.png,sha256=z4WMk7g6YCTbUUbSFk343BO6yi_OmNEVYkRenWGydwM,799
|
|
45
45
|
includecpp/vscode/cssl/snippets/cssl.snippets.json,sha256=uV3nHJyQ5f7Pr3FzfbQT2VZOEY3AlGs4wrmqe884jm4,37372
|
|
46
|
-
includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json,sha256=
|
|
47
|
-
includecpp-3.8.
|
|
48
|
-
includecpp-3.8.
|
|
49
|
-
includecpp-3.8.
|
|
50
|
-
includecpp-3.8.
|
|
51
|
-
includecpp-3.8.
|
|
52
|
-
includecpp-3.8.
|
|
46
|
+
includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json,sha256=FZw1_VDz1ll4ZBZeGqo-935CK5RuF2kD75rNp5tVdC0,35068
|
|
47
|
+
includecpp-3.8.9.dist-info/licenses/LICENSE,sha256=fWCsGGsiWZir0UzDd20Hh-3wtRyk1zqUntvtVuAWhvc,1093
|
|
48
|
+
includecpp-3.8.9.dist-info/METADATA,sha256=fKlj1rXZq7nbfWOdJn0iZtDcFRlr9tj0hHZQqdPksnI,22510
|
|
49
|
+
includecpp-3.8.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
50
|
+
includecpp-3.8.9.dist-info/entry_points.txt,sha256=6A5Mif9gi0139Bf03W5plAb3wnAgbNaEVe1HJoGE-2o,59
|
|
51
|
+
includecpp-3.8.9.dist-info/top_level.txt,sha256=RFUaR1KG-M6mCYwP6w4ydP5Cgc8yNbP78jxGAvyjMa8,11
|
|
52
|
+
includecpp-3.8.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|