IncludeCPP 3.8.8__py3-none-any.whl → 4.0.0__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 +877 -1781
- includecpp/core/cssl/CSSL_DOCUMENTATION_NEW.md +1348 -0
- includecpp/core/cssl/cssl_builtins.pyi +231 -0
- includecpp/core/cssl/cssl_parser.py +439 -94
- includecpp/core/cssl/cssl_runtime.py +498 -27
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +25 -0
- {includecpp-3.8.8.dist-info → includecpp-4.0.0.dist-info}/METADATA +1 -1
- {includecpp-3.8.8.dist-info → includecpp-4.0.0.dist-info}/RECORD +13 -12
- {includecpp-3.8.8.dist-info → includecpp-4.0.0.dist-info}/WHEEL +0 -0
- {includecpp-3.8.8.dist-info → includecpp-4.0.0.dist-info}/entry_points.txt +0 -0
- {includecpp-3.8.8.dist-info → includecpp-4.0.0.dist-info}/licenses/LICENSE +0 -0
- {includecpp-3.8.8.dist-info → includecpp-4.0.0.dist-info}/top_level.txt +0 -0
|
@@ -4604,6 +4604,233 @@ Example:
|
|
|
4604
4604
|
"""
|
|
4605
4605
|
|
|
4606
4606
|
|
|
4607
|
+
# =============================================================================
|
|
4608
|
+
# NON-NULL ASSERTIONS & TYPE EXCLUSION (v3.9.0)
|
|
4609
|
+
# =============================================================================
|
|
4610
|
+
|
|
4611
|
+
class NonNullAndTypeExclusion:
|
|
4612
|
+
"""
|
|
4613
|
+
CSSL Non-Null Assertions and Type Exclusion (v3.9.0)
|
|
4614
|
+
|
|
4615
|
+
Special syntax for enforcing value constraints on functions and expressions.
|
|
4616
|
+
"""
|
|
4617
|
+
|
|
4618
|
+
def non_null_assertion(self) -> None:
|
|
4619
|
+
"""Non-null assertion with * prefix.
|
|
4620
|
+
|
|
4621
|
+
Assert that a value, function return, or class methods are never null.
|
|
4622
|
+
|
|
4623
|
+
Syntax:
|
|
4624
|
+
*$variable Assert shared object is non-null
|
|
4625
|
+
*@global Assert global variable is non-null
|
|
4626
|
+
*expression Assert expression result is non-null
|
|
4627
|
+
define *funcName() Function must return non-null
|
|
4628
|
+
class *ClassName All class methods return non-null
|
|
4629
|
+
|
|
4630
|
+
Example - Value Assertion:
|
|
4631
|
+
// Assert shared object value is not null
|
|
4632
|
+
this->osName = *$System.os; // Error if $System.os is null
|
|
4633
|
+
|
|
4634
|
+
// Assert global is not null
|
|
4635
|
+
string value = *@config;
|
|
4636
|
+
|
|
4637
|
+
Example - Non-null Function:
|
|
4638
|
+
// Function that must never return null/None
|
|
4639
|
+
define *alwaysReturns() {
|
|
4640
|
+
return "Always a value";
|
|
4641
|
+
// return null; // Would cause error!
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4644
|
+
// Call - guaranteed non-null
|
|
4645
|
+
string result = alwaysReturns();
|
|
4646
|
+
|
|
4647
|
+
Example - Non-null Class:
|
|
4648
|
+
// All methods in this class must return non-null
|
|
4649
|
+
class *MyClass {
|
|
4650
|
+
string getValue() {
|
|
4651
|
+
return "Value"; // Must return something
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4654
|
+
int getNumber() {
|
|
4655
|
+
return 42; // Must return something
|
|
4656
|
+
}
|
|
4657
|
+
}
|
|
4658
|
+
|
|
4659
|
+
Example - Non-null Parameter:
|
|
4660
|
+
// Filter out null values from open parameters
|
|
4661
|
+
define process(open *Params) {
|
|
4662
|
+
// Params will never contain null values
|
|
4663
|
+
foreach item in Params {
|
|
4664
|
+
printl(item); // Guaranteed non-null
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
"""
|
|
4668
|
+
...
|
|
4669
|
+
|
|
4670
|
+
def type_exclusion_filter(self) -> None:
|
|
4671
|
+
"""Type exclusion filter with *[type] syntax.
|
|
4672
|
+
|
|
4673
|
+
Specify that a function must NOT return a specific type.
|
|
4674
|
+
Particularly useful with shuffled functions that return multiple values.
|
|
4675
|
+
|
|
4676
|
+
Syntax:
|
|
4677
|
+
define *[type]funcName() Function must NOT return 'type'
|
|
4678
|
+
shuffled *[type]funcName() Multi-return must NOT contain 'type'
|
|
4679
|
+
*[type]expression Assert expression is NOT of 'type'
|
|
4680
|
+
|
|
4681
|
+
Supported types:
|
|
4682
|
+
string, int, float, bool, null, none, list, array, dict, json
|
|
4683
|
+
|
|
4684
|
+
Example - Exclude String:
|
|
4685
|
+
// Function must NOT return a string
|
|
4686
|
+
shuffled *[string] getNumbers() {
|
|
4687
|
+
return 1, 2, 3; // OK - integers
|
|
4688
|
+
// return "text"; // Error! String not allowed
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
Example - Exclude Null:
|
|
4692
|
+
// Ensure function never returns null (alternative to *)
|
|
4693
|
+
define *[null] getValue() {
|
|
4694
|
+
return 42; // OK
|
|
4695
|
+
// return null; // Error!
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
Example - With Shuffled Functions:
|
|
4699
|
+
// Return multiple values, but none can be strings
|
|
4700
|
+
shuffled *[string] getMixedData() {
|
|
4701
|
+
return 100, 3.14, true; // OK - int, float, bool
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4704
|
+
// Unpack the values
|
|
4705
|
+
num, decimal, flag = getMixedData();
|
|
4706
|
+
|
|
4707
|
+
Example - Expression Assertion:
|
|
4708
|
+
// Assert the result is not a string
|
|
4709
|
+
dynamic result = *[string] getData();
|
|
4710
|
+
// Error if getData() returns a string
|
|
4711
|
+
|
|
4712
|
+
Note:
|
|
4713
|
+
For tuple returns (shuffled), each value in the tuple is checked
|
|
4714
|
+
against the excluded type. If any value matches, an error is raised.
|
|
4715
|
+
"""
|
|
4716
|
+
...
|
|
4717
|
+
|
|
4718
|
+
|
|
4719
|
+
# =============================================================================
|
|
4720
|
+
# APPEND MODE (v3.8.9)
|
|
4721
|
+
# =============================================================================
|
|
4722
|
+
|
|
4723
|
+
class AppendMode:
|
|
4724
|
+
"""
|
|
4725
|
+
CSSL Append Mode (v3.8.9)
|
|
4726
|
+
|
|
4727
|
+
The ++ append operator allows extending constructors and functions
|
|
4728
|
+
by keeping the original code and adding new code after it.
|
|
4729
|
+
"""
|
|
4730
|
+
|
|
4731
|
+
def function_append(self) -> None:
|
|
4732
|
+
"""Append to a function with &FunctionName ++.
|
|
4733
|
+
|
|
4734
|
+
Keeps original function code and adds new code after it.
|
|
4735
|
+
|
|
4736
|
+
Syntax:
|
|
4737
|
+
define NewFunc() &OriginalFunc ++ {
|
|
4738
|
+
// New code runs AFTER OriginalFunc
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
Example:
|
|
4742
|
+
// Original function
|
|
4743
|
+
define BaseFunc() {
|
|
4744
|
+
printl("Base functionality");
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
// Append to BaseFunc - keeps original + adds new
|
|
4748
|
+
define ExtendedFunc() &BaseFunc ++ {
|
|
4749
|
+
printl("Extended functionality");
|
|
4750
|
+
}
|
|
4751
|
+
|
|
4752
|
+
ExtendedFunc();
|
|
4753
|
+
// Output:
|
|
4754
|
+
// Base functionality
|
|
4755
|
+
// Extended functionality
|
|
4756
|
+
"""
|
|
4757
|
+
...
|
|
4758
|
+
|
|
4759
|
+
def constructor_append(self) -> None:
|
|
4760
|
+
"""Append to a constructor with &ClassName::constructor ++.
|
|
4761
|
+
|
|
4762
|
+
Extend parent constructor while keeping its initialization.
|
|
4763
|
+
|
|
4764
|
+
Syntax:
|
|
4765
|
+
constr Name() &ParentClass::ParentConstructor ++ {
|
|
4766
|
+
// Additional initialization
|
|
4767
|
+
}
|
|
4768
|
+
|
|
4769
|
+
Example:
|
|
4770
|
+
class MyClass {
|
|
4771
|
+
constr MyClassConstructor() {
|
|
4772
|
+
printl("MyClass constructor");
|
|
4773
|
+
this->value = 10;
|
|
4774
|
+
}
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
class BetterClass :: extends MyClass {
|
|
4778
|
+
// Append to specific parent constructor
|
|
4779
|
+
constr BetterConstructor() &MyClass::MyClassConstructor ++ {
|
|
4780
|
+
printl("BetterClass - added code");
|
|
4781
|
+
this->extra = 20;
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
|
|
4785
|
+
$instance = new BetterClass();
|
|
4786
|
+
// Output:
|
|
4787
|
+
// MyClass constructor
|
|
4788
|
+
// BetterClass - added code
|
|
4789
|
+
printl($instance.value); // 10
|
|
4790
|
+
printl($instance.extra); // 20
|
|
4791
|
+
"""
|
|
4792
|
+
...
|
|
4793
|
+
|
|
4794
|
+
def method_append(self) -> None:
|
|
4795
|
+
"""Append to a class method with &ClassName::method ++.
|
|
4796
|
+
|
|
4797
|
+
Example:
|
|
4798
|
+
class Parent {
|
|
4799
|
+
define greet() {
|
|
4800
|
+
printl("Hello from Parent");
|
|
4801
|
+
}
|
|
4802
|
+
}
|
|
4803
|
+
|
|
4804
|
+
class Child :: extends Parent {
|
|
4805
|
+
// Append to parent method
|
|
4806
|
+
define betterGreet() &Parent::greet ++ {
|
|
4807
|
+
printl("And also from Child!");
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
|
|
4811
|
+
$child = new Child();
|
|
4812
|
+
$child.betterGreet();
|
|
4813
|
+
// Output:
|
|
4814
|
+
// Hello from Parent
|
|
4815
|
+
// And also from Child!
|
|
4816
|
+
"""
|
|
4817
|
+
...
|
|
4818
|
+
|
|
4819
|
+
def instance_append(self) -> None:
|
|
4820
|
+
"""Append using instance reference with &$instance::member ++.
|
|
4821
|
+
|
|
4822
|
+
Example:
|
|
4823
|
+
global $myInstance = new SomeClass();
|
|
4824
|
+
|
|
4825
|
+
class Extended {
|
|
4826
|
+
define extendedMethod() &$myInstance::originalMethod ++ {
|
|
4827
|
+
printl("Added to instance method");
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
"""
|
|
4831
|
+
...
|
|
4832
|
+
|
|
4833
|
+
|
|
4607
4834
|
# =============================================================================
|
|
4608
4835
|
# EXPORTS
|
|
4609
4836
|
# =============================================================================
|
|
@@ -4671,4 +4898,8 @@ __all__ = [
|
|
|
4671
4898
|
# Data Types Reference
|
|
4672
4899
|
"DataTypes", "int_t", "float_t", "string_t", "bool_t", "dynamic_t",
|
|
4673
4900
|
"var_t", "list_t", "dict_t", "void_t", "null_t",
|
|
4901
|
+
# v3.8.9 & v3.9.0 Features
|
|
4902
|
+
"AppendMode", "NonNullAndTypeExclusion",
|
|
4903
|
+
# Filter functions (filter:: namespace)
|
|
4904
|
+
"filter_register", "filter_unregister", "filter_list", "filter_exists",
|
|
4674
4905
|
]
|