IncludeCPP 3.7.9__py3-none-any.whl → 3.8.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/__init__.pyi +2 -2
- includecpp/cli/commands.py +129 -67
- includecpp/core/cssl/__init__.py +7 -2
- includecpp/core/cssl/cssl_builtins.py +411 -9
- includecpp/core/cssl/cssl_builtins.pyi +3682 -401
- includecpp/core/cssl/cssl_parser.py +130 -31
- includecpp/core/cssl/cssl_runtime.py +462 -26
- includecpp/core/cssl/cssl_syntax.py +7 -7
- includecpp/core/cssl/cssl_types.py +75 -2
- includecpp/core/cssl_bridge.py +64 -6
- 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/package.json +117 -11
- includecpp/vscode/cssl/snippets/cssl.snippets.json +126 -0
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +46 -15
- {includecpp-3.7.9.dist-info → includecpp-3.8.0.dist-info}/METADATA +56 -225
- {includecpp-3.7.9.dist-info → includecpp-3.8.0.dist-info}/RECORD +23 -20
- {includecpp-3.7.9.dist-info → includecpp-3.8.0.dist-info}/WHEEL +0 -0
- {includecpp-3.7.9.dist-info → includecpp-3.8.0.dist-info}/entry_points.txt +0 -0
- {includecpp-3.7.9.dist-info → includecpp-3.8.0.dist-info}/licenses/LICENSE +0 -0
- {includecpp-3.7.9.dist-info → includecpp-3.8.0.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
|
@@ -7457,11 +7457,24 @@ def cssl():
|
|
|
7457
7457
|
pass
|
|
7458
7458
|
|
|
7459
7459
|
|
|
7460
|
+
@cssl.command(name='run')
|
|
7461
|
+
@click.argument('path', required=False, type=click.Path())
|
|
7462
|
+
@click.option('--code', '-c', type=str, help='Execute code directly')
|
|
7463
|
+
def cssl_run(path, code):
|
|
7464
|
+
"""Run/execute CSSL code or file."""
|
|
7465
|
+
_cssl_execute(path, code)
|
|
7466
|
+
|
|
7467
|
+
|
|
7460
7468
|
@cssl.command(name='exec')
|
|
7461
7469
|
@click.argument('path', required=False, type=click.Path())
|
|
7462
7470
|
@click.option('--code', '-c', type=str, help='Execute code directly')
|
|
7463
7471
|
def cssl_exec(path, code):
|
|
7464
|
-
"""Execute CSSL code or file."""
|
|
7472
|
+
"""Execute CSSL code or file (alias for 'run')."""
|
|
7473
|
+
_cssl_execute(path, code)
|
|
7474
|
+
|
|
7475
|
+
|
|
7476
|
+
def _cssl_execute(path, code):
|
|
7477
|
+
"""Internal: Execute CSSL code or file."""
|
|
7465
7478
|
from pathlib import Path as PathLib
|
|
7466
7479
|
|
|
7467
7480
|
try:
|
|
@@ -7720,7 +7733,13 @@ def cssl_doc(search, list_sections):
|
|
|
7720
7733
|
click.echo("Or use: includecpp cssl doc --list")
|
|
7721
7734
|
else:
|
|
7722
7735
|
# Full documentation mode
|
|
7723
|
-
|
|
7736
|
+
# Replace Unicode characters that may not be supported on all terminals
|
|
7737
|
+
safe_content = content.replace('✓', '[OK]').replace('✗', '[X]').replace('→', '->').replace('←', '<-').replace('•', '*').replace('─', '-').replace('│', '|').replace('└', '+').replace('├', '+').replace('▸', '>').replace('▾', 'v')
|
|
7738
|
+
try:
|
|
7739
|
+
click.echo_via_pager(safe_content)
|
|
7740
|
+
except UnicodeEncodeError:
|
|
7741
|
+
# Fallback: encode with errors='replace'
|
|
7742
|
+
click.echo(safe_content.encode('ascii', errors='replace').decode('ascii'))
|
|
7724
7743
|
else:
|
|
7725
7744
|
click.secho("Documentation file not found.", fg='yellow')
|
|
7726
7745
|
click.echo("Looking for: CSSL_DOCUMENTATION.md")
|
|
@@ -7858,26 +7877,46 @@ def cssl_vscode():
|
|
|
7858
7877
|
click.secho("CSSL extension files not found in package.", fg='red')
|
|
7859
7878
|
return
|
|
7860
7879
|
|
|
7861
|
-
#
|
|
7862
|
-
|
|
7880
|
+
# Get version from package.json
|
|
7881
|
+
pkg_json = source_ext_dir / 'package.json'
|
|
7882
|
+
current_version = "1.1.0"
|
|
7883
|
+
if pkg_json.exists():
|
|
7884
|
+
try:
|
|
7885
|
+
pkg_data = json.loads(pkg_json.read_text(encoding='utf-8'))
|
|
7886
|
+
current_version = pkg_data.get('version', '1.1.0')
|
|
7887
|
+
except:
|
|
7888
|
+
pass
|
|
7889
|
+
|
|
7890
|
+
target_dir = vscode_ext_dir / f'includecpp.cssl-{current_version}'
|
|
7863
7891
|
|
|
7864
7892
|
try:
|
|
7893
|
+
# Check for existing installations
|
|
7894
|
+
existing_version = None
|
|
7895
|
+
for existing in vscode_ext_dir.glob('includecpp.cssl-*'):
|
|
7896
|
+
existing_version = existing.name.split('-')[-1]
|
|
7897
|
+
if existing_version != current_version:
|
|
7898
|
+
click.echo(f"Removing old version: {existing_version}")
|
|
7899
|
+
shutil.rmtree(existing)
|
|
7900
|
+
|
|
7865
7901
|
if target_dir.exists():
|
|
7866
7902
|
shutil.rmtree(target_dir)
|
|
7867
7903
|
|
|
7868
7904
|
shutil.copytree(source_ext_dir, target_dir)
|
|
7869
7905
|
|
|
7870
|
-
|
|
7906
|
+
if existing_version and existing_version != current_version:
|
|
7907
|
+
click.secho(f"CSSL extension updated: v{existing_version} -> v{current_version}", fg='green', bold=True)
|
|
7908
|
+
else:
|
|
7909
|
+
click.secho(f"CSSL VSCode extension installed! (v{current_version})", fg='green', bold=True)
|
|
7871
7910
|
click.echo()
|
|
7872
7911
|
click.echo(f"Installed to: {target_dir}")
|
|
7873
7912
|
click.echo()
|
|
7874
7913
|
click.echo("Features:")
|
|
7875
7914
|
click.echo(" - Syntax highlighting for .cssl, .cssl-pl, .cssl-mod files")
|
|
7876
|
-
click.echo(" -
|
|
7877
|
-
click.echo(" -
|
|
7915
|
+
click.echo(" - OOP support: class, constructor, this->member")
|
|
7916
|
+
click.echo(" - Injection operators: <== (brute), <<== (infuse)")
|
|
7917
|
+
click.echo(" - Type highlighting: int, string, stack<T>, instance<>")
|
|
7878
7918
|
click.echo(" - Global references: @Name, r@Name, s@Name")
|
|
7879
7919
|
click.echo(" - Shared objects: $Name")
|
|
7880
|
-
click.echo(" - Filter helpers: string::contains, json::key, etc.")
|
|
7881
7920
|
click.echo()
|
|
7882
7921
|
click.secho("Restart VSCode to activate the extension.", fg='yellow')
|
|
7883
7922
|
|
|
@@ -7897,39 +7936,34 @@ cli.add_command(cssl)
|
|
|
7897
7936
|
|
|
7898
7937
|
@cli.command()
|
|
7899
7938
|
@click.option('--force', '-f', is_flag=True, help='Force overwrite existing files')
|
|
7939
|
+
@click.option('--reinstall', '-r', is_flag=True, help='Reinstall extension (removes all versions first)')
|
|
7900
7940
|
@click.option('--stubs-only', is_flag=True, help='Only update stubs, skip extension files')
|
|
7901
|
-
def vscode(force, stubs_only):
|
|
7941
|
+
def vscode(force, reinstall, stubs_only):
|
|
7902
7942
|
"""Initialize or update VSCode configuration for IncludeCPP/CSSL.
|
|
7903
7943
|
|
|
7904
|
-
|
|
7905
|
-
- CSSL language support (syntax highlighting, snippets)
|
|
7906
|
-
- Type stubs for builtins (.pyi files)
|
|
7907
|
-
- Auto-generated stubs for your plugins and modules
|
|
7944
|
+
Installs CSSL extension globally and sets up project stubs.
|
|
7908
7945
|
|
|
7909
7946
|
\b
|
|
7910
7947
|
Usage:
|
|
7911
|
-
includecpp vscode
|
|
7912
|
-
includecpp vscode --force
|
|
7948
|
+
includecpp vscode # Install/update extension + stubs
|
|
7949
|
+
includecpp vscode --force # Force reinstall extension
|
|
7950
|
+
includecpp vscode --reinstall # Remove ALL versions & reinstall fresh
|
|
7913
7951
|
includecpp vscode --stubs-only # Only update stubs
|
|
7914
7952
|
|
|
7915
7953
|
\b
|
|
7916
|
-
What it
|
|
7917
|
-
.vscode/
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
stubs/ - Type stubs for IDE support
|
|
7921
|
-
cssl_builtins.pyi - CSSL builtin functions
|
|
7922
|
-
plugins/ - Stubs for your .cp plugins
|
|
7923
|
-
modules/ - Stubs for your modules
|
|
7954
|
+
What it does:
|
|
7955
|
+
1. Installs CSSL extension globally (~/.vscode/extensions/)
|
|
7956
|
+
2. Creates .vscode/settings.json with file associations
|
|
7957
|
+
3. Creates .vscode/stubs/ with type hints for IDE support
|
|
7924
7958
|
"""
|
|
7925
7959
|
from pathlib import Path as PathLib
|
|
7960
|
+
import os
|
|
7926
7961
|
|
|
7927
7962
|
cwd = PathLib.cwd()
|
|
7928
7963
|
vscode_dir = cwd / '.vscode'
|
|
7929
7964
|
stubs_dir = vscode_dir / 'stubs'
|
|
7930
7965
|
plugins_stubs_dir = stubs_dir / 'plugins'
|
|
7931
7966
|
modules_stubs_dir = stubs_dir / 'modules'
|
|
7932
|
-
cssl_ext_dir = vscode_dir / 'cssl'
|
|
7933
7967
|
|
|
7934
7968
|
# Create directories
|
|
7935
7969
|
vscode_dir.mkdir(exist_ok=True)
|
|
@@ -7945,56 +7979,84 @@ def vscode(force, stubs_only):
|
|
|
7945
7979
|
updated_count = 0
|
|
7946
7980
|
created_count = 0
|
|
7947
7981
|
|
|
7948
|
-
# 1.
|
|
7982
|
+
# 1. Install CSSL extension GLOBALLY (unless stubs-only)
|
|
7949
7983
|
if not stubs_only:
|
|
7950
|
-
click.secho("
|
|
7984
|
+
click.secho("Installing CSSL extension globally...", fg='yellow')
|
|
7951
7985
|
|
|
7952
7986
|
# Find source extension directory
|
|
7953
7987
|
source_ext_dir = PathLib(__file__).parent.parent / 'vscode' / 'cssl'
|
|
7954
7988
|
|
|
7955
7989
|
if source_ext_dir.exists():
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7990
|
+
# Get version from package.json
|
|
7991
|
+
pkg_json = source_ext_dir / 'package.json'
|
|
7992
|
+
current_version = "1.1.0"
|
|
7993
|
+
if pkg_json.exists():
|
|
7994
|
+
try:
|
|
7995
|
+
pkg_data = json.loads(pkg_json.read_text(encoding='utf-8'))
|
|
7996
|
+
current_version = pkg_data.get('version', '1.1.0')
|
|
7997
|
+
except:
|
|
7998
|
+
pass
|
|
7999
|
+
|
|
8000
|
+
# Find global VSCode extensions directory
|
|
8001
|
+
if os.name == 'nt': # Windows
|
|
8002
|
+
global_ext_dir = PathLib(os.environ.get('USERPROFILE', '')) / '.vscode' / 'extensions'
|
|
8003
|
+
else: # Linux/Mac
|
|
8004
|
+
global_ext_dir = PathLib.home() / '.vscode' / 'extensions'
|
|
8005
|
+
|
|
8006
|
+
if not global_ext_dir.exists():
|
|
8007
|
+
# Try VSCode Insiders
|
|
8008
|
+
if os.name == 'nt':
|
|
8009
|
+
global_ext_dir = PathLib(os.environ.get('USERPROFILE', '')) / '.vscode-insiders' / 'extensions'
|
|
8010
|
+
else:
|
|
8011
|
+
global_ext_dir = PathLib.home() / '.vscode-insiders' / 'extensions'
|
|
8012
|
+
|
|
8013
|
+
if global_ext_dir.exists():
|
|
8014
|
+
target_dir = global_ext_dir / f'includecpp.cssl-{current_version}'
|
|
8015
|
+
|
|
8016
|
+
# Check if already installed with same or older version
|
|
8017
|
+
needs_install = force or reinstall
|
|
8018
|
+
existing_version = None
|
|
8019
|
+
|
|
8020
|
+
# Find existing installations
|
|
8021
|
+
for existing in global_ext_dir.glob('includecpp.cssl-*'):
|
|
8022
|
+
existing_version = existing.name.split('-')[-1]
|
|
8023
|
+
if reinstall:
|
|
8024
|
+
# --reinstall: Remove ALL versions
|
|
8025
|
+
click.echo(f" Removing version: {existing_version}")
|
|
8026
|
+
shutil.rmtree(existing)
|
|
8027
|
+
needs_install = True
|
|
8028
|
+
elif existing_version != current_version:
|
|
8029
|
+
# Remove old version
|
|
8030
|
+
click.echo(f" Removing old version: {existing_version}")
|
|
8031
|
+
shutil.rmtree(existing)
|
|
8032
|
+
needs_install = True
|
|
8033
|
+
elif not force:
|
|
8034
|
+
click.echo(f" Already installed: v{current_version}")
|
|
8035
|
+
needs_install = False
|
|
8036
|
+
|
|
8037
|
+
if not target_dir.exists():
|
|
8038
|
+
needs_install = True
|
|
8039
|
+
|
|
8040
|
+
if needs_install:
|
|
8041
|
+
# Remove target if exists (force reinstall)
|
|
8042
|
+
if target_dir.exists():
|
|
8043
|
+
shutil.rmtree(target_dir)
|
|
8044
|
+
|
|
8045
|
+
# Copy extension to global directory
|
|
8046
|
+
shutil.copytree(source_ext_dir, target_dir)
|
|
8047
|
+
created_count += 1
|
|
8048
|
+
|
|
8049
|
+
if existing_version and existing_version != current_version:
|
|
8050
|
+
click.secho(f" Updated: v{existing_version} -> v{current_version}", fg='green')
|
|
8051
|
+
else:
|
|
8052
|
+
click.secho(f" Installed: v{current_version}", fg='green')
|
|
7996
8053
|
|
|
7997
|
-
|
|
8054
|
+
click.echo(f" Location: {target_dir}")
|
|
8055
|
+
click.echo()
|
|
8056
|
+
click.secho(" Restart VSCode to activate the extension!", fg='yellow', bold=True)
|
|
8057
|
+
else:
|
|
8058
|
+
click.secho(" VSCode extensions directory not found.", fg='red')
|
|
8059
|
+
click.echo(" Make sure VSCode is installed.")
|
|
7998
8060
|
else:
|
|
7999
8061
|
click.secho(" Warning: CSSL extension source not found", fg='yellow')
|
|
8000
8062
|
|
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',
|