IncludeCPP 3.9.1__tar.gz → 4.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {includecpp-3.9.1 → includecpp-4.0.3}/IncludeCPP.egg-info/PKG-INFO +2 -1
  2. {includecpp-3.9.1 → includecpp-4.0.3}/IncludeCPP.egg-info/requires.txt +1 -0
  3. {includecpp-3.9.1 → includecpp-4.0.3}/PKG-INFO +2 -1
  4. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/__init__.py +1 -1
  5. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/cli/commands.py +7 -14
  6. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +160 -7
  7. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_parser.py +331 -97
  8. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_runtime.py +704 -60
  9. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_types.py +143 -1
  10. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl_bridge.py +198 -12
  11. includecpp-4.0.3/includecpp/core/cssl_bridge.pyi +1019 -0
  12. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/package.json +43 -1
  13. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +140 -17
  14. {includecpp-3.9.1 → includecpp-4.0.3}/pyproject.toml +2 -1
  15. includecpp-3.9.1/includecpp/core/cssl_bridge.pyi +0 -488
  16. {includecpp-3.9.1 → includecpp-4.0.3}/IncludeCPP.egg-info/SOURCES.txt +0 -0
  17. {includecpp-3.9.1 → includecpp-4.0.3}/IncludeCPP.egg-info/dependency_links.txt +0 -0
  18. {includecpp-3.9.1 → includecpp-4.0.3}/IncludeCPP.egg-info/entry_points.txt +0 -0
  19. {includecpp-3.9.1 → includecpp-4.0.3}/IncludeCPP.egg-info/top_level.txt +0 -0
  20. {includecpp-3.9.1 → includecpp-4.0.3}/LICENSE +0 -0
  21. {includecpp-3.9.1 → includecpp-4.0.3}/MANIFEST.in +0 -0
  22. {includecpp-3.9.1 → includecpp-4.0.3}/README.md +0 -0
  23. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/__init__.pyi +0 -0
  24. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/__main__.py +0 -0
  25. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/cli/__init__.py +0 -0
  26. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/cli/config_parser.py +0 -0
  27. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/__init__.py +0 -0
  28. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/ai_integration.py +0 -0
  29. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/build_manager.py +0 -0
  30. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cpp_api.py +0 -0
  31. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cpp_api.pyi +0 -0
  32. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cppy_converter.py +0 -0
  33. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/CSSL_DOCUMENTATION_NEW.md +0 -0
  34. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/__init__.py +0 -0
  35. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_builtins.py +0 -0
  36. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_builtins.pyi +0 -0
  37. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_events.py +0 -0
  38. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_modules.py +0 -0
  39. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/cssl/cssl_syntax.py +0 -0
  40. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/error_catalog.py +0 -0
  41. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/error_formatter.py +0 -0
  42. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/exceptions.py +0 -0
  43. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/path_discovery.py +0 -0
  44. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/project_ui.py +0 -0
  45. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/core/settings_ui.py +0 -0
  46. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/generator/__init__.py +0 -0
  47. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/generator/parser.cpp +0 -0
  48. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/generator/parser.h +0 -0
  49. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/generator/type_resolver.cpp +0 -0
  50. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/generator/type_resolver.h +0 -0
  51. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/py.typed +0 -0
  52. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/templates/cpp.proj.template +0 -0
  53. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/__init__.py +0 -0
  54. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/__init__.py +0 -0
  55. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/extension.js +0 -0
  56. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/images/cssl.png +0 -0
  57. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
  58. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/language-configuration.json +0 -0
  59. {includecpp-3.9.1 → includecpp-4.0.3}/includecpp/vscode/cssl/snippets/cssl.snippets.json +0 -0
  60. {includecpp-3.9.1 → includecpp-4.0.3}/requirements.txt +0 -0
  61. {includecpp-3.9.1 → includecpp-4.0.3}/setup.cfg +0 -0
  62. {includecpp-3.9.1 → includecpp-4.0.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 3.9.1
3
+ Version: 4.0.3
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -27,6 +27,7 @@ Requires-Dist: pybind11>=2.11.0
27
27
  Requires-Dist: click>=8.0.0
28
28
  Requires-Dist: typing-extensions>=4.0.0
29
29
  Requires-Dist: requests>=2.28.0
30
+ Requires-Dist: colorama>=0.4.0
30
31
  Dynamic: author-email
31
32
  Dynamic: home-page
32
33
  Dynamic: license-file
@@ -2,3 +2,4 @@ pybind11>=2.11.0
2
2
  click>=8.0.0
3
3
  typing-extensions>=4.0.0
4
4
  requests>=2.28.0
5
+ colorama>=0.4.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 3.9.1
3
+ Version: 4.0.3
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -27,6 +27,7 @@ Requires-Dist: pybind11>=2.11.0
27
27
  Requires-Dist: click>=8.0.0
28
28
  Requires-Dist: typing-extensions>=4.0.0
29
29
  Requires-Dist: requests>=2.28.0
30
+ Requires-Dist: colorama>=0.4.0
30
31
  Dynamic: author-email
31
32
  Dynamic: home-page
32
33
  Dynamic: license-file
@@ -2,7 +2,7 @@ from .core.cpp_api import CppApi
2
2
  from .core import cssl_bridge as CSSL
3
3
  import warnings
4
4
 
5
- __version__ = "3.9.1"
5
+ __version__ = "4.0.2"
6
6
  __all__ = ["CppApi", "CSSL"]
7
7
 
8
8
  # Module-level cache for C++ modules
@@ -9,8 +9,12 @@ import re
9
9
  import urllib.request
10
10
  import urllib.error
11
11
  from pathlib import Path
12
+ from colorama import init as colorama_init, Fore, Style
12
13
  from .config_parser import CppProjectConfig
13
14
 
15
+ # Initialize colorama for Windows ANSI color support
16
+ colorama_init()
17
+
14
18
 
15
19
  def _is_experimental_enabled() -> bool:
16
20
  """Check if experimental features (cppy, ai) are enabled."""
@@ -7320,7 +7324,6 @@ def exec_repl(lang, path, import_all):
7320
7324
  code_lines = imports + [''] + lines if imports else lines
7321
7325
 
7322
7326
  click.echo()
7323
- click.secho("--- Output ---", fg='green')
7324
7327
 
7325
7328
  if is_python:
7326
7329
  # Execute Python code
@@ -7443,9 +7446,6 @@ def exec_repl(lang, path, import_all):
7443
7446
  except Exception:
7444
7447
  pass
7445
7448
 
7446
- click.echo()
7447
- click.secho("--------------", fg='green')
7448
-
7449
7449
 
7450
7450
  # ============================================================================
7451
7451
  # CSSL - Hidden Command Group
@@ -7526,19 +7526,12 @@ def _cssl_execute(path, code):
7526
7526
  source = '\n'.join(lines)
7527
7527
 
7528
7528
  # Execute
7529
- click.secho("--- Output ---", fg='green')
7530
7529
  try:
7531
7530
  result = cssl_lang.run(source)
7532
-
7533
- # Output is already printed to stdout during execution via runtime.output()
7534
- # Don't print "Result:" automatically - users should use printl() for output
7535
- # This prevents unwanted output for function calls like: Function();
7536
- pass
7537
-
7538
7531
  except Exception as e:
7539
- click.secho(f"CSSL Error: {e}", fg='red')
7540
-
7541
- click.secho("--------------", fg='green')
7532
+ error_msg = str(e)
7533
+ # Clean display - single CSSL Error: prefix with colorama
7534
+ click.echo(f"{Fore.RED}CSSL Error: {error_msg}{Style.RESET_ALL}")
7542
7535
 
7543
7536
 
7544
7537
  @cssl.command(name='makemodule')
@@ -1,6 +1,6 @@
1
1
  # CSSL - C-Style Scripting Language
2
2
 
3
- > Version 3.9.1 | A modern scripting language with C++-style syntax and unique features like CodeInfusion, BruteInjection, and Python Interop.
3
+ > Version 4.0.0 | A modern scripting language with C++-style syntax and unique features like CodeInfusion, BruteInjection, and Python Interop.
4
4
 
5
5
  ---
6
6
 
@@ -168,6 +168,42 @@ isnull(null); // true
168
168
 
169
169
  ## Variables & Globals
170
170
 
171
+ ### Scope Behavior
172
+
173
+ Variables are **local by default**. Each function/class has its own scope - variables defined inside a function only exist within that function.
174
+
175
+ ```cssl
176
+ define myFunction() {
177
+ string name = "Alice"; // Local to myFunction
178
+ printl(name); // Works
179
+ }
180
+
181
+ myFunction();
182
+ // printl(name); // Error! 'name' doesn't exist here
183
+
184
+ // Same variable name in different scopes = different variables
185
+ string name = "Bob";
186
+
187
+ define otherFunction() {
188
+ string name = "Charlie"; // Different variable, local to otherFunction
189
+ printl(name); // "Charlie"
190
+ }
191
+
192
+ otherFunction();
193
+ printl(name); // "Bob" - outer scope unchanged
194
+ ```
195
+
196
+ ### Everything is Local by Default
197
+
198
+ All elements (variables, functions, classes) are **local by default** and must be explicitly marked global.
199
+
200
+ | Element | Local (default) | Global |
201
+ |---------|-----------------|--------|
202
+ | **Variables** | `string x = "text";` | `global x = "text";` or `@x = "text";` |
203
+ | **Functions** | `define myFunc() { }` | `global define myFunc() { }` or `define @myFunc() { }` |
204
+ | **Typed functions** | `void myFunc() { }` | `global void myFunc() { }` or `void @myFunc() { }` |
205
+ | **Classes** | `class MyClass { }` | `global class MyClass { }` or `class @MyClass { }` |
206
+
171
207
  ### Local Variables
172
208
 
173
209
  ```cssl
@@ -179,6 +215,8 @@ bool active = true;
179
215
 
180
216
  ### Global Variables
181
217
 
218
+ Use `global` keyword or `@`/`r@` prefix to create/access global variables:
219
+
182
220
  ```cssl
183
221
  // Declaration with 'global' keyword
184
222
  global myGlobal = "visible everywhere";
@@ -186,11 +224,60 @@ global myGlobal = "visible everywhere";
186
224
  // Access with '@' prefix
187
225
  printl(@myGlobal);
188
226
 
189
- // Alternative: r@ syntax
190
- r@anotherGlobal = "also global";
191
- printl(@anotherGlobal);
227
+ // Direct global assignment with @ or r@
228
+ @anotherGlobal = "also global";
229
+ r@yetAnother = "and this too";
230
+
231
+ // Always read globals with @
232
+ printl(@x);
233
+ ```
234
+
235
+ ### Global Functions
236
+
237
+ ```cssl
238
+ // Global function with 'global' keyword
239
+ global define helper() {
240
+ printl("I'm global!");
241
+ }
242
+
243
+ // Alternative: @ prefix syntax
244
+ define @anotherHelper() {
245
+ printl("Also global!");
246
+ }
247
+
248
+ // Global typed function
249
+ global void @utilityFunc(string msg) {
250
+ printl(msg);
251
+ }
252
+ ```
253
+
254
+ ### Global Classes
255
+
256
+ ```cssl
257
+ // Global class with 'global' keyword
258
+ global class SharedClass {
259
+ string value;
260
+ }
261
+
262
+ // Alternative: @ prefix syntax
263
+ class @AnotherShared {
264
+ int count;
265
+ }
266
+
267
+ // Instantiate global class with @ prefix
268
+ instance = new @SharedClass();
192
269
  ```
193
270
 
271
+ ### Prefix Reference
272
+
273
+ | Prefix | Name | Usage |
274
+ |--------|------|-------|
275
+ | `@` | Global/Module | Read global vars, access modules: `@myVar`, `@os.getcwd()` |
276
+ | `r@` | Global Ref | Assign to global scope: `r@name = value` |
277
+ | `$` | Shared | Access Python objects: `$counter.value` |
278
+ | `%` | Captured | Capture value at registration: `%version` |
279
+ | `s@` | Self-Ref | Access global structs: `s@Backend.config` |
280
+
194
281
  ### Shared Objects ($)
195
282
 
196
283
  Access Python objects shared via `CSSL.share()`:
@@ -215,6 +302,20 @@ version = "2.0";
215
302
  printl(savedVersion); // Still "1.0"
216
303
  ```
217
304
 
305
+ ### Class Member Access (this->)
306
+
307
+ Inside classes, use `this->` to access instance members:
308
+
309
+ ```cssl
310
+ class Person {
311
+ string name;
312
+
313
+ void setName(string n) {
314
+ this->name = n; // Instance member
315
+ }
316
+ }
317
+ ```
318
+
218
319
  ---
219
320
 
220
321
  ## Operators
@@ -412,10 +513,16 @@ define greet(string name) {
412
513
  | `closed` | Block external CodeInfusion |
413
514
  | `private` | Block all CodeInfusion |
414
515
  | `virtual` | Import-cycle safe |
415
- | `meta` | Source function (must return) |
516
+ | `meta` | Source function (any return type allowed) |
416
517
  | `super` | Force execution (no exceptions) |
417
518
  | `open` | Accept any parameters |
418
519
  | `shuffled` | Return multiple values |
520
+ | `const` | Immutable function (like C++) |
521
+ | `static` | Static method/function |
522
+ | `public` | Explicitly public (default) |
523
+ | `global` | Makes function globally accessible |
524
+
525
+ **Flexible Modifier Order**: Modifiers can appear in any order before the function declaration.
419
526
 
420
527
  ```cssl
421
528
  // Ignore errors
@@ -434,6 +541,45 @@ shuffled string getNames() {
434
541
  }
435
542
 
436
543
  a, b, c = getNames();
544
+
545
+ // Any order of modifiers works
546
+ private string *@Myfunc() {
547
+ println("Hello from global private non-null function!");
548
+ return "Hey";
549
+ }
550
+
551
+ // Const function
552
+ const void immutableFunc() {
553
+ printl("I'm constant");
554
+ }
555
+
556
+ // Global private const
557
+ global private const void @MyGlobalFunc() {
558
+ printl("Complex modifiers in any order");
559
+ }
560
+ ```
561
+
562
+ ### Typed Functions (Enforced Returns)
563
+
564
+ Functions with a return type (like `int`, `string`, `vector<T>`) MUST return that type:
565
+
566
+ ```cssl
567
+ // MUST return string
568
+ string getName() {
569
+ return "Alice"; // OK
570
+ // return 42; // Error! Expected string
571
+ }
572
+
573
+ // MUST return int
574
+ int getAge() {
575
+ return 30; // OK
576
+ }
577
+
578
+ // meta modifier bypasses type checking
579
+ meta datastruct<string> getData() {
580
+ return "just a string"; // OK despite declared type
581
+ return 42; // Also OK - meta allows any type
582
+ }
437
583
  ```
438
584
 
439
585
  ### Non-Null Functions (*)
@@ -1332,7 +1478,9 @@ assert(x > 0, "x must be positive");
1332
1478
 
1333
1479
  | Syntax | Description |
1334
1480
  |--------|-------------|
1335
- | `@name` | Global variable |
1481
+ | `@name` | Global variable access |
1482
+ | `@name = value` | Global variable assignment |
1483
+ | `r@name = value` | Global reference assignment |
1336
1484
  | `$name` | Shared Python object |
1337
1485
  | `%name` | Captured value |
1338
1486
  | `this->` | Class member access |
@@ -1342,7 +1490,12 @@ assert(x > 0, "x must be positive");
1342
1490
  | `&FunctionName ++` | Append to function |
1343
1491
  | `*func()` | Non-null function |
1344
1492
  | `*[type]func()` | Type exclusion filter |
1493
+ | `global class Name` | Global class declaration |
1494
+ | `class @Name` | Global class (alt syntax) |
1495
+ | `global define func()` | Global function declaration |
1496
+ | `define @func()` | Global function (alt syntax) |
1497
+ | `new @ClassName()` | Instantiate global class |
1345
1498
 
1346
1499
  ---
1347
1500
 
1348
- *CSSL v3.9.1 - Developed as part of IncludeCPP*
1501
+ *CSSL v4.0.0 - Developed as part of IncludeCPP*