IncludeCPP 3.8.4__py3-none-any.whl → 3.8.6__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 +117 -1
- includecpp/core/cssl/cssl_parser.py +280 -16
- includecpp/core/cssl/cssl_runtime.py +213 -4
- includecpp/vscode/cssl/package.json +1 -1
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +144 -9
- {includecpp-3.8.4.dist-info → includecpp-3.8.6.dist-info}/METADATA +1 -1
- {includecpp-3.8.4.dist-info → includecpp-3.8.6.dist-info}/RECORD +12 -12
- {includecpp-3.8.4.dist-info → includecpp-3.8.6.dist-info}/WHEEL +0 -0
- {includecpp-3.8.4.dist-info → includecpp-3.8.6.dist-info}/entry_points.txt +0 -0
- {includecpp-3.8.4.dist-info → includecpp-3.8.6.dist-info}/licenses/LICENSE +0 -0
- {includecpp-3.8.4.dist-info → includecpp-3.8.6.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.6 | A modern scripting language with C++-style syntax and unique features like CodeInfusion, BruteInjection, and Python Interop.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1891,6 +1891,122 @@ define process(open *Params) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
```
|
|
1893
1893
|
|
|
1894
|
+
### Class Constructors with `constr` Keyword
|
|
1895
|
+
|
|
1896
|
+
The `constr` keyword defines explicit constructors inside classes. Multiple constructors can be defined and will be executed in order.
|
|
1897
|
+
|
|
1898
|
+
```cssl
|
|
1899
|
+
// Class with constructor parameters in declaration
|
|
1900
|
+
class Vehicle (string brand, int year) {
|
|
1901
|
+
string make;
|
|
1902
|
+
int modelYear;
|
|
1903
|
+
|
|
1904
|
+
// Constructor using constr keyword
|
|
1905
|
+
constr Initialize() {
|
|
1906
|
+
// brand and year are available from class parameters
|
|
1907
|
+
this->make = brand;
|
|
1908
|
+
this->modelYear = year;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// Additional constructor - executed after Initialize
|
|
1912
|
+
constr SetupDefaults() {
|
|
1913
|
+
printl("Vehicle created: " + this->make);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
Vehicle v = new Vehicle("Toyota", 2024);
|
|
1918
|
+
```
|
|
1919
|
+
|
|
1920
|
+
### Constructor Inheritance with `super()`
|
|
1921
|
+
|
|
1922
|
+
Use `super()` to call parent class constructors and methods:
|
|
1923
|
+
|
|
1924
|
+
```cssl
|
|
1925
|
+
class Animal {
|
|
1926
|
+
string name;
|
|
1927
|
+
|
|
1928
|
+
void Animal(string n) {
|
|
1929
|
+
this->name = n;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
void speak() {
|
|
1933
|
+
printl("Generic sound");
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
class Dog : extends Animal {
|
|
1938
|
+
string breed;
|
|
1939
|
+
|
|
1940
|
+
constr DogInit(string n, string b) {
|
|
1941
|
+
super(n); // Call parent constructor with name
|
|
1942
|
+
this->breed = b;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
void speak() {
|
|
1946
|
+
super::speak(); // Call parent's speak method
|
|
1947
|
+
printl("Woof! I'm " + this->name);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
Dog d = new Dog("Buddy", "Labrador");
|
|
1952
|
+
d.speak();
|
|
1953
|
+
// Output:
|
|
1954
|
+
// Generic sound
|
|
1955
|
+
// Woof! I'm Buddy
|
|
1956
|
+
```
|
|
1957
|
+
|
|
1958
|
+
### Constructor Extends with Arguments
|
|
1959
|
+
|
|
1960
|
+
Pass arguments to parent constructors in class declaration:
|
|
1961
|
+
|
|
1962
|
+
```cssl
|
|
1963
|
+
class Parent {
|
|
1964
|
+
int value;
|
|
1965
|
+
|
|
1966
|
+
void Parent(int v) {
|
|
1967
|
+
this->value = v;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// Pass arguments to parent constructor using extends (arg1, arg2)
|
|
1972
|
+
class Child : extends Parent ("defaultValue") {
|
|
1973
|
+
constr ChildInit() {
|
|
1974
|
+
// Parent constructor already called with "defaultValue"
|
|
1975
|
+
printl("Child value: " + this->value);
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
```
|
|
1979
|
+
|
|
1980
|
+
### Method-Level Extends & Overwrites
|
|
1981
|
+
|
|
1982
|
+
Functions and methods can extend or overwrite specific methods in parent classes using `::` syntax:
|
|
1983
|
+
|
|
1984
|
+
```cssl
|
|
1985
|
+
class Base {
|
|
1986
|
+
constr Init() {
|
|
1987
|
+
printl("Base init");
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
void process() {
|
|
1991
|
+
printl("Base processing");
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
class Derived : extends Base {
|
|
1996
|
+
// Extend specific parent constructor
|
|
1997
|
+
constr DerivedInit() :: extends Base::Init {
|
|
1998
|
+
// Base::Init local vars are available here
|
|
1999
|
+
printl("Derived init");
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
// Or define a method that extends parent method
|
|
2003
|
+
define customProcess :: extends Base::process() {
|
|
2004
|
+
// Has access to Base::process local variables
|
|
2005
|
+
printl("Extended processing");
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
```
|
|
2009
|
+
|
|
1894
2010
|
---
|
|
1895
2011
|
|
|
1896
2012
|
## Map Container
|
|
@@ -114,7 +114,7 @@ class TokenType(Enum):
|
|
|
114
114
|
|
|
115
115
|
KEYWORDS = {
|
|
116
116
|
# Service structure
|
|
117
|
-
'service-init', 'service-run', 'service-include', 'struct', 'define', 'main', 'class', 'extends', 'overwrites', 'new', 'this',
|
|
117
|
+
'service-init', 'service-run', 'service-include', 'struct', 'define', 'main', 'class', 'constr', 'extends', 'overwrites', 'new', 'this', 'super',
|
|
118
118
|
# Control flow
|
|
119
119
|
'if', 'else', 'elif', 'while', 'for', 'foreach', 'in', 'range',
|
|
120
120
|
'switch', 'case', 'default', 'break', 'continue', 'return',
|
|
@@ -1383,12 +1383,20 @@ class CSSLParser:
|
|
|
1383
1383
|
|
|
1384
1384
|
class_name = self._advance().value
|
|
1385
1385
|
|
|
1386
|
+
# Check for class-level constructor parameters: class MyClass (int x, string y) { ... }
|
|
1387
|
+
class_params = []
|
|
1388
|
+
if self._match(TokenType.PAREN_START):
|
|
1389
|
+
class_params = self._parse_parameter_list()
|
|
1390
|
+
self._expect(TokenType.PAREN_END)
|
|
1391
|
+
|
|
1386
1392
|
# Check for inheritance and overwrites:
|
|
1387
1393
|
# class Child : extends Parent { ... }
|
|
1388
1394
|
# class Child : extends $PythonObject { ... }
|
|
1389
1395
|
# class Child : extends Parent : overwrites Parent { ... }
|
|
1396
|
+
# class Child : extends Parent (param1, param2) { ... } <- constructor args for parent
|
|
1390
1397
|
extends_class = None
|
|
1391
1398
|
extends_is_python = False
|
|
1399
|
+
extends_args = []
|
|
1392
1400
|
overwrites_class = None
|
|
1393
1401
|
overwrites_is_python = False
|
|
1394
1402
|
|
|
@@ -1403,6 +1411,13 @@ class CSSLParser:
|
|
|
1403
1411
|
extends_is_python = True
|
|
1404
1412
|
else:
|
|
1405
1413
|
raise CSSLSyntaxError("Expected parent class name after 'extends'")
|
|
1414
|
+
# Check for constructor arguments: extends Parent (arg1, arg2)
|
|
1415
|
+
if self._match(TokenType.PAREN_START):
|
|
1416
|
+
while not self._check(TokenType.PAREN_END):
|
|
1417
|
+
arg = self._parse_expression()
|
|
1418
|
+
extends_args.append(arg)
|
|
1419
|
+
self._match(TokenType.COMMA)
|
|
1420
|
+
self._expect(TokenType.PAREN_END)
|
|
1406
1421
|
elif self._match_keyword('overwrites'):
|
|
1407
1422
|
if self._check(TokenType.IDENTIFIER):
|
|
1408
1423
|
overwrites_class = self._advance().value
|
|
@@ -1423,8 +1438,10 @@ class CSSLParser:
|
|
|
1423
1438
|
node = ASTNode('class', value={
|
|
1424
1439
|
'name': class_name,
|
|
1425
1440
|
'non_null': non_null,
|
|
1441
|
+
'class_params': class_params,
|
|
1426
1442
|
'extends': extends_class,
|
|
1427
1443
|
'extends_is_python': extends_is_python,
|
|
1444
|
+
'extends_args': extends_args,
|
|
1428
1445
|
'overwrites': overwrites_class,
|
|
1429
1446
|
'overwrites_is_python': overwrites_is_python
|
|
1430
1447
|
}, children=[])
|
|
@@ -1456,12 +1473,172 @@ class CSSLParser:
|
|
|
1456
1473
|
method = self._parse_define()
|
|
1457
1474
|
node.children.append(method)
|
|
1458
1475
|
|
|
1476
|
+
# Check for constr keyword (constructor declaration)
|
|
1477
|
+
# Syntax: constr ConstructorName() { ... }
|
|
1478
|
+
# or: constr ConstructorName() : extends Parent::ConstructorName { ... }
|
|
1479
|
+
elif self._match_keyword('constr'):
|
|
1480
|
+
constructor = self._parse_constructor(class_name)
|
|
1481
|
+
node.children.append(constructor)
|
|
1482
|
+
|
|
1459
1483
|
else:
|
|
1460
1484
|
self._advance()
|
|
1461
1485
|
|
|
1462
1486
|
self._expect(TokenType.BLOCK_END)
|
|
1463
1487
|
return node
|
|
1464
1488
|
|
|
1489
|
+
def _parse_constructor(self, class_name: str) -> ASTNode:
|
|
1490
|
+
"""Parse constructor declaration inside a class.
|
|
1491
|
+
|
|
1492
|
+
Syntax:
|
|
1493
|
+
constr ConstructorName() { ... }
|
|
1494
|
+
constr ConstructorName() : extends ParentClass::ConstructorName { ... }
|
|
1495
|
+
constr ConstructorName() : extends ParentClass::ConstructorName : overwrites ParentClass::ConstructorName { ... }
|
|
1496
|
+
|
|
1497
|
+
Multiple constructors are allowed and executed in order.
|
|
1498
|
+
Constructors can access parent constructor via super().
|
|
1499
|
+
"""
|
|
1500
|
+
# Get constructor name
|
|
1501
|
+
if not self._check(TokenType.IDENTIFIER):
|
|
1502
|
+
raise CSSLSyntaxError("Expected constructor name after 'constr'")
|
|
1503
|
+
constr_name = self._advance().value
|
|
1504
|
+
|
|
1505
|
+
# Parse method-level extends/overwrites with :: syntax
|
|
1506
|
+
# constr Name() :: extends Parent::Name :: overwrites Parent::Name { ... }
|
|
1507
|
+
extends_target = None
|
|
1508
|
+
extends_class_ref = None
|
|
1509
|
+
extends_method_ref = None
|
|
1510
|
+
overwrites_target = None
|
|
1511
|
+
overwrites_class_ref = None
|
|
1512
|
+
overwrites_method_ref = None
|
|
1513
|
+
|
|
1514
|
+
# Parse parameters
|
|
1515
|
+
params = []
|
|
1516
|
+
if self._match(TokenType.PAREN_START):
|
|
1517
|
+
params = self._parse_parameter_list()
|
|
1518
|
+
self._expect(TokenType.PAREN_END)
|
|
1519
|
+
|
|
1520
|
+
# Check for method-level extends/overwrites with :: or :
|
|
1521
|
+
if self._match(TokenType.DOUBLE_COLON) or self._match(TokenType.COLON):
|
|
1522
|
+
while True:
|
|
1523
|
+
if self._match_keyword('extends'):
|
|
1524
|
+
# Parse Parent::method or just method
|
|
1525
|
+
extends_target = self._parse_qualified_method_ref()
|
|
1526
|
+
if '::' in extends_target:
|
|
1527
|
+
parts = extends_target.split('::')
|
|
1528
|
+
extends_class_ref = parts[0]
|
|
1529
|
+
extends_method_ref = parts[1]
|
|
1530
|
+
else:
|
|
1531
|
+
extends_method_ref = extends_target
|
|
1532
|
+
elif self._match_keyword('overwrites'):
|
|
1533
|
+
# Parse Parent::method or just method
|
|
1534
|
+
overwrites_target = self._parse_qualified_method_ref()
|
|
1535
|
+
if '::' in overwrites_target:
|
|
1536
|
+
parts = overwrites_target.split('::')
|
|
1537
|
+
overwrites_class_ref = parts[0]
|
|
1538
|
+
overwrites_method_ref = parts[1]
|
|
1539
|
+
else:
|
|
1540
|
+
overwrites_method_ref = overwrites_target
|
|
1541
|
+
else:
|
|
1542
|
+
break
|
|
1543
|
+
# Check for another :: or : for chaining
|
|
1544
|
+
if not (self._match(TokenType.DOUBLE_COLON) or self._match(TokenType.COLON)):
|
|
1545
|
+
break
|
|
1546
|
+
|
|
1547
|
+
# Parse constructor body
|
|
1548
|
+
self._expect(TokenType.BLOCK_START)
|
|
1549
|
+
body = []
|
|
1550
|
+
while not self._check(TokenType.BLOCK_END) and not self._is_at_end():
|
|
1551
|
+
stmt = self._parse_statement()
|
|
1552
|
+
if stmt:
|
|
1553
|
+
body.append(stmt)
|
|
1554
|
+
self._expect(TokenType.BLOCK_END)
|
|
1555
|
+
|
|
1556
|
+
return ASTNode('constructor', value={
|
|
1557
|
+
'name': constr_name,
|
|
1558
|
+
'class_name': class_name,
|
|
1559
|
+
'params': params,
|
|
1560
|
+
'is_constructor': True,
|
|
1561
|
+
'extends_target': extends_target,
|
|
1562
|
+
'extends_class': extends_class_ref,
|
|
1563
|
+
'extends_method': extends_method_ref,
|
|
1564
|
+
'overwrites_target': overwrites_target,
|
|
1565
|
+
'overwrites_class': overwrites_class_ref,
|
|
1566
|
+
'overwrites_method': overwrites_method_ref
|
|
1567
|
+
}, children=body)
|
|
1568
|
+
|
|
1569
|
+
def _parse_qualified_method_ref(self) -> str:
|
|
1570
|
+
"""Parse a qualified method reference like 'ParentClass::methodName' or just 'methodName'.
|
|
1571
|
+
|
|
1572
|
+
Returns the qualified name as a string (e.g., 'Parent::init' or just 'init').
|
|
1573
|
+
"""
|
|
1574
|
+
# Check for $PythonObject
|
|
1575
|
+
if self._check(TokenType.SHARED_REF):
|
|
1576
|
+
class_ref = self._advance().value # Gets the name without $
|
|
1577
|
+
class_ref = f'${class_ref}'
|
|
1578
|
+
elif self._check(TokenType.IDENTIFIER):
|
|
1579
|
+
class_ref = self._advance().value
|
|
1580
|
+
else:
|
|
1581
|
+
raise CSSLSyntaxError("Expected class or method name in extends/overwrites")
|
|
1582
|
+
|
|
1583
|
+
# Check for :: to get method part
|
|
1584
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1585
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1586
|
+
method_ref = self._advance().value
|
|
1587
|
+
return f'{class_ref}::{method_ref}'
|
|
1588
|
+
else:
|
|
1589
|
+
raise CSSLSyntaxError("Expected method name after '::'")
|
|
1590
|
+
|
|
1591
|
+
# Just method name, no class qualifier
|
|
1592
|
+
return class_ref
|
|
1593
|
+
|
|
1594
|
+
def _parse_parameter_list(self) -> list:
|
|
1595
|
+
"""Parse a list of parameters (without the surrounding parentheses).
|
|
1596
|
+
|
|
1597
|
+
Returns a list of parameter definitions, each can be:
|
|
1598
|
+
- Simple string name: "paramName"
|
|
1599
|
+
- Dict with type info: {'name': 'paramName', 'type': 'string', 'ref': True, ...}
|
|
1600
|
+
"""
|
|
1601
|
+
params = []
|
|
1602
|
+
while not self._check(TokenType.PAREN_END) and not self._is_at_end():
|
|
1603
|
+
param_info = {}
|
|
1604
|
+
|
|
1605
|
+
# Handle 'open' keyword for open parameters
|
|
1606
|
+
if self._match_keyword('open'):
|
|
1607
|
+
param_info['open'] = True
|
|
1608
|
+
|
|
1609
|
+
# Handle type annotations (e.g., string, int, dynamic, etc.)
|
|
1610
|
+
if self._check(TokenType.KEYWORD):
|
|
1611
|
+
param_info['type'] = self._advance().value
|
|
1612
|
+
|
|
1613
|
+
# Handle reference operator &
|
|
1614
|
+
if self._match(TokenType.AMPERSAND):
|
|
1615
|
+
param_info['ref'] = True
|
|
1616
|
+
|
|
1617
|
+
# Handle * prefix for non-null parameters
|
|
1618
|
+
if self._match(TokenType.MULTIPLY):
|
|
1619
|
+
param_info['non_null'] = True
|
|
1620
|
+
|
|
1621
|
+
# Get parameter name
|
|
1622
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1623
|
+
param_name = self._advance().value
|
|
1624
|
+
if param_info:
|
|
1625
|
+
params.append({'name': param_name, **param_info})
|
|
1626
|
+
else:
|
|
1627
|
+
params.append(param_name)
|
|
1628
|
+
self._match(TokenType.COMMA)
|
|
1629
|
+
elif self._check(TokenType.KEYWORD):
|
|
1630
|
+
# Parameter name could be a keyword like 'Params'
|
|
1631
|
+
param_name = self._advance().value
|
|
1632
|
+
if param_info:
|
|
1633
|
+
params.append({'name': param_name, **param_info})
|
|
1634
|
+
else:
|
|
1635
|
+
params.append(param_name)
|
|
1636
|
+
self._match(TokenType.COMMA)
|
|
1637
|
+
else:
|
|
1638
|
+
break
|
|
1639
|
+
|
|
1640
|
+
return params
|
|
1641
|
+
|
|
1465
1642
|
def _parse_define(self) -> ASTNode:
|
|
1466
1643
|
"""Parse define function declaration.
|
|
1467
1644
|
|
|
@@ -1470,6 +1647,7 @@ class CSSLParser:
|
|
|
1470
1647
|
define *MyFunc(args) { } // Non-null: must never return None
|
|
1471
1648
|
define MyFunc : extends OtherFunc() { } // Inherit local vars
|
|
1472
1649
|
define MyFunc : overwrites OtherFunc() { } // Replace OtherFunc
|
|
1650
|
+
define MyFunc :: extends Parent::Method :: overwrites Parent::Method() { } // Method-level inheritance
|
|
1473
1651
|
"""
|
|
1474
1652
|
# Check for * prefix (non-null function - must return non-null)
|
|
1475
1653
|
non_null = False
|
|
@@ -1479,40 +1657,79 @@ class CSSLParser:
|
|
|
1479
1657
|
name = self._advance().value
|
|
1480
1658
|
|
|
1481
1659
|
# Check for extends/overwrites: define func : extends/overwrites target() { }
|
|
1660
|
+
# Also supports method-level :: syntax: define func :: extends Parent::method
|
|
1482
1661
|
extends_func = None
|
|
1483
1662
|
overwrites_func = None
|
|
1484
1663
|
extends_is_python = False
|
|
1485
1664
|
overwrites_is_python = False
|
|
1665
|
+
extends_class_ref = None
|
|
1666
|
+
extends_method_ref = None
|
|
1667
|
+
overwrites_class_ref = None
|
|
1668
|
+
overwrites_method_ref = None
|
|
1486
1669
|
|
|
1487
|
-
if self._match(TokenType.COLON):
|
|
1488
|
-
# Parse extends and/or overwrites
|
|
1670
|
+
if self._match(TokenType.DOUBLE_COLON) or self._match(TokenType.COLON):
|
|
1671
|
+
# Parse extends and/or overwrites (supports :: method-level syntax)
|
|
1489
1672
|
while True:
|
|
1490
1673
|
if self._match_keyword('extends'):
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
elif self._check(TokenType.SHARED_REF):
|
|
1494
|
-
extends_func = self._advance().value
|
|
1674
|
+
# Check for qualified reference: Parent::method
|
|
1675
|
+
if self._check(TokenType.SHARED_REF):
|
|
1495
1676
|
extends_is_python = True
|
|
1677
|
+
extends_func = self._advance().value
|
|
1678
|
+
# Check for ::method
|
|
1679
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1680
|
+
extends_class_ref = f'${extends_func}'
|
|
1681
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1682
|
+
extends_method_ref = self._advance().value
|
|
1683
|
+
else:
|
|
1684
|
+
raise CSSLSyntaxError("Expected method name after '::'")
|
|
1685
|
+
elif self._check(TokenType.IDENTIFIER):
|
|
1686
|
+
first_part = self._advance().value
|
|
1687
|
+
# Check for ::method (qualified reference)
|
|
1688
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1689
|
+
extends_class_ref = first_part
|
|
1690
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1691
|
+
extends_method_ref = self._advance().value
|
|
1692
|
+
else:
|
|
1693
|
+
raise CSSLSyntaxError("Expected method name after '::'")
|
|
1694
|
+
else:
|
|
1695
|
+
extends_func = first_part
|
|
1496
1696
|
else:
|
|
1497
1697
|
raise CSSLSyntaxError("Expected function name after 'extends'")
|
|
1498
|
-
# Skip optional () after function name
|
|
1698
|
+
# Skip optional () after function/method name
|
|
1499
1699
|
if self._match(TokenType.PAREN_START):
|
|
1500
1700
|
self._expect(TokenType.PAREN_END)
|
|
1501
1701
|
elif self._match_keyword('overwrites'):
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
elif self._check(TokenType.SHARED_REF):
|
|
1505
|
-
overwrites_func = self._advance().value
|
|
1702
|
+
# Check for qualified reference: Parent::method
|
|
1703
|
+
if self._check(TokenType.SHARED_REF):
|
|
1506
1704
|
overwrites_is_python = True
|
|
1705
|
+
overwrites_func = self._advance().value
|
|
1706
|
+
# Check for ::method
|
|
1707
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1708
|
+
overwrites_class_ref = f'${overwrites_func}'
|
|
1709
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1710
|
+
overwrites_method_ref = self._advance().value
|
|
1711
|
+
else:
|
|
1712
|
+
raise CSSLSyntaxError("Expected method name after '::'")
|
|
1713
|
+
elif self._check(TokenType.IDENTIFIER):
|
|
1714
|
+
first_part = self._advance().value
|
|
1715
|
+
# Check for ::method (qualified reference)
|
|
1716
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1717
|
+
overwrites_class_ref = first_part
|
|
1718
|
+
if self._check(TokenType.IDENTIFIER):
|
|
1719
|
+
overwrites_method_ref = self._advance().value
|
|
1720
|
+
else:
|
|
1721
|
+
raise CSSLSyntaxError("Expected method name after '::'")
|
|
1722
|
+
else:
|
|
1723
|
+
overwrites_func = first_part
|
|
1507
1724
|
else:
|
|
1508
1725
|
raise CSSLSyntaxError("Expected function name after 'overwrites'")
|
|
1509
|
-
# Skip optional () after function name
|
|
1726
|
+
# Skip optional () after function/method name
|
|
1510
1727
|
if self._match(TokenType.PAREN_START):
|
|
1511
1728
|
self._expect(TokenType.PAREN_END)
|
|
1512
1729
|
else:
|
|
1513
1730
|
break
|
|
1514
|
-
# Check for another : for chaining extends/overwrites
|
|
1515
|
-
if not self._match(TokenType.COLON):
|
|
1731
|
+
# Check for another :: or : for chaining extends/overwrites
|
|
1732
|
+
if not (self._match(TokenType.DOUBLE_COLON) or self._match(TokenType.COLON)):
|
|
1516
1733
|
break
|
|
1517
1734
|
|
|
1518
1735
|
params = []
|
|
@@ -1559,7 +1776,12 @@ class CSSLParser:
|
|
|
1559
1776
|
'extends': extends_func,
|
|
1560
1777
|
'extends_is_python': extends_is_python,
|
|
1561
1778
|
'overwrites': overwrites_func,
|
|
1562
|
-
'overwrites_is_python': overwrites_is_python
|
|
1779
|
+
'overwrites_is_python': overwrites_is_python,
|
|
1780
|
+
# Method-level inheritance (Parent::method syntax)
|
|
1781
|
+
'extends_class': extends_class_ref,
|
|
1782
|
+
'extends_method': extends_method_ref,
|
|
1783
|
+
'overwrites_class': overwrites_class_ref,
|
|
1784
|
+
'overwrites_method': overwrites_method_ref
|
|
1563
1785
|
}, children=[])
|
|
1564
1786
|
self._expect(TokenType.BLOCK_START)
|
|
1565
1787
|
|
|
@@ -1606,6 +1828,11 @@ class CSSLParser:
|
|
|
1606
1828
|
elif self._check(TokenType.SUPER_FUNC):
|
|
1607
1829
|
# Super-function for .cssl-pl payload files
|
|
1608
1830
|
return self._parse_super_function()
|
|
1831
|
+
elif (self._check(TokenType.KEYWORD) and self._current().value == 'super' and
|
|
1832
|
+
(self._peek(1).type == TokenType.PAREN_START or
|
|
1833
|
+
self._peek(1).type == TokenType.DOUBLE_COLON)):
|
|
1834
|
+
# super() or super::method() call - calls parent constructor/method
|
|
1835
|
+
return self._parse_super_call()
|
|
1609
1836
|
elif (self._check(TokenType.IDENTIFIER) or self._check(TokenType.AT) or
|
|
1610
1837
|
self._check(TokenType.CAPTURED_REF) or self._check(TokenType.SHARED_REF) or
|
|
1611
1838
|
self._check(TokenType.GLOBAL_REF) or self._check(TokenType.SELF_REF) or
|
|
@@ -1616,6 +1843,43 @@ class CSSLParser:
|
|
|
1616
1843
|
self._advance()
|
|
1617
1844
|
return None
|
|
1618
1845
|
|
|
1846
|
+
def _parse_super_call(self) -> ASTNode:
|
|
1847
|
+
"""Parse super() call to invoke parent constructor or method.
|
|
1848
|
+
|
|
1849
|
+
Syntax:
|
|
1850
|
+
super() - Call parent constructor with no args
|
|
1851
|
+
super(arg1, arg2) - Call parent constructor with args
|
|
1852
|
+
super::method() - Call specific parent method
|
|
1853
|
+
super::method(args) - Call specific parent method with args
|
|
1854
|
+
|
|
1855
|
+
Used inside constructors (constr) and methods to call parent implementations.
|
|
1856
|
+
"""
|
|
1857
|
+
# Consume 'super' keyword
|
|
1858
|
+
self._advance()
|
|
1859
|
+
|
|
1860
|
+
# Check for ::method syntax
|
|
1861
|
+
target_method = None
|
|
1862
|
+
if self._match(TokenType.DOUBLE_COLON):
|
|
1863
|
+
if not self._check(TokenType.IDENTIFIER):
|
|
1864
|
+
raise CSSLSyntaxError("Expected method name after 'super::'")
|
|
1865
|
+
target_method = self._advance().value
|
|
1866
|
+
|
|
1867
|
+
# Parse arguments
|
|
1868
|
+
args = []
|
|
1869
|
+
self._expect(TokenType.PAREN_START)
|
|
1870
|
+
while not self._check(TokenType.PAREN_END):
|
|
1871
|
+
arg = self._parse_expression()
|
|
1872
|
+
args.append(arg)
|
|
1873
|
+
if not self._match(TokenType.COMMA):
|
|
1874
|
+
break
|
|
1875
|
+
self._expect(TokenType.PAREN_END)
|
|
1876
|
+
self._match(TokenType.SEMICOLON)
|
|
1877
|
+
|
|
1878
|
+
return ASTNode('super_call', value={
|
|
1879
|
+
'method': target_method, # None for constructor, method name for specific method
|
|
1880
|
+
'args': args
|
|
1881
|
+
})
|
|
1882
|
+
|
|
1619
1883
|
def _parse_if(self) -> ASTNode:
|
|
1620
1884
|
"""Parse if statement with support for else if AND elif syntax."""
|
|
1621
1885
|
self._expect(TokenType.PAREN_START)
|
|
@@ -755,11 +755,20 @@ class CSSLRuntime:
|
|
|
755
755
|
|
|
756
756
|
members = {} # Member variable defaults/types
|
|
757
757
|
methods = {} # Method AST nodes
|
|
758
|
-
|
|
758
|
+
constructors = [] # List of constructors (multiple allowed with constr keyword)
|
|
759
|
+
constructor = None # Primary constructor (backward compatibility)
|
|
760
|
+
|
|
761
|
+
# Get class parameters and extends args
|
|
762
|
+
class_params = class_info.get('class_params', [])
|
|
763
|
+
extends_args = class_info.get('extends_args', [])
|
|
759
764
|
|
|
760
765
|
for child in node.children:
|
|
761
|
-
if child.type == '
|
|
762
|
-
#
|
|
766
|
+
if child.type == 'constructor':
|
|
767
|
+
# New-style constructor from 'constr' keyword
|
|
768
|
+
constructors.append(child)
|
|
769
|
+
|
|
770
|
+
elif child.type == 'function':
|
|
771
|
+
# This is a method or old-style constructor
|
|
763
772
|
func_info = child.value
|
|
764
773
|
method_name = func_info.get('name')
|
|
765
774
|
|
|
@@ -789,6 +798,10 @@ class CSSLRuntime:
|
|
|
789
798
|
constructor=constructor,
|
|
790
799
|
parent=parent_class
|
|
791
800
|
)
|
|
801
|
+
# Store additional constructor info
|
|
802
|
+
class_def.constructors = constructors # Multiple constructors from 'constr' keyword
|
|
803
|
+
class_def.class_params = class_params # Class-level constructor parameters
|
|
804
|
+
class_def.extends_args = extends_args # Arguments to pass to parent constructor
|
|
792
805
|
|
|
793
806
|
# Register class in scope
|
|
794
807
|
self.scope.set(class_name, class_def)
|
|
@@ -1497,6 +1510,82 @@ class CSSLRuntime:
|
|
|
1497
1510
|
"""Execute continue statement"""
|
|
1498
1511
|
raise CSSLContinue()
|
|
1499
1512
|
|
|
1513
|
+
def _exec_constructor(self, node: ASTNode) -> Any:
|
|
1514
|
+
"""Execute constructor node - only called when encountered directly.
|
|
1515
|
+
|
|
1516
|
+
Normally constructors are executed through _call_constructor in _eval_new.
|
|
1517
|
+
This handles cases where a constructor node is executed in other contexts.
|
|
1518
|
+
"""
|
|
1519
|
+
# Constructor nodes should be handled during class instantiation
|
|
1520
|
+
# If we reach here, it's in a context where the constructor is stored but not executed
|
|
1521
|
+
return None
|
|
1522
|
+
|
|
1523
|
+
def _exec_super_call(self, node: ASTNode) -> Any:
|
|
1524
|
+
"""Execute super() call to invoke parent constructor or method.
|
|
1525
|
+
|
|
1526
|
+
Syntax:
|
|
1527
|
+
super() - Call parent constructor with no args
|
|
1528
|
+
super(arg1, arg2) - Call parent constructor with args
|
|
1529
|
+
super::method() - Call specific parent method
|
|
1530
|
+
super::method(args) - Call specific parent method with args
|
|
1531
|
+
"""
|
|
1532
|
+
if self._current_instance is None:
|
|
1533
|
+
raise CSSLRuntimeError(
|
|
1534
|
+
"super() called outside of class context",
|
|
1535
|
+
node.line if hasattr(node, 'line') else 0,
|
|
1536
|
+
hint="super() can only be used inside class constructors and methods"
|
|
1537
|
+
)
|
|
1538
|
+
|
|
1539
|
+
instance = self._current_instance
|
|
1540
|
+
|
|
1541
|
+
# Try to get parent from instance first, then from class definition
|
|
1542
|
+
parent = getattr(instance, '_parent_class', None)
|
|
1543
|
+
if parent is None and hasattr(instance, '_class') and instance._class:
|
|
1544
|
+
parent = getattr(instance._class, 'parent', None)
|
|
1545
|
+
|
|
1546
|
+
if parent is None:
|
|
1547
|
+
raise CSSLRuntimeError(
|
|
1548
|
+
"super() called but class has no parent",
|
|
1549
|
+
node.line if hasattr(node, 'line') else 0,
|
|
1550
|
+
hint="super() requires the class to extend another class"
|
|
1551
|
+
)
|
|
1552
|
+
|
|
1553
|
+
method_name = node.value.get('method')
|
|
1554
|
+
args = [self._evaluate(arg) for arg in node.value.get('args', [])]
|
|
1555
|
+
|
|
1556
|
+
from .cssl_builtins import CSSLizedPythonObject
|
|
1557
|
+
|
|
1558
|
+
if method_name:
|
|
1559
|
+
# super::method() - call specific parent method
|
|
1560
|
+
if isinstance(parent, CSSLClass):
|
|
1561
|
+
method = parent.methods.get(method_name)
|
|
1562
|
+
if method:
|
|
1563
|
+
return self._call_method(instance, method, args, {})
|
|
1564
|
+
else:
|
|
1565
|
+
raise CSSLRuntimeError(
|
|
1566
|
+
f"Parent class has no method '{method_name}'",
|
|
1567
|
+
node.line if hasattr(node, 'line') else 0
|
|
1568
|
+
)
|
|
1569
|
+
elif isinstance(parent, CSSLizedPythonObject):
|
|
1570
|
+
py_obj = parent.get_python_obj()
|
|
1571
|
+
if hasattr(py_obj, method_name):
|
|
1572
|
+
method = getattr(py_obj, method_name)
|
|
1573
|
+
return method(*args)
|
|
1574
|
+
else:
|
|
1575
|
+
raise CSSLRuntimeError(
|
|
1576
|
+
f"Parent Python object has no method '{method_name}'",
|
|
1577
|
+
node.line if hasattr(node, 'line') else 0
|
|
1578
|
+
)
|
|
1579
|
+
elif hasattr(parent, method_name):
|
|
1580
|
+
method = getattr(parent, method_name)
|
|
1581
|
+
return method(*args)
|
|
1582
|
+
else:
|
|
1583
|
+
# super() - call parent constructor
|
|
1584
|
+
self._call_parent_constructor(instance, args)
|
|
1585
|
+
instance._parent_constructor_called = True
|
|
1586
|
+
|
|
1587
|
+
return None
|
|
1588
|
+
|
|
1500
1589
|
def _exec_try(self, node: ASTNode) -> Any:
|
|
1501
1590
|
"""Execute try/catch block"""
|
|
1502
1591
|
try:
|
|
@@ -3082,6 +3171,8 @@ class CSSLRuntime:
|
|
|
3082
3171
|
"""Evaluate 'new ClassName(args)' expression.
|
|
3083
3172
|
|
|
3084
3173
|
Creates a new instance of a CSSL class and calls its constructor.
|
|
3174
|
+
Supports multiple constructors (constr keyword), class parameters,
|
|
3175
|
+
and automatic parent constructor calling.
|
|
3085
3176
|
"""
|
|
3086
3177
|
class_name = node.value.get('class')
|
|
3087
3178
|
args = [self._evaluate(arg) for arg in node.value.get('args', [])]
|
|
@@ -3109,12 +3200,130 @@ class CSSLRuntime:
|
|
|
3109
3200
|
# Create new instance
|
|
3110
3201
|
instance = CSSLInstance(class_def)
|
|
3111
3202
|
|
|
3112
|
-
#
|
|
3203
|
+
# Store parent class reference for super() calls
|
|
3204
|
+
instance._parent_class = class_def.parent
|
|
3205
|
+
instance._parent_constructor_called = False
|
|
3206
|
+
|
|
3207
|
+
# Get class params and extends args
|
|
3208
|
+
class_params = getattr(class_def, 'class_params', [])
|
|
3209
|
+
extends_args = getattr(class_def, 'extends_args', [])
|
|
3210
|
+
constructors = getattr(class_def, 'constructors', [])
|
|
3211
|
+
|
|
3212
|
+
# Bind class_params to instance scope (they receive values from constructor args)
|
|
3213
|
+
# These are the implicit constructor parameters defined in class declaration
|
|
3214
|
+
param_values = {}
|
|
3215
|
+
for i, param in enumerate(class_params):
|
|
3216
|
+
param_name = param.get('name') if isinstance(param, dict) else param
|
|
3217
|
+
if i < len(args):
|
|
3218
|
+
param_values[param_name] = args[i]
|
|
3219
|
+
else:
|
|
3220
|
+
param_values[param_name] = None
|
|
3221
|
+
|
|
3222
|
+
# Call parent constructor with extends_args if parent exists and args specified
|
|
3223
|
+
if class_def.parent and extends_args:
|
|
3224
|
+
evaluated_extends_args = [self._evaluate(arg) for arg in extends_args]
|
|
3225
|
+
self._call_parent_constructor(instance, evaluated_extends_args)
|
|
3226
|
+
instance._parent_constructor_called = True
|
|
3227
|
+
|
|
3228
|
+
# Execute all constructors defined with 'constr' keyword (in order)
|
|
3229
|
+
for constr in constructors:
|
|
3230
|
+
self._call_constructor(instance, constr, args, kwargs, param_values)
|
|
3231
|
+
|
|
3232
|
+
# Call primary constructor (old-style) if defined
|
|
3113
3233
|
if class_def.constructor:
|
|
3114
3234
|
self._call_method(instance, class_def.constructor, args, kwargs)
|
|
3115
3235
|
|
|
3116
3236
|
return instance
|
|
3117
3237
|
|
|
3238
|
+
def _call_parent_constructor(self, instance: CSSLInstance, args: list, kwargs: dict = None):
|
|
3239
|
+
"""Call the parent class constructor on an instance.
|
|
3240
|
+
|
|
3241
|
+
Used for automatic parent constructor calling and super() calls.
|
|
3242
|
+
"""
|
|
3243
|
+
kwargs = kwargs or {}
|
|
3244
|
+
parent = instance._parent_class
|
|
3245
|
+
|
|
3246
|
+
if parent is None:
|
|
3247
|
+
return
|
|
3248
|
+
|
|
3249
|
+
from .cssl_builtins import CSSLizedPythonObject
|
|
3250
|
+
|
|
3251
|
+
if isinstance(parent, CSSLClass):
|
|
3252
|
+
# CSSL parent class
|
|
3253
|
+
if parent.constructor:
|
|
3254
|
+
self._call_method(instance, parent.constructor, args, kwargs)
|
|
3255
|
+
# Also call parent's constr constructors
|
|
3256
|
+
for constr in getattr(parent, 'constructors', []):
|
|
3257
|
+
self._call_constructor(instance, constr, args, kwargs, {})
|
|
3258
|
+
elif isinstance(parent, CSSLizedPythonObject):
|
|
3259
|
+
# Python parent - call __init__ if it's a class
|
|
3260
|
+
py_obj = parent.get_python_obj()
|
|
3261
|
+
if isinstance(py_obj, type):
|
|
3262
|
+
# It's a class - we need to initialize it
|
|
3263
|
+
try:
|
|
3264
|
+
py_obj.__init__(instance, *args, **kwargs)
|
|
3265
|
+
except TypeError:
|
|
3266
|
+
pass # Initialization might not be needed
|
|
3267
|
+
elif isinstance(parent, type):
|
|
3268
|
+
# Raw Python class
|
|
3269
|
+
try:
|
|
3270
|
+
parent.__init__(instance, *args, **kwargs)
|
|
3271
|
+
except TypeError:
|
|
3272
|
+
pass
|
|
3273
|
+
|
|
3274
|
+
def _call_constructor(self, instance: CSSLInstance, constr_node: ASTNode,
|
|
3275
|
+
args: list, kwargs: dict, param_values: dict):
|
|
3276
|
+
"""Call a constructor defined with 'constr' keyword.
|
|
3277
|
+
|
|
3278
|
+
Handles constructor extends/overwrites and sets up the instance scope.
|
|
3279
|
+
"""
|
|
3280
|
+
constr_info = constr_node.value
|
|
3281
|
+
constr_params = constr_info.get('params', [])
|
|
3282
|
+
extends_class = constr_info.get('extends_class')
|
|
3283
|
+
extends_method = constr_info.get('extends_method')
|
|
3284
|
+
|
|
3285
|
+
# Save previous instance context
|
|
3286
|
+
prev_instance = self._current_instance
|
|
3287
|
+
self._current_instance = instance
|
|
3288
|
+
|
|
3289
|
+
# Create new scope for constructor
|
|
3290
|
+
new_scope = Scope(parent=self.scope)
|
|
3291
|
+
|
|
3292
|
+
# Bind param_values (from class params) to constructor scope
|
|
3293
|
+
for name, value in param_values.items():
|
|
3294
|
+
new_scope.set(name, value)
|
|
3295
|
+
|
|
3296
|
+
# Bind constructor parameters
|
|
3297
|
+
for i, param in enumerate(constr_params):
|
|
3298
|
+
param_name = param.get('name') if isinstance(param, dict) else param
|
|
3299
|
+
if i < len(args):
|
|
3300
|
+
new_scope.set(param_name, args[i])
|
|
3301
|
+
elif param_name in kwargs:
|
|
3302
|
+
new_scope.set(param_name, kwargs[param_name])
|
|
3303
|
+
else:
|
|
3304
|
+
new_scope.set(param_name, None)
|
|
3305
|
+
|
|
3306
|
+
# If constructor extends another constructor, inherit its local vars
|
|
3307
|
+
if extends_class and extends_method:
|
|
3308
|
+
parent_class = self.scope.get(extends_class) or self.global_scope.get(extends_class)
|
|
3309
|
+
if parent_class and isinstance(parent_class, CSSLClass):
|
|
3310
|
+
for constr in getattr(parent_class, 'constructors', []):
|
|
3311
|
+
if constr.value.get('name') == extends_method:
|
|
3312
|
+
# Execute parent constructor first to get local vars
|
|
3313
|
+
self._call_constructor(instance, constr, args, kwargs, param_values)
|
|
3314
|
+
break
|
|
3315
|
+
|
|
3316
|
+
# Execute constructor body
|
|
3317
|
+
prev_scope = self.scope
|
|
3318
|
+
self.scope = new_scope
|
|
3319
|
+
|
|
3320
|
+
try:
|
|
3321
|
+
for stmt in constr_node.children:
|
|
3322
|
+
self._execute(stmt)
|
|
3323
|
+
finally:
|
|
3324
|
+
self.scope = prev_scope
|
|
3325
|
+
self._current_instance = prev_instance
|
|
3326
|
+
|
|
3118
3327
|
def _eval_this_access(self, node: ASTNode) -> Any:
|
|
3119
3328
|
"""Evaluate 'this->member' access.
|
|
3120
3329
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "cssl",
|
|
3
3
|
"displayName": "CSSL Language",
|
|
4
4
|
"description": "Professional syntax highlighting, snippets, and language support for CSSL scripts (.cssl, .cssl-pl, .cssl-mod)",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.6.0",
|
|
6
6
|
"publisher": "IncludeCPP",
|
|
7
7
|
"icon": "images/cssl.png",
|
|
8
8
|
"engines": {
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
{ "include": "#strings" },
|
|
9
9
|
{ "include": "#numbers" },
|
|
10
10
|
{ "include": "#class-definition" },
|
|
11
|
+
{ "include": "#function-definitions" },
|
|
12
|
+
{ "include": "#constructor-definition" },
|
|
13
|
+
{ "include": "#super-call" },
|
|
11
14
|
{ "include": "#sql-types" },
|
|
12
15
|
{ "include": "#keywords" },
|
|
13
16
|
{ "include": "#types" },
|
|
@@ -35,13 +38,13 @@
|
|
|
35
38
|
"non-null-declarations": {
|
|
36
39
|
"patterns": [
|
|
37
40
|
{
|
|
38
|
-
"comment": "Non-null class: class *ClassName -
|
|
41
|
+
"comment": "Non-null class: class *ClassName - turquoise",
|
|
39
42
|
"name": "meta.class.non-null.cssl",
|
|
40
43
|
"match": "\\b(class)\\s+(\\*)([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
41
44
|
"captures": {
|
|
42
45
|
"1": { "name": "storage.type.class.cssl" },
|
|
43
46
|
"2": { "name": "keyword.operator.non-null.cssl" },
|
|
44
|
-
"3": { "name": "
|
|
47
|
+
"3": { "name": "support.class.non-null.cssl" }
|
|
45
48
|
}
|
|
46
49
|
},
|
|
47
50
|
{
|
|
@@ -164,15 +167,48 @@
|
|
|
164
167
|
},
|
|
165
168
|
"class-definition": {
|
|
166
169
|
"patterns": [
|
|
170
|
+
{
|
|
171
|
+
"comment": "Class with extends AND overwrites: class X : extends Y : overwrites Z { }",
|
|
172
|
+
"name": "meta.class.extends-overwrites.cssl",
|
|
173
|
+
"begin": "\\b(class)\\s+(\\*?)([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(extends)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(overwrites)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(\\(\\))?\\s*\\{",
|
|
174
|
+
"beginCaptures": {
|
|
175
|
+
"1": { "name": "storage.type.class.cssl" },
|
|
176
|
+
"2": { "name": "keyword.operator.non-null.cssl" },
|
|
177
|
+
"3": { "name": "support.class.cssl" },
|
|
178
|
+
"4": { "name": "storage.modifier.extends.cssl" },
|
|
179
|
+
"5": { "name": "support.class.inherited.cssl" },
|
|
180
|
+
"6": { "name": "storage.modifier.overwrites.cssl" },
|
|
181
|
+
"7": { "name": "support.class.overwritten.cssl" }
|
|
182
|
+
},
|
|
183
|
+
"end": "\\}",
|
|
184
|
+
"patterns": [
|
|
185
|
+
{ "include": "#comments" },
|
|
186
|
+
{ "include": "#constructor-definition" },
|
|
187
|
+
{ "include": "#class-method-definition" },
|
|
188
|
+
{ "include": "#class-member-declaration" },
|
|
189
|
+
{ "include": "#types" },
|
|
190
|
+
{ "include": "#this-access" },
|
|
191
|
+
{ "include": "#captured-references" },
|
|
192
|
+
{ "include": "#global-references" },
|
|
193
|
+
{ "include": "#shared-references" },
|
|
194
|
+
{ "include": "#strings" },
|
|
195
|
+
{ "include": "#numbers" },
|
|
196
|
+
{ "include": "#keywords" },
|
|
197
|
+
{ "include": "#function-calls" },
|
|
198
|
+
{ "include": "#builtins" },
|
|
199
|
+
{ "include": "#operators" }
|
|
200
|
+
]
|
|
201
|
+
},
|
|
167
202
|
{
|
|
168
203
|
"comment": "Class with inheritance: class Child : extends Parent { }",
|
|
169
204
|
"name": "meta.class.extends.cssl",
|
|
170
|
-
"begin": "\\b(class)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(extends)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)\\s*\\{",
|
|
205
|
+
"begin": "\\b(class)\\s+(\\*?)([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(extends)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)\\s*\\{",
|
|
171
206
|
"beginCaptures": {
|
|
172
207
|
"1": { "name": "storage.type.class.cssl" },
|
|
173
|
-
"2": { "name": "
|
|
174
|
-
"3": { "name": "
|
|
175
|
-
"4": { "name": "
|
|
208
|
+
"2": { "name": "keyword.operator.non-null.cssl" },
|
|
209
|
+
"3": { "name": "support.class.cssl" },
|
|
210
|
+
"4": { "name": "storage.modifier.extends.cssl" },
|
|
211
|
+
"5": { "name": "support.class.inherited.cssl" }
|
|
176
212
|
},
|
|
177
213
|
"end": "\\}",
|
|
178
214
|
"patterns": [
|
|
@@ -198,7 +234,7 @@
|
|
|
198
234
|
"begin": "\\b(class)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\{",
|
|
199
235
|
"beginCaptures": {
|
|
200
236
|
"1": { "name": "storage.type.class.cssl" },
|
|
201
|
-
"2": { "name": "
|
|
237
|
+
"2": { "name": "support.class.cssl" }
|
|
202
238
|
},
|
|
203
239
|
"end": "\\}",
|
|
204
240
|
"patterns": [
|
|
@@ -223,6 +259,28 @@
|
|
|
223
259
|
},
|
|
224
260
|
"constructor-definition": {
|
|
225
261
|
"patterns": [
|
|
262
|
+
{
|
|
263
|
+
"comment": "New-style constructor with constr keyword and extends: constr Name() :: extends Parent::Name { }",
|
|
264
|
+
"name": "meta.constructor.constr.extends.cssl",
|
|
265
|
+
"match": "\\b(constr)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\([^)]*\\)\\s*(::)?\\s*(extends)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(::[a-zA-Z_][a-zA-Z0-9_]*)?",
|
|
266
|
+
"captures": {
|
|
267
|
+
"1": { "name": "storage.type.constructor.cssl" },
|
|
268
|
+
"2": { "name": "entity.name.function.constructor.cssl" },
|
|
269
|
+
"3": { "name": "punctuation.accessor.double-colon.cssl" },
|
|
270
|
+
"4": { "name": "storage.modifier.extends.cssl" },
|
|
271
|
+
"5": { "name": "entity.other.inherited-class.cssl" },
|
|
272
|
+
"6": { "name": "entity.name.function.inherited.cssl" }
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"comment": "New-style constructor with constr keyword: constr ConstructorName() { }",
|
|
277
|
+
"name": "meta.constructor.constr.cssl",
|
|
278
|
+
"match": "\\b(constr)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
|
|
279
|
+
"captures": {
|
|
280
|
+
"1": { "name": "storage.type.constructor.cssl" },
|
|
281
|
+
"2": { "name": "entity.name.function.constructor.cssl" }
|
|
282
|
+
}
|
|
283
|
+
},
|
|
226
284
|
{
|
|
227
285
|
"comment": "Constructor: ClassName { ... } or void ClassName(...)",
|
|
228
286
|
"name": "meta.constructor.cssl",
|
|
@@ -234,6 +292,28 @@
|
|
|
234
292
|
}
|
|
235
293
|
]
|
|
236
294
|
},
|
|
295
|
+
"super-call": {
|
|
296
|
+
"patterns": [
|
|
297
|
+
{
|
|
298
|
+
"comment": "super::method() - call parent method",
|
|
299
|
+
"name": "meta.super-call.method.cssl",
|
|
300
|
+
"match": "\\b(super)(::)([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
|
|
301
|
+
"captures": {
|
|
302
|
+
"1": { "name": "keyword.other.super.cssl" },
|
|
303
|
+
"2": { "name": "punctuation.accessor.double-colon.cssl" },
|
|
304
|
+
"3": { "name": "entity.name.function.parent.cssl" }
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"comment": "super() - call parent constructor",
|
|
309
|
+
"name": "meta.super-call.constructor.cssl",
|
|
310
|
+
"match": "\\b(super)\\s*\\(",
|
|
311
|
+
"captures": {
|
|
312
|
+
"1": { "name": "keyword.other.super.cssl" }
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
237
317
|
"class-method-definition": {
|
|
238
318
|
"patterns": [
|
|
239
319
|
{
|
|
@@ -296,6 +376,15 @@
|
|
|
296
376
|
"name": "storage.modifier.extends.cssl",
|
|
297
377
|
"match": "\\b(extends|overwrites)\\b"
|
|
298
378
|
},
|
|
379
|
+
{
|
|
380
|
+
"comment": "new ClassName() - class instantiation with turquoise class name",
|
|
381
|
+
"name": "meta.new-expression.cssl",
|
|
382
|
+
"match": "\\b(new)\\s+([A-Z][a-zA-Z0-9_]*)\\s*\\(",
|
|
383
|
+
"captures": {
|
|
384
|
+
"1": { "name": "keyword.operator.new.cssl" },
|
|
385
|
+
"2": { "name": "support.class.cssl" }
|
|
386
|
+
}
|
|
387
|
+
},
|
|
299
388
|
{
|
|
300
389
|
"name": "keyword.operator.new.cssl",
|
|
301
390
|
"match": "\\bnew\\b"
|
|
@@ -306,7 +395,11 @@
|
|
|
306
395
|
},
|
|
307
396
|
{
|
|
308
397
|
"name": "storage.type.function.cssl",
|
|
309
|
-
"match": "\\b(define|void|shuffled)\\b"
|
|
398
|
+
"match": "\\b(define|void|shuffled|constr)\\b"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"name": "keyword.other.super.cssl",
|
|
402
|
+
"match": "\\bsuper\\b"
|
|
310
403
|
},
|
|
311
404
|
{
|
|
312
405
|
"name": "keyword.other.cssl",
|
|
@@ -409,7 +502,7 @@
|
|
|
409
502
|
},
|
|
410
503
|
{
|
|
411
504
|
"name": "support.function.namespace.python.cssl",
|
|
412
|
-
"match": "\\bpython::(pythonize|wrap|export)\\b"
|
|
505
|
+
"match": "\\bpython::(pythonize|wrap|export|csslize|import)\\b"
|
|
413
506
|
},
|
|
414
507
|
{
|
|
415
508
|
"name": "support.function.namespace.filter.cssl",
|
|
@@ -548,6 +641,48 @@
|
|
|
548
641
|
}
|
|
549
642
|
]
|
|
550
643
|
},
|
|
644
|
+
"function-definitions": {
|
|
645
|
+
"patterns": [
|
|
646
|
+
{
|
|
647
|
+
"comment": "Function with extends AND overwrites: define func : extends X : overwrites Y() { }",
|
|
648
|
+
"name": "meta.function.extends-overwrites.cssl",
|
|
649
|
+
"match": "\\b(define)\\s+(\\*?)([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(extends)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(\\(\\))?\\s*:\\s*(overwrites)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(\\(\\))?",
|
|
650
|
+
"captures": {
|
|
651
|
+
"1": { "name": "storage.type.function.cssl" },
|
|
652
|
+
"2": { "name": "keyword.operator.non-null.cssl" },
|
|
653
|
+
"3": { "name": "entity.name.function.cssl" },
|
|
654
|
+
"4": { "name": "storage.modifier.extends.cssl" },
|
|
655
|
+
"5": { "name": "entity.other.inherited-function.cssl" },
|
|
656
|
+
"7": { "name": "storage.modifier.overwrites.cssl" },
|
|
657
|
+
"8": { "name": "entity.other.overwritten-function.cssl" }
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
"comment": "Function with extends: define func : extends otherFunc() { }",
|
|
662
|
+
"name": "meta.function.extends.cssl",
|
|
663
|
+
"match": "\\b(define)\\s+(\\*?)([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(extends)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(\\(\\))?",
|
|
664
|
+
"captures": {
|
|
665
|
+
"1": { "name": "storage.type.function.cssl" },
|
|
666
|
+
"2": { "name": "keyword.operator.non-null.cssl" },
|
|
667
|
+
"3": { "name": "entity.name.function.cssl" },
|
|
668
|
+
"4": { "name": "storage.modifier.extends.cssl" },
|
|
669
|
+
"5": { "name": "entity.other.inherited-function.cssl" }
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
"comment": "Function with overwrites: define func : overwrites target() { }",
|
|
674
|
+
"name": "meta.function.overwrites.cssl",
|
|
675
|
+
"match": "\\b(define)\\s+(\\*?)([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*(overwrites)\\s+(\\$?[a-zA-Z_][a-zA-Z0-9_]*)(\\(\\))?",
|
|
676
|
+
"captures": {
|
|
677
|
+
"1": { "name": "storage.type.function.cssl" },
|
|
678
|
+
"2": { "name": "keyword.operator.non-null.cssl" },
|
|
679
|
+
"3": { "name": "entity.name.function.cssl" },
|
|
680
|
+
"4": { "name": "storage.modifier.overwrites.cssl" },
|
|
681
|
+
"5": { "name": "entity.other.overwritten-function.cssl" }
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
]
|
|
685
|
+
},
|
|
551
686
|
"function-calls": {
|
|
552
687
|
"patterns": [
|
|
553
688
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
includecpp/__init__.py,sha256=
|
|
1
|
+
includecpp/__init__.py,sha256=siSinhicUem0QnzED-s_SD6_SMPMkqxA-SGOqqN5SGc,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=UF2RpPyuUWrU08E49t19OcsGModkwlRvajDWifCxqFo,48051
|
|
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=WACgaltY9Ex9m06kDhO7_I6pw8aAEtwP_isNqi4eVHQ,136512
|
|
29
|
+
includecpp/core/cssl/cssl_runtime.py,sha256=wRqvn9VLoS1k_h_oQYqsW0ScBguv0CBYjWLDwk8T6yU,177838
|
|
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
|
|
@@ -39,14 +39,14 @@ includecpp/vscode/__init__.py,sha256=yLKw-_7MTX1Rx3jLk5JjharJQfFXbwtZVE7YqHpM7yg
|
|
|
39
39
|
includecpp/vscode/cssl/__init__.py,sha256=rQJAx5X05v-mAwqX1Qb-rbZO219iR73MziFNRUCNUIo,31
|
|
40
40
|
includecpp/vscode/cssl/extension.js,sha256=FZaKfOpzo2jXtubVCZmnhDZd4eUVHltm5VW_fgNnSkE,4327
|
|
41
41
|
includecpp/vscode/cssl/language-configuration.json,sha256=61Q00cKI9may5L8YpxMmvfo6PAc-abdJqApfR85DWuw,904
|
|
42
|
-
includecpp/vscode/cssl/package.json,sha256=
|
|
42
|
+
includecpp/vscode/cssl/package.json,sha256=5MCJts7zYIgF8EdWcBnn98deIMyZamlGXvt1acO0Q1U,4853
|
|
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=l62jwXdjMx7-awg5X9WNBrGs4m34uP8W1CV7U7cpP4Y,34004
|
|
47
|
+
includecpp-3.8.6.dist-info/licenses/LICENSE,sha256=fWCsGGsiWZir0UzDd20Hh-3wtRyk1zqUntvtVuAWhvc,1093
|
|
48
|
+
includecpp-3.8.6.dist-info/METADATA,sha256=Fa8efBnw1m9W3FOgx4bRUn4KxQyRRtLKN4oB4upVq2U,22510
|
|
49
|
+
includecpp-3.8.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
50
|
+
includecpp-3.8.6.dist-info/entry_points.txt,sha256=6A5Mif9gi0139Bf03W5plAb3wnAgbNaEVe1HJoGE-2o,59
|
|
51
|
+
includecpp-3.8.6.dist-info/top_level.txt,sha256=RFUaR1KG-M6mCYwP6w4ydP5Cgc8yNbP78jxGAvyjMa8,11
|
|
52
|
+
includecpp-3.8.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|