IncludeCPP 4.0.0__py3-none-any.whl → 4.2.2__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/CHANGELOG.md +175 -0
- includecpp/DOCUMENTATION.md +593 -0
- includecpp/__init__.py +1 -1
- includecpp/__init__.pyi +4 -1
- includecpp/cli/commands.py +705 -98
- includecpp/core/ai_integration.py +46 -13
- includecpp/core/cpp_api_extensions.pyi +350 -0
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +186 -5
- includecpp/core/cssl/cssl_builtins.py +101 -4
- includecpp/core/cssl/cssl_languages.py +1757 -0
- includecpp/core/cssl/cssl_parser.py +437 -104
- includecpp/core/cssl/cssl_runtime.py +865 -62
- includecpp/core/cssl/cssl_syntax.py +88 -4
- includecpp/core/cssl/cssl_types.py +172 -1
- includecpp/core/cssl_bridge.py +198 -12
- includecpp/core/cssl_bridge.pyi +717 -186
- includecpp/generator/parser.cpp +121 -4
- includecpp/generator/parser.h +6 -0
- includecpp/vscode/cssl/package.json +43 -1
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +140 -17
- {includecpp-4.0.0.dist-info → includecpp-4.2.2.dist-info}/METADATA +102 -1
- {includecpp-4.0.0.dist-info → includecpp-4.2.2.dist-info}/RECORD +26 -22
- {includecpp-4.0.0.dist-info → includecpp-4.2.2.dist-info}/WHEEL +0 -0
- {includecpp-4.0.0.dist-info → includecpp-4.2.2.dist-info}/entry_points.txt +0 -0
- {includecpp-4.0.0.dist-info → includecpp-4.2.2.dist-info}/licenses/LICENSE +0 -0
- {includecpp-4.0.0.dist-info → includecpp-4.2.2.dist-info}/top_level.txt +0 -0
includecpp/generator/parser.cpp
CHANGED
|
@@ -599,13 +599,81 @@ ModuleDescriptor API::parse_cp_file(const std::string& filepath) {
|
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
-
// Parse
|
|
602
|
+
// v4.1.1: Parse CONSTRUCTOR, METHOD, and FIELD entries for STRUCT
|
|
603
603
|
auto field_lines = split(field_block, '\n');
|
|
604
604
|
for (const auto& fline : field_lines) {
|
|
605
605
|
std::string ftrim = trim(fline);
|
|
606
606
|
if (ftrim.empty()) continue;
|
|
607
607
|
|
|
608
|
-
|
|
608
|
+
// v4.1.1: Parse CONSTRUCTOR(type1, type2, ...) for parametrized constructors
|
|
609
|
+
if (ftrim.find("CONSTRUCTOR") != std::string::npos) {
|
|
610
|
+
size_t c_start = ftrim.find('(');
|
|
611
|
+
size_t c_end = ftrim.rfind(')');
|
|
612
|
+
if (c_start != std::string::npos && c_end != std::string::npos) {
|
|
613
|
+
std::string params_str = ftrim.substr(c_start + 1, c_end - c_start - 1);
|
|
614
|
+
ConstructorInfo ctor;
|
|
615
|
+
if (!params_str.empty()) {
|
|
616
|
+
auto params = split(params_str, ',');
|
|
617
|
+
for (auto& p : params) {
|
|
618
|
+
std::string param_type = trim(p);
|
|
619
|
+
if (!param_type.empty()) {
|
|
620
|
+
ctor.param_types.push_back(param_type);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
sb.constructors.push_back(ctor);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
// v4.1.1: Parse METHOD and METHOD_CONST for STRUCT
|
|
628
|
+
else if (ftrim.find("METHOD") != std::string::npos) {
|
|
629
|
+
MethodSignature sig;
|
|
630
|
+
bool is_const_method = ftrim.find("METHOD_CONST") != std::string::npos;
|
|
631
|
+
|
|
632
|
+
size_t m_start = ftrim.find('(');
|
|
633
|
+
size_t m_end = ftrim.rfind(')');
|
|
634
|
+
|
|
635
|
+
if (m_start != std::string::npos && m_end != std::string::npos) {
|
|
636
|
+
std::string content = ftrim.substr(m_start + 1, m_end - m_start - 1);
|
|
637
|
+
|
|
638
|
+
// Parse method name and optional parameter types
|
|
639
|
+
std::vector<std::string> parts;
|
|
640
|
+
int template_depth = 0;
|
|
641
|
+
std::string current_part;
|
|
642
|
+
|
|
643
|
+
for (char c : content) {
|
|
644
|
+
if (c == '<') {
|
|
645
|
+
template_depth++;
|
|
646
|
+
current_part += c;
|
|
647
|
+
} else if (c == '>') {
|
|
648
|
+
template_depth--;
|
|
649
|
+
current_part += c;
|
|
650
|
+
} else if (c == ',' && template_depth == 0) {
|
|
651
|
+
parts.push_back(trim(current_part));
|
|
652
|
+
current_part.clear();
|
|
653
|
+
} else {
|
|
654
|
+
current_part += c;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (!current_part.empty()) {
|
|
658
|
+
parts.push_back(trim(current_part));
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (!parts.empty()) {
|
|
662
|
+
sig.name = parts[0];
|
|
663
|
+
sig.is_const = is_const_method;
|
|
664
|
+
|
|
665
|
+
// Remaining parts are parameter types
|
|
666
|
+
for (size_t k = 1; k < parts.size(); ++k) {
|
|
667
|
+
sig.param_types.push_back(parts[k]);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
sb.method_signatures.push_back(sig);
|
|
671
|
+
sb.methods.push_back(sig.name);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
// Parse FIELD(name) or FIELD(type, name)
|
|
676
|
+
else if (ftrim.find("FIELD(") != std::string::npos) {
|
|
609
677
|
size_t f_start = ftrim.find('(');
|
|
610
678
|
size_t f_end = ftrim.find(')');
|
|
611
679
|
if (f_start != std::string::npos && f_end != std::string::npos) {
|
|
@@ -616,6 +684,10 @@ ModuleDescriptor API::parse_cp_file(const std::string& filepath) {
|
|
|
616
684
|
std::string field_type = trim(field_parts[0]);
|
|
617
685
|
std::string field_name = trim(field_parts[1]);
|
|
618
686
|
sb.fields.push_back({field_type, field_name});
|
|
687
|
+
} else if (field_parts.size() == 1) {
|
|
688
|
+
// Simple FIELD(name) - type will be inferred
|
|
689
|
+
std::string field_name = trim(field_parts[0]);
|
|
690
|
+
sb.fields.push_back({"auto", field_name});
|
|
619
691
|
}
|
|
620
692
|
}
|
|
621
693
|
}
|
|
@@ -870,7 +942,24 @@ std::string generate_struct_bindings(const StructBinding& sb, const ModuleDescri
|
|
|
870
942
|
|
|
871
943
|
code << " py::class_<" << cpp_type << ">(";
|
|
872
944
|
code << mod.module_name << "_module, \"" << struct_full_name << "\")\n";
|
|
873
|
-
|
|
945
|
+
|
|
946
|
+
// v4.1.1: Generate all constructor overloads from CONSTRUCTOR() entries
|
|
947
|
+
if (sb.constructors.empty()) {
|
|
948
|
+
// Backward compatibility: default constructor if none specified
|
|
949
|
+
code << " .def(py::init<>())\n";
|
|
950
|
+
} else {
|
|
951
|
+
for (const auto& ctor : sb.constructors) {
|
|
952
|
+
code << " .def(py::init<";
|
|
953
|
+
for (size_t i = 0; i < ctor.param_types.size(); ++i) {
|
|
954
|
+
if (i > 0) code << ", ";
|
|
955
|
+
// Replace T with actual template type
|
|
956
|
+
std::string ptype = ctor.param_types[i];
|
|
957
|
+
if (ptype == "T") ptype = ttype;
|
|
958
|
+
code << ptype;
|
|
959
|
+
}
|
|
960
|
+
code << ">())\n";
|
|
961
|
+
}
|
|
962
|
+
}
|
|
874
963
|
|
|
875
964
|
// Fields - readwrite access
|
|
876
965
|
for (const auto& [field_type, field_name] : sb.fields) {
|
|
@@ -884,6 +973,15 @@ std::string generate_struct_bindings(const StructBinding& sb, const ModuleDescri
|
|
|
884
973
|
<< cpp_type << "::" << field_name << ")\n";
|
|
885
974
|
}
|
|
886
975
|
|
|
976
|
+
// v4.1.1: Generate method bindings
|
|
977
|
+
for (const auto& sig : sb.method_signatures) {
|
|
978
|
+
if (sig.is_const) {
|
|
979
|
+
code << " .def(\"" << sig.name << "\", &" << cpp_type << "::" << sig.name << ")\n";
|
|
980
|
+
} else {
|
|
981
|
+
code << " .def(\"" << sig.name << "\", &" << cpp_type << "::" << sig.name << ")\n";
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
887
985
|
// Auto-generate to_dict() method
|
|
888
986
|
code << " .def(\"to_dict\", [](" << cpp_type << "& self) {\n";
|
|
889
987
|
code << " py::dict d;\n";
|
|
@@ -917,7 +1015,21 @@ std::string generate_struct_bindings(const StructBinding& sb, const ModuleDescri
|
|
|
917
1015
|
// Non-template struct
|
|
918
1016
|
code << " py::class_<" << sb.struct_name << ">(";
|
|
919
1017
|
code << mod.module_name << "_module, \"" << sb.struct_name << "\")\n";
|
|
920
|
-
|
|
1018
|
+
|
|
1019
|
+
// v4.1.1: Generate all constructor overloads from CONSTRUCTOR() entries
|
|
1020
|
+
if (sb.constructors.empty()) {
|
|
1021
|
+
// Backward compatibility: default constructor if none specified
|
|
1022
|
+
code << " .def(py::init<>())\n";
|
|
1023
|
+
} else {
|
|
1024
|
+
for (const auto& ctor : sb.constructors) {
|
|
1025
|
+
code << " .def(py::init<";
|
|
1026
|
+
for (size_t i = 0; i < ctor.param_types.size(); ++i) {
|
|
1027
|
+
if (i > 0) code << ", ";
|
|
1028
|
+
code << ctor.param_types[i];
|
|
1029
|
+
}
|
|
1030
|
+
code << ">())\n";
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
921
1033
|
|
|
922
1034
|
// Fields
|
|
923
1035
|
for (const auto& [field_type, field_name] : sb.fields) {
|
|
@@ -925,6 +1037,11 @@ std::string generate_struct_bindings(const StructBinding& sb, const ModuleDescri
|
|
|
925
1037
|
<< sb.struct_name << "::" << field_name << ")\n";
|
|
926
1038
|
}
|
|
927
1039
|
|
|
1040
|
+
// v4.1.1: Generate method bindings
|
|
1041
|
+
for (const auto& sig : sb.method_signatures) {
|
|
1042
|
+
code << " .def(\"" << sig.name << "\", &" << sb.struct_name << "::" << sig.name << ")\n";
|
|
1043
|
+
}
|
|
1044
|
+
|
|
928
1045
|
// Auto-generate to_dict() method
|
|
929
1046
|
code << " .def(\"to_dict\", [](" << sb.struct_name << "& self) {\n";
|
|
930
1047
|
code << " py::dict d;\n";
|
includecpp/generator/parser.h
CHANGED
|
@@ -127,6 +127,7 @@ struct VariableBinding {
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
// v2.0: STRUCT() Bindings for Plain-Old-Data types
|
|
130
|
+
// v4.1.1: Added CONSTRUCTOR and METHOD support (same as CLASS)
|
|
130
131
|
struct StructBinding {
|
|
131
132
|
std::string module_name;
|
|
132
133
|
std::string struct_name;
|
|
@@ -135,6 +136,11 @@ struct StructBinding {
|
|
|
135
136
|
bool is_template = false;
|
|
136
137
|
std::string documentation;
|
|
137
138
|
|
|
139
|
+
// v4.1.1: CONSTRUCTOR and METHOD support for STRUCT (same as CLASS)
|
|
140
|
+
std::vector<ConstructorInfo> constructors;
|
|
141
|
+
std::vector<MethodSignature> method_signatures;
|
|
142
|
+
std::vector<std::string> methods; // Simple method names for backward compatibility
|
|
143
|
+
|
|
138
144
|
// Helper methods
|
|
139
145
|
std::string get_full_name() const {
|
|
140
146
|
return struct_name;
|
|
@@ -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.7.1",
|
|
6
6
|
"publisher": "IncludeCPP",
|
|
7
7
|
"icon": "images/cssl.png",
|
|
8
8
|
"engines": {
|
|
@@ -151,6 +151,48 @@
|
|
|
151
151
|
"description": "Show output panel when running CSSL files"
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
},
|
|
155
|
+
"configurationDefaults": {
|
|
156
|
+
"editor.tokenColorCustomizations": {
|
|
157
|
+
"textMateRules": [
|
|
158
|
+
{
|
|
159
|
+
"scope": "storage.modifier.cssl",
|
|
160
|
+
"settings": {
|
|
161
|
+
"fontStyle": "italic"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"scope": "storage.modifier.extends.cssl",
|
|
166
|
+
"settings": {
|
|
167
|
+
"fontStyle": "italic"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"scope": "storage.modifier.overwrites.cssl",
|
|
172
|
+
"settings": {
|
|
173
|
+
"fontStyle": "italic"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"scope": "support.type.cssl",
|
|
178
|
+
"settings": {
|
|
179
|
+
"foreground": "#C586C0"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"scope": "variable.other.declaration.cssl",
|
|
184
|
+
"settings": {
|
|
185
|
+
"foreground": "#9CDCFE"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"scope": "variable.parameter.cssl",
|
|
190
|
+
"settings": {
|
|
191
|
+
"foreground": "#9CDCFE"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
154
196
|
}
|
|
155
197
|
}
|
|
156
198
|
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
{ "include": "#super-call" },
|
|
16
16
|
{ "include": "#sql-types" },
|
|
17
17
|
{ "include": "#keywords" },
|
|
18
|
+
{ "include": "#typed-declarations" },
|
|
18
19
|
{ "include": "#types" },
|
|
19
20
|
{ "include": "#function-modifiers" },
|
|
20
21
|
{ "include": "#injection-operators" },
|
|
@@ -211,17 +212,21 @@
|
|
|
211
212
|
{ "include": "#constructor-definition" },
|
|
212
213
|
{ "include": "#class-method-definition" },
|
|
213
214
|
{ "include": "#class-member-declaration" },
|
|
215
|
+
{ "include": "#typed-declarations" },
|
|
214
216
|
{ "include": "#types" },
|
|
217
|
+
{ "include": "#function-modifiers" },
|
|
215
218
|
{ "include": "#this-access" },
|
|
216
219
|
{ "include": "#captured-references" },
|
|
217
220
|
{ "include": "#global-references" },
|
|
218
221
|
{ "include": "#shared-references" },
|
|
222
|
+
{ "include": "#instance-references" },
|
|
219
223
|
{ "include": "#strings" },
|
|
220
224
|
{ "include": "#numbers" },
|
|
221
225
|
{ "include": "#keywords" },
|
|
222
226
|
{ "include": "#function-calls" },
|
|
223
227
|
{ "include": "#builtins" },
|
|
224
|
-
{ "include": "#operators" }
|
|
228
|
+
{ "include": "#operators" },
|
|
229
|
+
{ "include": "#constants" }
|
|
225
230
|
]
|
|
226
231
|
},
|
|
227
232
|
{
|
|
@@ -241,17 +246,21 @@
|
|
|
241
246
|
{ "include": "#constructor-definition" },
|
|
242
247
|
{ "include": "#class-method-definition" },
|
|
243
248
|
{ "include": "#class-member-declaration" },
|
|
249
|
+
{ "include": "#typed-declarations" },
|
|
244
250
|
{ "include": "#types" },
|
|
251
|
+
{ "include": "#function-modifiers" },
|
|
245
252
|
{ "include": "#this-access" },
|
|
246
253
|
{ "include": "#captured-references" },
|
|
247
254
|
{ "include": "#global-references" },
|
|
248
255
|
{ "include": "#shared-references" },
|
|
256
|
+
{ "include": "#instance-references" },
|
|
249
257
|
{ "include": "#strings" },
|
|
250
258
|
{ "include": "#numbers" },
|
|
251
259
|
{ "include": "#keywords" },
|
|
252
260
|
{ "include": "#function-calls" },
|
|
253
261
|
{ "include": "#builtins" },
|
|
254
|
-
{ "include": "#operators" }
|
|
262
|
+
{ "include": "#operators" },
|
|
263
|
+
{ "include": "#constants" }
|
|
255
264
|
]
|
|
256
265
|
},
|
|
257
266
|
{
|
|
@@ -267,17 +276,21 @@
|
|
|
267
276
|
{ "include": "#constructor-definition" },
|
|
268
277
|
{ "include": "#class-method-definition" },
|
|
269
278
|
{ "include": "#class-member-declaration" },
|
|
279
|
+
{ "include": "#typed-declarations" },
|
|
270
280
|
{ "include": "#types" },
|
|
281
|
+
{ "include": "#function-modifiers" },
|
|
271
282
|
{ "include": "#this-access" },
|
|
272
283
|
{ "include": "#captured-references" },
|
|
273
284
|
{ "include": "#global-references" },
|
|
274
285
|
{ "include": "#shared-references" },
|
|
286
|
+
{ "include": "#instance-references" },
|
|
275
287
|
{ "include": "#strings" },
|
|
276
288
|
{ "include": "#numbers" },
|
|
277
289
|
{ "include": "#keywords" },
|
|
278
290
|
{ "include": "#function-calls" },
|
|
279
291
|
{ "include": "#builtins" },
|
|
280
|
-
{ "include": "#operators" }
|
|
292
|
+
{ "include": "#operators" },
|
|
293
|
+
{ "include": "#constants" }
|
|
281
294
|
]
|
|
282
295
|
}
|
|
283
296
|
]
|
|
@@ -354,11 +367,42 @@
|
|
|
354
367
|
"class-member-declaration": {
|
|
355
368
|
"patterns": [
|
|
356
369
|
{
|
|
370
|
+
"comment": "Generic type member: datastruct<dynamic> Container;",
|
|
371
|
+
"name": "meta.member.generic.cssl",
|
|
372
|
+
"match": "(\\b(?:array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|tuple|set|queue))(<)([^>]+)(>)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;",
|
|
373
|
+
"captures": {
|
|
374
|
+
"1": { "name": "support.type.cssl" },
|
|
375
|
+
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
376
|
+
"3": { "name": "support.type.cssl" },
|
|
377
|
+
"4": { "name": "punctuation.definition.typeparameters.end.cssl" },
|
|
378
|
+
"5": { "name": "variable.other.declaration.cssl" }
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"comment": "Primitive type member: string ApiID;",
|
|
357
383
|
"name": "meta.member.cssl",
|
|
358
|
-
"match": "\\b(int|string|float|bool|dynamic|auto)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;",
|
|
384
|
+
"match": "\\b(int|string|float|bool|dynamic|auto|void|json|long|double)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;",
|
|
359
385
|
"captures": {
|
|
360
|
-
"1": { "name": "
|
|
361
|
-
"2": { "name": "variable.other.
|
|
386
|
+
"1": { "name": "support.type.cssl" },
|
|
387
|
+
"2": { "name": "variable.other.declaration.cssl" }
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"comment": "Container type member without generic: list items;",
|
|
392
|
+
"name": "meta.member.container.cssl",
|
|
393
|
+
"match": "\\b(array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|tuple|set|queue)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*;",
|
|
394
|
+
"captures": {
|
|
395
|
+
"1": { "name": "support.type.cssl" },
|
|
396
|
+
"2": { "name": "variable.other.declaration.cssl" }
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"comment": "Primitive type member with assignment: string ApiID = value;",
|
|
401
|
+
"name": "meta.member.assigned.cssl",
|
|
402
|
+
"match": "\\b(int|string|float|bool|dynamic|auto|void|json|long|double)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*=",
|
|
403
|
+
"captures": {
|
|
404
|
+
"1": { "name": "support.type.cssl" },
|
|
405
|
+
"2": { "name": "variable.other.declaration.cssl" }
|
|
362
406
|
}
|
|
363
407
|
}
|
|
364
408
|
]
|
|
@@ -440,10 +484,65 @@
|
|
|
440
484
|
}
|
|
441
485
|
]
|
|
442
486
|
},
|
|
487
|
+
"typed-declarations": {
|
|
488
|
+
"patterns": [
|
|
489
|
+
{
|
|
490
|
+
"comment": "Generic type declaration: datastruct<dynamic> Container; or vector<int> items;",
|
|
491
|
+
"name": "meta.declaration.typed.generic.cssl",
|
|
492
|
+
"match": "(\\b(?:array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|tuple|set|queue))(<)([^>]+)(>)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
493
|
+
"captures": {
|
|
494
|
+
"1": { "name": "support.type.cssl" },
|
|
495
|
+
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
496
|
+
"3": { "name": "support.type.cssl" },
|
|
497
|
+
"4": { "name": "punctuation.definition.typeparameters.end.cssl" },
|
|
498
|
+
"5": { "name": "variable.other.declaration.cssl" }
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"comment": "Primitive type declaration: string ID; or int count;",
|
|
503
|
+
"name": "meta.declaration.typed.primitive.cssl",
|
|
504
|
+
"match": "\\b(int|string|float|bool|void|json|dynamic|auto|long|double)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=[;=])",
|
|
505
|
+
"captures": {
|
|
506
|
+
"1": { "name": "support.type.cssl" },
|
|
507
|
+
"2": { "name": "variable.other.declaration.cssl" }
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"comment": "Container type declaration without generic: list items;",
|
|
512
|
+
"name": "meta.declaration.typed.container.cssl",
|
|
513
|
+
"match": "\\b(array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|tuple|set|queue)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=[;=])",
|
|
514
|
+
"captures": {
|
|
515
|
+
"1": { "name": "support.type.cssl" },
|
|
516
|
+
"2": { "name": "variable.other.declaration.cssl" }
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"comment": "Generic type in function parameter: func(datastruct<dynamic> param)",
|
|
521
|
+
"name": "meta.parameter.typed.generic.cssl",
|
|
522
|
+
"match": "(\\b(?:array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|tuple|set|queue))(<)([^>]+)(>)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=[,)])",
|
|
523
|
+
"captures": {
|
|
524
|
+
"1": { "name": "support.type.cssl" },
|
|
525
|
+
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
526
|
+
"3": { "name": "support.type.cssl" },
|
|
527
|
+
"4": { "name": "punctuation.definition.typeparameters.end.cssl" },
|
|
528
|
+
"5": { "name": "variable.parameter.cssl" }
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"comment": "Primitive type in function parameter: func(string name)",
|
|
533
|
+
"name": "meta.parameter.typed.primitive.cssl",
|
|
534
|
+
"match": "\\b(int|string|float|bool|void|json|dynamic|auto|long|double)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=[,)])",
|
|
535
|
+
"captures": {
|
|
536
|
+
"1": { "name": "support.type.cssl" },
|
|
537
|
+
"2": { "name": "variable.parameter.cssl" }
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
},
|
|
443
542
|
"types": {
|
|
444
543
|
"patterns": [
|
|
445
544
|
{
|
|
446
|
-
"name": "
|
|
545
|
+
"name": "support.type.cssl",
|
|
447
546
|
"match": "\\b(int|string|float|bool|void|json|dynamic|auto|long|double)\\b"
|
|
448
547
|
},
|
|
449
548
|
{
|
|
@@ -451,18 +550,18 @@
|
|
|
451
550
|
"name": "meta.generic.cssl",
|
|
452
551
|
"match": "(\\b(?:array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|tuple|set|queue))(<)([^>]+)(>)",
|
|
453
552
|
"captures": {
|
|
454
|
-
"1": { "name": "
|
|
553
|
+
"1": { "name": "support.type.cssl" },
|
|
455
554
|
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
456
|
-
"3": { "name": "
|
|
555
|
+
"3": { "name": "support.type.cssl" },
|
|
457
556
|
"4": { "name": "punctuation.definition.typeparameters.end.cssl" }
|
|
458
557
|
}
|
|
459
558
|
},
|
|
460
559
|
{
|
|
461
|
-
"name": "
|
|
560
|
+
"name": "support.type.cssl",
|
|
462
561
|
"match": "\\b(array|vector|stack|list|dictionary|dict|map|datastruct|dataspace|shuffled|iterator|combo|openquote|instance|tuple|set|queue)\\b"
|
|
463
562
|
},
|
|
464
563
|
{
|
|
465
|
-
"name": "
|
|
564
|
+
"name": "support.type.cssl",
|
|
466
565
|
"match": "\\bcombo\\s*<\\s*open\\s*&"
|
|
467
566
|
}
|
|
468
567
|
]
|
|
@@ -471,7 +570,7 @@
|
|
|
471
570
|
"patterns": [
|
|
472
571
|
{
|
|
473
572
|
"name": "storage.modifier.cssl",
|
|
474
|
-
"match": "\\b(undefined|open|closed|private|virtual|meta|super|sqlbased|protected|limited)\\b"
|
|
573
|
+
"match": "\\b(undefined|open|closed|private|virtual|meta|super|sqlbased|protected|limited|const|static|final|abstract|readonly)\\b"
|
|
475
574
|
}
|
|
476
575
|
]
|
|
477
576
|
},
|
|
@@ -619,24 +718,48 @@
|
|
|
619
718
|
"instance-references": {
|
|
620
719
|
"patterns": [
|
|
621
720
|
{
|
|
622
|
-
"comment": "instance<\"name\"> - shared instance
|
|
721
|
+
"comment": "instance<\"name\"> varName - shared instance declaration with variable",
|
|
722
|
+
"name": "meta.instance.declaration.cssl",
|
|
723
|
+
"match": "(\\binstance)(<)(\"[^\"]+\")(>)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
724
|
+
"captures": {
|
|
725
|
+
"1": { "name": "support.type.cssl" },
|
|
726
|
+
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
727
|
+
"3": { "name": "string.quoted.double.cssl" },
|
|
728
|
+
"4": { "name": "punctuation.definition.typeparameters.end.cssl" },
|
|
729
|
+
"5": { "name": "variable.other.declaration.cssl" }
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"comment": "instance<Type> varName - shared instance declaration with type and variable",
|
|
734
|
+
"name": "meta.instance.declaration.cssl",
|
|
735
|
+
"match": "(\\binstance)(<)([a-zA-Z_][a-zA-Z0-9_]*)(>)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
736
|
+
"captures": {
|
|
737
|
+
"1": { "name": "support.type.cssl" },
|
|
738
|
+
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
739
|
+
"3": { "name": "support.type.cssl" },
|
|
740
|
+
"4": { "name": "punctuation.definition.typeparameters.end.cssl" },
|
|
741
|
+
"5": { "name": "variable.other.declaration.cssl" }
|
|
742
|
+
}
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
"comment": "instance<\"name\"> - shared instance reference without variable",
|
|
623
746
|
"name": "meta.instance.cssl",
|
|
624
747
|
"match": "(\\binstance)(<)(\"[^\"]+\")(>)",
|
|
625
748
|
"captures": {
|
|
626
|
-
"1": { "name": "
|
|
749
|
+
"1": { "name": "support.type.cssl" },
|
|
627
750
|
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
628
751
|
"3": { "name": "string.quoted.double.cssl" },
|
|
629
752
|
"4": { "name": "punctuation.definition.typeparameters.end.cssl" }
|
|
630
753
|
}
|
|
631
754
|
},
|
|
632
755
|
{
|
|
633
|
-
"comment": "instance<Type> - shared instance reference
|
|
756
|
+
"comment": "instance<Type> - shared instance reference without variable",
|
|
634
757
|
"name": "meta.instance.cssl",
|
|
635
758
|
"match": "(\\binstance)(<)([a-zA-Z_][a-zA-Z0-9_]*)(>)",
|
|
636
759
|
"captures": {
|
|
637
|
-
"1": { "name": "
|
|
760
|
+
"1": { "name": "support.type.cssl" },
|
|
638
761
|
"2": { "name": "punctuation.definition.typeparameters.begin.cssl" },
|
|
639
|
-
"3": { "name": "
|
|
762
|
+
"3": { "name": "support.type.cssl" },
|
|
640
763
|
"4": { "name": "punctuation.definition.typeparameters.end.cssl" }
|
|
641
764
|
}
|
|
642
765
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: IncludeCPP
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.2
|
|
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
|
|
@@ -905,3 +906,103 @@ print(greeter.name) # "Python"
|
|
|
905
906
|
- `python::export(instance)` - Alias
|
|
906
907
|
|
|
907
908
|
All three do the same thing: wrap a CSSL class instance for Python use.
|
|
909
|
+
|
|
910
|
+
## Universal Instances (v4.0.3+)
|
|
911
|
+
|
|
912
|
+
Universal instances are shared containers accessible from CSSL, Python, and C++:
|
|
913
|
+
|
|
914
|
+
```python
|
|
915
|
+
from includecpp import CSSL
|
|
916
|
+
|
|
917
|
+
cssl = CSSL.CsslLang()
|
|
918
|
+
|
|
919
|
+
# Create in CSSL
|
|
920
|
+
cssl.run('''
|
|
921
|
+
instance<"myContainer"> container;
|
|
922
|
+
container.data = "Hello";
|
|
923
|
+
container.count = 42;
|
|
924
|
+
''')
|
|
925
|
+
|
|
926
|
+
# Access from Python
|
|
927
|
+
container = cssl.getInstance("myContainer")
|
|
928
|
+
print(container.data) # "Hello"
|
|
929
|
+
print(container.count) # 42
|
|
930
|
+
|
|
931
|
+
# Modify from Python
|
|
932
|
+
container.newValue = "Added from Python"
|
|
933
|
+
|
|
934
|
+
# Changes reflect in CSSL
|
|
935
|
+
cssl.run('''
|
|
936
|
+
instance<"myContainer"> c;
|
|
937
|
+
printl(c.newValue); // "Added from Python"
|
|
938
|
+
''')
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
### Instance Methods
|
|
942
|
+
|
|
943
|
+
```python
|
|
944
|
+
cssl.getInstance("name") # Get instance (None if not found)
|
|
945
|
+
cssl.createInstance("name") # Create or get instance
|
|
946
|
+
cssl.deleteInstance("name") # Delete instance
|
|
947
|
+
cssl.listInstances() # List all instance names
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
### Method Injection
|
|
951
|
+
|
|
952
|
+
Inject methods into instances using `+<<==`:
|
|
953
|
+
|
|
954
|
+
```cssl
|
|
955
|
+
instance<"api"> api;
|
|
956
|
+
|
|
957
|
+
// Inject a method
|
|
958
|
+
api +<<== {
|
|
959
|
+
void greet(string name) {
|
|
960
|
+
printl("Hello, " + name + "!");
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
api.greet("World"); // Hello, World!
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
## Simplified Module API (v4.0.2+)
|
|
968
|
+
|
|
969
|
+
Create CSSL modules from files with payload binding:
|
|
970
|
+
|
|
971
|
+
```python
|
|
972
|
+
from includecpp import CSSL
|
|
973
|
+
|
|
974
|
+
# Register payload from file
|
|
975
|
+
CSSL.makepayload("api", "lib/api/myapi.cssl-pl")
|
|
976
|
+
|
|
977
|
+
# Create module from file, binding to payload
|
|
978
|
+
mod = CSSL.makemodule("writer", "lib/writer.cssl", bind="api")
|
|
979
|
+
mod.SaySomething("Hello!") # Call functions directly
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
## VSCode Extension
|
|
983
|
+
|
|
984
|
+
IncludeCPP includes a VSCode extension for CSSL syntax highlighting.
|
|
985
|
+
|
|
986
|
+
### Installation
|
|
987
|
+
|
|
988
|
+
```bash
|
|
989
|
+
# Copy extension to VSCode extensions folder
|
|
990
|
+
# Windows: %USERPROFILE%\.vscode\extensions\
|
|
991
|
+
# Linux/Mac: ~/.vscode/extensions/
|
|
992
|
+
|
|
993
|
+
# Or install from included files
|
|
994
|
+
pip show includecpp # Find package location
|
|
995
|
+
# Copy vscode/cssl folder to extensions
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
### Features
|
|
999
|
+
|
|
1000
|
+
- Syntax highlighting for `.cssl`, `.cssl-pl`, `.cssl-mod` files
|
|
1001
|
+
- Snippets for common patterns
|
|
1002
|
+
- Run CSSL files with F5
|
|
1003
|
+
- Proper coloring for:
|
|
1004
|
+
- Keywords and control flow
|
|
1005
|
+
- Data types (purple/lilac)
|
|
1006
|
+
- Variable declarations (light blue)
|
|
1007
|
+
- Injection operators (`<<==`, `<==`)
|
|
1008
|
+
- Global (`@`), shared (`$`), and captured (`%`) references
|