IncludeCPP 3.7.1__py3-none-any.whl → 3.7.25__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/__init__.pyi +2 -2
- includecpp/cli/commands.py +278 -75
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +27 -8
- includecpp/core/cssl/__init__.py +7 -2
- includecpp/core/cssl/cssl_builtins.py +201 -9
- includecpp/core/cssl/cssl_builtins.pyi +3682 -401
- includecpp/core/cssl/cssl_parser.py +291 -40
- includecpp/core/cssl/cssl_runtime.py +629 -40
- includecpp/core/cssl/cssl_syntax.py +7 -7
- includecpp/core/cssl/cssl_types.py +75 -2
- includecpp/core/cssl_bridge.py +540 -53
- includecpp/vscode/cssl/extension.js +133 -0
- includecpp/vscode/cssl/images/cssl.png +0 -0
- includecpp/vscode/cssl/images/cssl_pl.png +0 -0
- includecpp/vscode/cssl/language-configuration.json +1 -4
- includecpp/vscode/cssl/package.json +117 -11
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +213 -29
- {includecpp-3.7.1.dist-info → includecpp-3.7.25.dist-info}/METADATA +2 -2
- {includecpp-3.7.1.dist-info → includecpp-3.7.25.dist-info}/RECORD +24 -21
- {includecpp-3.7.1.dist-info → includecpp-3.7.25.dist-info}/WHEEL +0 -0
- {includecpp-3.7.1.dist-info → includecpp-3.7.25.dist-info}/entry_points.txt +0 -0
- {includecpp-3.7.1.dist-info → includecpp-3.7.25.dist-info}/licenses/LICENSE +0 -0
- {includecpp-3.7.1.dist-info → includecpp-3.7.25.dist-info}/top_level.txt +0 -0
includecpp/__init__.py
CHANGED
includecpp/__init__.pyi
CHANGED
|
@@ -13,7 +13,7 @@ except ImportError:
|
|
|
13
13
|
pass # Generated during rebuild
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
# ========== CSSL Module
|
|
16
|
+
# ========== CSSL Module ==========
|
|
17
17
|
class _CSSLModule:
|
|
18
18
|
"""CSSL callable module created via CSSL.module()"""
|
|
19
19
|
def __call__(self, *args: Any) -> Any:
|
|
@@ -139,7 +139,7 @@ class _CSSLBridge:
|
|
|
139
139
|
...
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
# CSSL module instance
|
|
142
|
+
# CSSL module instance
|
|
143
143
|
CSSL: _CSSLBridge
|
|
144
144
|
|
|
145
145
|
__version__: str
|
includecpp/cli/commands.py
CHANGED
|
@@ -1193,7 +1193,7 @@ def build(ctx, clean, keep, verbose, no_incremental, incremental, parallel, jobs
|
|
|
1193
1193
|
@cli.command()
|
|
1194
1194
|
@click.argument('module_name')
|
|
1195
1195
|
def add(module_name):
|
|
1196
|
-
"""Create a new module template."""
|
|
1196
|
+
"""Create a new module template with sample C++ code."""
|
|
1197
1197
|
plugins_dir = Path("plugins")
|
|
1198
1198
|
if not plugins_dir.exists():
|
|
1199
1199
|
click.echo("Error: plugins/ directory not found")
|
|
@@ -1204,6 +1204,7 @@ def add(module_name):
|
|
|
1204
1204
|
click.echo(f"Module {module_name} already exists")
|
|
1205
1205
|
return
|
|
1206
1206
|
|
|
1207
|
+
# Create .cp config file
|
|
1207
1208
|
template = f"""SOURCE(include/{module_name}.cpp) {module_name}
|
|
1208
1209
|
|
|
1209
1210
|
PUBLIC(
|
|
@@ -1215,7 +1216,41 @@ PUBLIC(
|
|
|
1215
1216
|
f.write(template)
|
|
1216
1217
|
|
|
1217
1218
|
click.echo(f"Created {cp_file}")
|
|
1218
|
-
|
|
1219
|
+
|
|
1220
|
+
# Create include/ directory if it doesn't exist
|
|
1221
|
+
include_dir = Path("include")
|
|
1222
|
+
include_dir.mkdir(exist_ok=True)
|
|
1223
|
+
|
|
1224
|
+
# Create .cpp file with sample code
|
|
1225
|
+
cpp_file = include_dir / f"{module_name}.cpp"
|
|
1226
|
+
if not cpp_file.exists():
|
|
1227
|
+
cpp_template = f"""#include <string>
|
|
1228
|
+
#include <vector>
|
|
1229
|
+
|
|
1230
|
+
namespace includecpp {{
|
|
1231
|
+
|
|
1232
|
+
// Example function - returns a greeting
|
|
1233
|
+
std::string example_function(const std::string& name) {{
|
|
1234
|
+
return "Hello, " + name + "!";
|
|
1235
|
+
}}
|
|
1236
|
+
|
|
1237
|
+
// Add more functions here...
|
|
1238
|
+
// int add(int a, int b) {{ return a + b; }}
|
|
1239
|
+
// std::vector<int> range(int n) {{ ... }}
|
|
1240
|
+
|
|
1241
|
+
}} // namespace includecpp
|
|
1242
|
+
"""
|
|
1243
|
+
with open(cpp_file, 'w', encoding='utf-8') as f:
|
|
1244
|
+
f.write(cpp_template)
|
|
1245
|
+
|
|
1246
|
+
click.echo(f"Created {cpp_file}")
|
|
1247
|
+
else:
|
|
1248
|
+
click.echo(f"Note: {cpp_file} already exists, skipped")
|
|
1249
|
+
|
|
1250
|
+
click.echo(f"\nNext steps:")
|
|
1251
|
+
click.echo(f" 1. Edit include/{module_name}.cpp to add your functions")
|
|
1252
|
+
click.echo(f" 2. Update plugins/{module_name}.cp to expose functions")
|
|
1253
|
+
click.echo(f" 3. Run: includecpp rebuild")
|
|
1219
1254
|
|
|
1220
1255
|
@cli.command('list')
|
|
1221
1256
|
def list_modules():
|
|
@@ -7480,13 +7515,12 @@ def cssl_exec(path, code):
|
|
|
7480
7515
|
# Execute
|
|
7481
7516
|
click.secho("--- Output ---", fg='green')
|
|
7482
7517
|
try:
|
|
7483
|
-
result = cssl_lang.
|
|
7518
|
+
result = cssl_lang.run(source)
|
|
7484
7519
|
|
|
7485
7520
|
# Output is already printed to stdout during execution via runtime.output()
|
|
7486
|
-
#
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
click.echo(f"Result: {result}")
|
|
7521
|
+
# Don't print "Result:" automatically - users should use printl() for output
|
|
7522
|
+
# This prevents unwanted output for function calls like: Function();
|
|
7523
|
+
pass
|
|
7490
7524
|
|
|
7491
7525
|
except Exception as e:
|
|
7492
7526
|
click.secho(f"CSSL Error: {e}", fg='red')
|
|
@@ -7535,10 +7569,29 @@ def cssl_makemodule(path, output):
|
|
|
7535
7569
|
|
|
7536
7570
|
|
|
7537
7571
|
@cssl.command(name='doc')
|
|
7538
|
-
|
|
7539
|
-
|
|
7572
|
+
@click.argument('search', required=False, default=None)
|
|
7573
|
+
@click.option('--list', '-l', 'list_sections', is_flag=True, help='List all documentation sections')
|
|
7574
|
+
def cssl_doc(search, list_sections):
|
|
7575
|
+
"""Show CSSL documentation.
|
|
7576
|
+
|
|
7577
|
+
\b
|
|
7578
|
+
Usage:
|
|
7579
|
+
includecpp cssl doc # Show full documentation
|
|
7580
|
+
includecpp cssl doc "open" # Search for 'open' keyword
|
|
7581
|
+
includecpp cssl doc "$" # Search for shared variable syntax
|
|
7582
|
+
includecpp cssl doc "define" # Search for define keyword
|
|
7583
|
+
includecpp cssl doc --list # List all sections
|
|
7584
|
+
|
|
7585
|
+
\b
|
|
7586
|
+
Examples:
|
|
7587
|
+
includecpp cssl doc "class" # Show OOP/class documentation
|
|
7588
|
+
includecpp cssl doc "json::" # Show JSON functions
|
|
7589
|
+
includecpp cssl doc "this->" # Show this-> keyword usage
|
|
7590
|
+
includecpp cssl doc "map" # Show Map container docs
|
|
7591
|
+
"""
|
|
7540
7592
|
from pathlib import Path as PathLib
|
|
7541
7593
|
import os
|
|
7594
|
+
import re
|
|
7542
7595
|
|
|
7543
7596
|
# Find the documentation file in the cssl package directory
|
|
7544
7597
|
cssl_dir = PathLib(__file__).parent.parent / 'core' / 'cssl'
|
|
@@ -7558,8 +7611,122 @@ def cssl_doc():
|
|
|
7558
7611
|
|
|
7559
7612
|
if doc_path.exists():
|
|
7560
7613
|
content = doc_path.read_text(encoding='utf-8')
|
|
7561
|
-
|
|
7562
|
-
|
|
7614
|
+
|
|
7615
|
+
# List sections mode
|
|
7616
|
+
if list_sections:
|
|
7617
|
+
click.secho("CSSL Documentation Sections", fg='cyan', bold=True)
|
|
7618
|
+
click.secho("=" * 40, fg='cyan')
|
|
7619
|
+
sections = re.findall(r'^##\s+(.+)$', content, re.MULTILINE)
|
|
7620
|
+
for i, section in enumerate(sections, 1):
|
|
7621
|
+
click.echo(f" {i:2d}. {section}")
|
|
7622
|
+
click.echo()
|
|
7623
|
+
click.echo("Use: includecpp cssl doc \"<keyword>\" to search")
|
|
7624
|
+
return
|
|
7625
|
+
|
|
7626
|
+
# Search mode
|
|
7627
|
+
if search:
|
|
7628
|
+
click.secho(f"Searching for: '{search}'", fg='cyan', bold=True)
|
|
7629
|
+
click.secho("=" * 50, fg='cyan')
|
|
7630
|
+
click.echo()
|
|
7631
|
+
|
|
7632
|
+
# Split into subsections (### headers) for focused results
|
|
7633
|
+
subsections = re.split(r'(?=^### )', content, flags=re.MULTILINE)
|
|
7634
|
+
|
|
7635
|
+
# Also split into main sections (## headers)
|
|
7636
|
+
main_sections = re.split(r'(?=^## )', content, flags=re.MULTILINE)
|
|
7637
|
+
|
|
7638
|
+
# Find matching subsections (### level) - most focused
|
|
7639
|
+
matching_subsections = []
|
|
7640
|
+
for subsection in subsections:
|
|
7641
|
+
if search.lower() in subsection.lower():
|
|
7642
|
+
# Extract title
|
|
7643
|
+
title_match = re.match(r'^###\s+(.+)$', subsection, re.MULTILINE)
|
|
7644
|
+
if title_match:
|
|
7645
|
+
# Trim subsection to just the content until next ### or ##
|
|
7646
|
+
lines = subsection.split('\n')
|
|
7647
|
+
trimmed_lines = []
|
|
7648
|
+
for line in lines:
|
|
7649
|
+
if line.startswith('## ') and not line.startswith('### '):
|
|
7650
|
+
break
|
|
7651
|
+
trimmed_lines.append(line)
|
|
7652
|
+
matching_subsections.append((title_match.group(1), '\n'.join(trimmed_lines)))
|
|
7653
|
+
|
|
7654
|
+
if matching_subsections:
|
|
7655
|
+
click.secho(f"Found {len(matching_subsections)} matching subsection(s):", fg='green')
|
|
7656
|
+
click.echo()
|
|
7657
|
+
|
|
7658
|
+
# Show focused subsections (limit output)
|
|
7659
|
+
for title, sub_content in matching_subsections[:5]:
|
|
7660
|
+
click.secho(f"### {title}", fg='yellow', bold=True)
|
|
7661
|
+
# Highlight search term in content
|
|
7662
|
+
highlighted = re.sub(
|
|
7663
|
+
f'({re.escape(search)})',
|
|
7664
|
+
click.style(r'\1', fg='green', bold=True),
|
|
7665
|
+
sub_content,
|
|
7666
|
+
flags=re.IGNORECASE
|
|
7667
|
+
)
|
|
7668
|
+
# Limit lines per subsection
|
|
7669
|
+
lines = highlighted.split('\n')
|
|
7670
|
+
if len(lines) > 30:
|
|
7671
|
+
click.echo('\n'.join(lines[:30]))
|
|
7672
|
+
click.secho(f" ... ({len(lines) - 30} more lines)", fg='cyan')
|
|
7673
|
+
else:
|
|
7674
|
+
click.echo(highlighted)
|
|
7675
|
+
click.echo()
|
|
7676
|
+
click.secho("-" * 40, fg='cyan')
|
|
7677
|
+
click.echo()
|
|
7678
|
+
|
|
7679
|
+
if len(matching_subsections) > 5:
|
|
7680
|
+
click.secho(f"... and {len(matching_subsections) - 5} more subsections", fg='cyan')
|
|
7681
|
+
click.echo("Use --list to see all sections")
|
|
7682
|
+
else:
|
|
7683
|
+
# Fall back to main section search (## level)
|
|
7684
|
+
found_sections = []
|
|
7685
|
+
for section in main_sections:
|
|
7686
|
+
if search.lower() in section.lower():
|
|
7687
|
+
title_match = re.match(r'^##\s+(.+)$', section, re.MULTILINE)
|
|
7688
|
+
if title_match:
|
|
7689
|
+
found_sections.append((title_match.group(1), section))
|
|
7690
|
+
|
|
7691
|
+
if found_sections:
|
|
7692
|
+
click.secho(f"Found in {len(found_sections)} section(s):", fg='green')
|
|
7693
|
+
for title, _ in found_sections:
|
|
7694
|
+
click.echo(f" - {title}")
|
|
7695
|
+
click.echo()
|
|
7696
|
+
|
|
7697
|
+
# Show first matching section, trimmed
|
|
7698
|
+
title, section = found_sections[0]
|
|
7699
|
+
click.secho(f"## {title}", fg='yellow', bold=True)
|
|
7700
|
+
highlighted = re.sub(
|
|
7701
|
+
f'({re.escape(search)})',
|
|
7702
|
+
click.style(r'\1', fg='green', bold=True),
|
|
7703
|
+
section,
|
|
7704
|
+
flags=re.IGNORECASE
|
|
7705
|
+
)
|
|
7706
|
+
lines = highlighted.split('\n')
|
|
7707
|
+
if len(lines) > 40:
|
|
7708
|
+
click.echo('\n'.join(lines[:40]))
|
|
7709
|
+
click.secho(f"\n... ({len(lines) - 40} more lines in this section)", fg='cyan')
|
|
7710
|
+
else:
|
|
7711
|
+
click.echo(highlighted)
|
|
7712
|
+
else:
|
|
7713
|
+
click.secho(f"No matches found for '{search}'", fg='yellow')
|
|
7714
|
+
click.echo()
|
|
7715
|
+
click.echo("Try searching for:")
|
|
7716
|
+
click.echo(" - Keywords: class, function, define, open, global, shuffled")
|
|
7717
|
+
click.echo(" - Syntax: $, @, ::, this->, <<==, <==, #$")
|
|
7718
|
+
click.echo(" - Types: string, int, stack, vector, map, json")
|
|
7719
|
+
click.echo()
|
|
7720
|
+
click.echo("Or use: includecpp cssl doc --list")
|
|
7721
|
+
else:
|
|
7722
|
+
# Full documentation mode
|
|
7723
|
+
# Replace Unicode characters that may not be supported on all terminals
|
|
7724
|
+
safe_content = content.replace('✓', '[OK]').replace('✗', '[X]').replace('→', '->').replace('←', '<-').replace('•', '*').replace('─', '-').replace('│', '|').replace('└', '+').replace('├', '+').replace('▸', '>').replace('▾', 'v')
|
|
7725
|
+
try:
|
|
7726
|
+
click.echo_via_pager(safe_content)
|
|
7727
|
+
except UnicodeEncodeError:
|
|
7728
|
+
# Fallback: encode with errors='replace'
|
|
7729
|
+
click.echo(safe_content.encode('ascii', errors='replace').decode('ascii'))
|
|
7563
7730
|
else:
|
|
7564
7731
|
click.secho("Documentation file not found.", fg='yellow')
|
|
7565
7732
|
click.echo("Looking for: CSSL_DOCUMENTATION.md")
|
|
@@ -7697,26 +7864,46 @@ def cssl_vscode():
|
|
|
7697
7864
|
click.secho("CSSL extension files not found in package.", fg='red')
|
|
7698
7865
|
return
|
|
7699
7866
|
|
|
7700
|
-
#
|
|
7701
|
-
|
|
7867
|
+
# Get version from package.json
|
|
7868
|
+
pkg_json = source_ext_dir / 'package.json'
|
|
7869
|
+
current_version = "1.1.0"
|
|
7870
|
+
if pkg_json.exists():
|
|
7871
|
+
try:
|
|
7872
|
+
pkg_data = json.loads(pkg_json.read_text(encoding='utf-8'))
|
|
7873
|
+
current_version = pkg_data.get('version', '1.1.0')
|
|
7874
|
+
except:
|
|
7875
|
+
pass
|
|
7876
|
+
|
|
7877
|
+
target_dir = vscode_ext_dir / f'includecpp.cssl-{current_version}'
|
|
7702
7878
|
|
|
7703
7879
|
try:
|
|
7880
|
+
# Check for existing installations
|
|
7881
|
+
existing_version = None
|
|
7882
|
+
for existing in vscode_ext_dir.glob('includecpp.cssl-*'):
|
|
7883
|
+
existing_version = existing.name.split('-')[-1]
|
|
7884
|
+
if existing_version != current_version:
|
|
7885
|
+
click.echo(f"Removing old version: {existing_version}")
|
|
7886
|
+
shutil.rmtree(existing)
|
|
7887
|
+
|
|
7704
7888
|
if target_dir.exists():
|
|
7705
7889
|
shutil.rmtree(target_dir)
|
|
7706
7890
|
|
|
7707
7891
|
shutil.copytree(source_ext_dir, target_dir)
|
|
7708
7892
|
|
|
7709
|
-
|
|
7893
|
+
if existing_version and existing_version != current_version:
|
|
7894
|
+
click.secho(f"CSSL extension updated: v{existing_version} -> v{current_version}", fg='green', bold=True)
|
|
7895
|
+
else:
|
|
7896
|
+
click.secho(f"CSSL VSCode extension installed! (v{current_version})", fg='green', bold=True)
|
|
7710
7897
|
click.echo()
|
|
7711
7898
|
click.echo(f"Installed to: {target_dir}")
|
|
7712
7899
|
click.echo()
|
|
7713
7900
|
click.echo("Features:")
|
|
7714
7901
|
click.echo(" - Syntax highlighting for .cssl, .cssl-pl, .cssl-mod files")
|
|
7715
|
-
click.echo(" -
|
|
7716
|
-
click.echo(" -
|
|
7902
|
+
click.echo(" - OOP support: class, constructor, this->member")
|
|
7903
|
+
click.echo(" - Injection operators: <== (brute), <<== (infuse)")
|
|
7904
|
+
click.echo(" - Type highlighting: int, string, stack<T>, instance<>")
|
|
7717
7905
|
click.echo(" - Global references: @Name, r@Name, s@Name")
|
|
7718
7906
|
click.echo(" - Shared objects: $Name")
|
|
7719
|
-
click.echo(" - Filter helpers: string::contains, json::key, etc.")
|
|
7720
7907
|
click.echo()
|
|
7721
7908
|
click.secho("Restart VSCode to activate the extension.", fg='yellow')
|
|
7722
7909
|
|
|
@@ -7740,35 +7927,28 @@ cli.add_command(cssl)
|
|
|
7740
7927
|
def vscode(force, stubs_only):
|
|
7741
7928
|
"""Initialize or update VSCode configuration for IncludeCPP/CSSL.
|
|
7742
7929
|
|
|
7743
|
-
|
|
7744
|
-
- CSSL language support (syntax highlighting, snippets)
|
|
7745
|
-
- Type stubs for builtins (.pyi files)
|
|
7746
|
-
- Auto-generated stubs for your plugins and modules
|
|
7930
|
+
Installs CSSL extension globally and sets up project stubs.
|
|
7747
7931
|
|
|
7748
7932
|
\b
|
|
7749
7933
|
Usage:
|
|
7750
|
-
includecpp vscode #
|
|
7751
|
-
includecpp vscode --force # Force
|
|
7934
|
+
includecpp vscode # Install/update extension + stubs
|
|
7935
|
+
includecpp vscode --force # Force reinstall extension
|
|
7752
7936
|
includecpp vscode --stubs-only # Only update stubs
|
|
7753
7937
|
|
|
7754
7938
|
\b
|
|
7755
|
-
What it
|
|
7756
|
-
.vscode/
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
stubs/ - Type stubs for IDE support
|
|
7760
|
-
cssl_builtins.pyi - CSSL builtin functions
|
|
7761
|
-
plugins/ - Stubs for your .cp plugins
|
|
7762
|
-
modules/ - Stubs for your modules
|
|
7939
|
+
What it does:
|
|
7940
|
+
1. Installs CSSL extension globally (~/.vscode/extensions/)
|
|
7941
|
+
2. Creates .vscode/settings.json with file associations
|
|
7942
|
+
3. Creates .vscode/stubs/ with type hints for IDE support
|
|
7763
7943
|
"""
|
|
7764
7944
|
from pathlib import Path as PathLib
|
|
7945
|
+
import os
|
|
7765
7946
|
|
|
7766
7947
|
cwd = PathLib.cwd()
|
|
7767
7948
|
vscode_dir = cwd / '.vscode'
|
|
7768
7949
|
stubs_dir = vscode_dir / 'stubs'
|
|
7769
7950
|
plugins_stubs_dir = stubs_dir / 'plugins'
|
|
7770
7951
|
modules_stubs_dir = stubs_dir / 'modules'
|
|
7771
|
-
cssl_ext_dir = vscode_dir / 'cssl'
|
|
7772
7952
|
|
|
7773
7953
|
# Create directories
|
|
7774
7954
|
vscode_dir.mkdir(exist_ok=True)
|
|
@@ -7784,56 +7964,79 @@ def vscode(force, stubs_only):
|
|
|
7784
7964
|
updated_count = 0
|
|
7785
7965
|
created_count = 0
|
|
7786
7966
|
|
|
7787
|
-
# 1.
|
|
7967
|
+
# 1. Install CSSL extension GLOBALLY (unless stubs-only)
|
|
7788
7968
|
if not stubs_only:
|
|
7789
|
-
click.secho("
|
|
7969
|
+
click.secho("Installing CSSL extension globally...", fg='yellow')
|
|
7790
7970
|
|
|
7791
7971
|
# Find source extension directory
|
|
7792
7972
|
source_ext_dir = PathLib(__file__).parent.parent / 'vscode' / 'cssl'
|
|
7793
7973
|
|
|
7794
7974
|
if source_ext_dir.exists():
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
click.echo(f"
|
|
7975
|
+
# Get version from package.json
|
|
7976
|
+
pkg_json = source_ext_dir / 'package.json'
|
|
7977
|
+
current_version = "1.1.0"
|
|
7978
|
+
if pkg_json.exists():
|
|
7979
|
+
try:
|
|
7980
|
+
pkg_data = json.loads(pkg_json.read_text(encoding='utf-8'))
|
|
7981
|
+
current_version = pkg_data.get('version', '1.1.0')
|
|
7982
|
+
except:
|
|
7983
|
+
pass
|
|
7984
|
+
|
|
7985
|
+
# Find global VSCode extensions directory
|
|
7986
|
+
if os.name == 'nt': # Windows
|
|
7987
|
+
global_ext_dir = PathLib(os.environ.get('USERPROFILE', '')) / '.vscode' / 'extensions'
|
|
7988
|
+
else: # Linux/Mac
|
|
7989
|
+
global_ext_dir = PathLib.home() / '.vscode' / 'extensions'
|
|
7990
|
+
|
|
7991
|
+
if not global_ext_dir.exists():
|
|
7992
|
+
# Try VSCode Insiders
|
|
7993
|
+
if os.name == 'nt':
|
|
7994
|
+
global_ext_dir = PathLib(os.environ.get('USERPROFILE', '')) / '.vscode-insiders' / 'extensions'
|
|
7995
|
+
else:
|
|
7996
|
+
global_ext_dir = PathLib.home() / '.vscode-insiders' / 'extensions'
|
|
7997
|
+
|
|
7998
|
+
if global_ext_dir.exists():
|
|
7999
|
+
target_dir = global_ext_dir / f'includecpp.cssl-{current_version}'
|
|
8000
|
+
|
|
8001
|
+
# Check if already installed with same or older version
|
|
8002
|
+
needs_install = force
|
|
8003
|
+
existing_version = None
|
|
8004
|
+
|
|
8005
|
+
# Find existing installations
|
|
8006
|
+
for existing in global_ext_dir.glob('includecpp.cssl-*'):
|
|
8007
|
+
existing_version = existing.name.split('-')[-1]
|
|
8008
|
+
if existing_version != current_version:
|
|
8009
|
+
# Remove old version
|
|
8010
|
+
click.echo(f" Removing old version: {existing_version}")
|
|
8011
|
+
shutil.rmtree(existing)
|
|
8012
|
+
needs_install = True
|
|
8013
|
+
elif not force:
|
|
8014
|
+
click.echo(f" Already installed: v{current_version}")
|
|
8015
|
+
needs_install = False
|
|
8016
|
+
|
|
8017
|
+
if not target_dir.exists():
|
|
8018
|
+
needs_install = True
|
|
8019
|
+
|
|
8020
|
+
if needs_install:
|
|
8021
|
+
# Remove target if exists (force reinstall)
|
|
8022
|
+
if target_dir.exists():
|
|
8023
|
+
shutil.rmtree(target_dir)
|
|
8024
|
+
|
|
8025
|
+
# Copy extension to global directory
|
|
8026
|
+
shutil.copytree(source_ext_dir, target_dir)
|
|
8027
|
+
created_count += 1
|
|
8028
|
+
|
|
8029
|
+
if existing_version and existing_version != current_version:
|
|
8030
|
+
click.secho(f" Updated: v{existing_version} -> v{current_version}", fg='green')
|
|
8031
|
+
else:
|
|
8032
|
+
click.secho(f" Installed: v{current_version}", fg='green')
|
|
7835
8033
|
|
|
7836
|
-
|
|
8034
|
+
click.echo(f" Location: {target_dir}")
|
|
8035
|
+
click.echo()
|
|
8036
|
+
click.secho(" Restart VSCode to activate the extension!", fg='yellow', bold=True)
|
|
8037
|
+
else:
|
|
8038
|
+
click.secho(" VSCode extensions directory not found.", fg='red')
|
|
8039
|
+
click.echo(" Make sure VSCode is installed.")
|
|
7837
8040
|
else:
|
|
7838
8041
|
click.secho(" Warning: CSSL extension source not found", fg='yellow')
|
|
7839
8042
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CSSL - C-Style Scripting Language
|
|
2
2
|
|
|
3
|
-
> Version 3.7.
|
|
3
|
+
> Version 3.7.6 | A modern scripting language with C++-style syntax and unique features like CodeInfusion and BruteInjection.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -41,22 +41,25 @@
|
|
|
41
41
|
```python
|
|
42
42
|
from includecpp import CSSL
|
|
43
43
|
|
|
44
|
-
#
|
|
45
|
-
CSSL.
|
|
46
|
-
|
|
47
|
-
# Execute code
|
|
48
|
-
CSSL.exec("""
|
|
44
|
+
# Execute code (v3.7.6+: use run() instead of exec())
|
|
45
|
+
CSSL.run("""
|
|
49
46
|
printl("Hello CSSL!");
|
|
50
47
|
""")
|
|
51
48
|
|
|
52
49
|
# With parameters and return value
|
|
53
|
-
result = CSSL.
|
|
50
|
+
result = CSSL.run("""
|
|
54
51
|
string name = parameter.get(0);
|
|
55
52
|
printl("Hello " + name);
|
|
56
53
|
parameter.return(true);
|
|
57
54
|
""", "World")
|
|
58
55
|
|
|
59
56
|
print(result) # True
|
|
57
|
+
|
|
58
|
+
# Create typed scripts and modules (v3.7.6+)
|
|
59
|
+
main = CSSL.script("cssl", '''printl("Main");''')
|
|
60
|
+
payload = CSSL.script("cssl-pl", '''void helper() { printl("Helper!"); }''')
|
|
61
|
+
mod = CSSL.makemodule(main, payload, "mymod")
|
|
62
|
+
mod.helper() # Call function directly
|
|
60
63
|
```
|
|
61
64
|
|
|
62
65
|
### CLI Execution
|
|
@@ -701,12 +704,24 @@ super void forceRun() {
|
|
|
701
704
|
|
|
702
705
|
### shuffled
|
|
703
706
|
|
|
704
|
-
Allows multiple return values.
|
|
707
|
+
Allows multiple return values with tuple unpacking.
|
|
705
708
|
|
|
706
709
|
```cssl
|
|
707
710
|
shuffled string getNames() {
|
|
708
711
|
return "Alice", "Bob", "Charlie";
|
|
709
712
|
}
|
|
713
|
+
|
|
714
|
+
// Tuple unpacking (v3.7.6+)
|
|
715
|
+
a, b, c = getNames();
|
|
716
|
+
printl(a); // "Alice"
|
|
717
|
+
printl(b); // "Bob"
|
|
718
|
+
printl(c); // "Charlie"
|
|
719
|
+
|
|
720
|
+
// Works with any types
|
|
721
|
+
shuffled getValues() {
|
|
722
|
+
return "text", 42, true;
|
|
723
|
+
}
|
|
724
|
+
name, num, flag = getValues();
|
|
710
725
|
```
|
|
711
726
|
|
|
712
727
|
---
|
|
@@ -1143,6 +1158,10 @@ print(stats.total) # 50 - Persisted!
|
|
|
1143
1158
|
|
|
1144
1159
|
CodeInfusion enables modifying functions at runtime.
|
|
1145
1160
|
|
|
1161
|
+
> **Important**: Injection operators must be written **without spaces**:
|
|
1162
|
+
> - ✓ `func() <<==` / `func() +<<==` / `func() -<<==` (correct)
|
|
1163
|
+
> - ✗ `func() < <==` / `func() + <<==` / `func() - <<==` (wrong)
|
|
1164
|
+
|
|
1146
1165
|
### <<== (Replace)
|
|
1147
1166
|
|
|
1148
1167
|
Replaces function content.
|
includecpp/core/cssl/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
CSSL -
|
|
2
|
+
CSSL - C-Style Scripting Language
|
|
3
3
|
Bundled with IncludeCPP for integrated scripting support.
|
|
4
4
|
|
|
5
5
|
Features:
|
|
@@ -16,7 +16,10 @@ from .cssl_parser import (
|
|
|
16
16
|
CSSLSyntaxError, CSSLLexer, CSSLParser, ASTNode,
|
|
17
17
|
KEYWORDS, TYPE_GENERICS, TYPE_PARAM_FUNCTIONS, INJECTION_HELPERS
|
|
18
18
|
)
|
|
19
|
-
from .cssl_runtime import
|
|
19
|
+
from .cssl_runtime import (
|
|
20
|
+
CSSLRuntime, CSSLRuntimeError, CSSLServiceRunner, run_cssl, run_cssl_file,
|
|
21
|
+
register_filter, unregister_filter, get_custom_filters
|
|
22
|
+
)
|
|
20
23
|
from .cssl_types import (
|
|
21
24
|
DataStruct, Shuffled, Iterator, Combo, DataSpace, OpenQuote,
|
|
22
25
|
OpenFind, Parameter, Stack, Vector, Array,
|
|
@@ -33,6 +36,8 @@ __all__ = [
|
|
|
33
36
|
# Runtime
|
|
34
37
|
'CSSLRuntime', 'CSSLRuntimeError', 'CSSLServiceRunner',
|
|
35
38
|
'run_cssl', 'run_cssl_file',
|
|
39
|
+
# Filter Registration
|
|
40
|
+
'register_filter', 'unregister_filter', 'get_custom_filters',
|
|
36
41
|
# Data Types
|
|
37
42
|
'DataStruct', 'Shuffled', 'Iterator', 'Combo', 'DataSpace', 'OpenQuote',
|
|
38
43
|
'OpenFind', 'Parameter', 'Stack', 'Vector', 'Array',
|