IncludeCPP 3.7.3__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 +59 -0
- includecpp/__init__.pyi +255 -0
- includecpp/__main__.py +4 -0
- includecpp/cli/__init__.py +4 -0
- includecpp/cli/commands.py +8270 -0
- includecpp/cli/config_parser.py +127 -0
- includecpp/core/__init__.py +19 -0
- includecpp/core/ai_integration.py +2132 -0
- includecpp/core/build_manager.py +2416 -0
- includecpp/core/cpp_api.py +376 -0
- includecpp/core/cpp_api.pyi +95 -0
- includecpp/core/cppy_converter.py +3448 -0
- includecpp/core/cssl/CSSL_DOCUMENTATION.md +2075 -0
- includecpp/core/cssl/__init__.py +42 -0
- includecpp/core/cssl/cssl_builtins.py +2271 -0
- includecpp/core/cssl/cssl_builtins.pyi +1393 -0
- includecpp/core/cssl/cssl_events.py +621 -0
- includecpp/core/cssl/cssl_modules.py +2803 -0
- includecpp/core/cssl/cssl_parser.py +2575 -0
- includecpp/core/cssl/cssl_runtime.py +3051 -0
- includecpp/core/cssl/cssl_syntax.py +488 -0
- includecpp/core/cssl/cssl_types.py +1512 -0
- includecpp/core/cssl_bridge.py +882 -0
- includecpp/core/cssl_bridge.pyi +488 -0
- includecpp/core/error_catalog.py +802 -0
- includecpp/core/error_formatter.py +1016 -0
- includecpp/core/exceptions.py +97 -0
- includecpp/core/path_discovery.py +77 -0
- includecpp/core/project_ui.py +3370 -0
- includecpp/core/settings_ui.py +326 -0
- includecpp/generator/__init__.py +1 -0
- includecpp/generator/parser.cpp +1903 -0
- includecpp/generator/parser.h +281 -0
- includecpp/generator/type_resolver.cpp +363 -0
- includecpp/generator/type_resolver.h +68 -0
- includecpp/py.typed +0 -0
- includecpp/templates/cpp.proj.template +18 -0
- includecpp/vscode/__init__.py +1 -0
- includecpp/vscode/cssl/__init__.py +1 -0
- includecpp/vscode/cssl/language-configuration.json +38 -0
- includecpp/vscode/cssl/package.json +50 -0
- includecpp/vscode/cssl/snippets/cssl.snippets.json +1080 -0
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +341 -0
- includecpp-3.7.3.dist-info/METADATA +1076 -0
- includecpp-3.7.3.dist-info/RECORD +49 -0
- includecpp-3.7.3.dist-info/WHEEL +5 -0
- includecpp-3.7.3.dist-info/entry_points.txt +2 -0
- includecpp-3.7.3.dist-info/licenses/LICENSE +21 -0
- includecpp-3.7.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
"""Error catalog for IncludeCPP - 130 error patterns with direct, helpful messages.
|
|
2
|
+
|
|
3
|
+
Messages are written like a dev explaining to another dev. No corporate fluff.
|
|
4
|
+
Always printed LAST so users who only read the end still get the fix.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import re
|
|
8
|
+
from typing import Optional, Dict, Tuple
|
|
9
|
+
|
|
10
|
+
# Error catalog: pattern -> (message, category)
|
|
11
|
+
# Categories: beginner, compiler, linker, cmake, pybind11, runtime, plugin, import
|
|
12
|
+
ERROR_CATALOG = {
|
|
13
|
+
# ========== A. BEGINNER MISTAKES (1-20) ==========
|
|
14
|
+
"MODULE_NOT_BUILT": {
|
|
15
|
+
"pattern": r"Module '(\w+)'.*not found|No module named '(\w+)'",
|
|
16
|
+
"message": "Module '{name}' not built yet.\n\nFix: includecpp rebuild",
|
|
17
|
+
"category": "beginner"
|
|
18
|
+
},
|
|
19
|
+
"MODULE_OUTDATED": {
|
|
20
|
+
"pattern": r"Module '(\w+)'.*outdated|source.*changed",
|
|
21
|
+
"message": "Module '{name}' outdated. Source changed since last build.\n\nFix: includecpp rebuild",
|
|
22
|
+
"category": "beginner"
|
|
23
|
+
},
|
|
24
|
+
"NO_CPP_PROJ": {
|
|
25
|
+
"pattern": r"cpp\.proj.*not found|No cpp\.proj",
|
|
26
|
+
"message": "No cpp.proj found. Not an IncludeCPP project.\n\nFix: includecpp init",
|
|
27
|
+
"category": "beginner"
|
|
28
|
+
},
|
|
29
|
+
"NO_PLUGINS_DIR": {
|
|
30
|
+
"pattern": r"plugins.*directory.*not found|plugins/.*missing",
|
|
31
|
+
"message": "plugins/ folder missing.\n\nFix: includecpp init",
|
|
32
|
+
"category": "beginner"
|
|
33
|
+
},
|
|
34
|
+
"NO_INCLUDE_DIR": {
|
|
35
|
+
"pattern": r"include.*directory.*not found|include/.*missing",
|
|
36
|
+
"message": "include/ folder missing. Create it or check cpp.proj paths.",
|
|
37
|
+
"category": "beginner"
|
|
38
|
+
},
|
|
39
|
+
"EMPTY_CP_FILE": {
|
|
40
|
+
"pattern": r"\.cp.*is empty|empty plugin",
|
|
41
|
+
"message": "Plugin file is empty. Add SOURCE() and PUBLIC() blocks.",
|
|
42
|
+
"category": "beginner"
|
|
43
|
+
},
|
|
44
|
+
"NO_SOURCE_IN_CP": {
|
|
45
|
+
"pattern": r"no SOURCE|SOURCE\(\).*missing|Missing SOURCE",
|
|
46
|
+
"message": "No SOURCE() in .cp file.\n\nFix: Add SOURCE(file.cpp) module_name",
|
|
47
|
+
"category": "beginner"
|
|
48
|
+
},
|
|
49
|
+
"NO_PUBLIC_IN_CP": {
|
|
50
|
+
"pattern": r"no PUBLIC|PUBLIC\(\).*missing|nothing.*export",
|
|
51
|
+
"message": "No PUBLIC() block. Nothing gets exported to Python.",
|
|
52
|
+
"category": "beginner"
|
|
53
|
+
},
|
|
54
|
+
"NOT_IN_NAMESPACE": {
|
|
55
|
+
"pattern": r"namespace includecpp|using namespace includecpp",
|
|
56
|
+
"message": "Code not in 'namespace includecpp'.\n\nFix: Wrap your code:\nnamespace includecpp {\n // your code here\n}",
|
|
57
|
+
"category": "beginner"
|
|
58
|
+
},
|
|
59
|
+
"WRONG_INCLUDE_PATH": {
|
|
60
|
+
"pattern": r"No such file.*['\"]([^'\"]+)['\"]|cannot find.*['\"]([^'\"]+)['\"]",
|
|
61
|
+
"message": "Can't find '{file}'. Check path in SOURCE() matches actual file location.",
|
|
62
|
+
"category": "beginner"
|
|
63
|
+
},
|
|
64
|
+
"FORGOT_HEADER": {
|
|
65
|
+
"pattern": r"'(\w+)'.*was not declared|unknown type.*'(\w+)'|error:.*'(\w+)'.*undeclared",
|
|
66
|
+
"message": "'{name}' not declared. Include header or check if it's a private/nested type.",
|
|
67
|
+
"category": "beginner"
|
|
68
|
+
},
|
|
69
|
+
"PYTHON_SHADOWS_MODULE": {
|
|
70
|
+
"pattern": r"shadows|already.*defined.*\.py",
|
|
71
|
+
"message": "Python file shadows C++ module. Rename your .py script.",
|
|
72
|
+
"category": "beginner"
|
|
73
|
+
},
|
|
74
|
+
"OLD_PYD_LOADED": {
|
|
75
|
+
"pattern": r"old.*location|cached.*module|already loaded",
|
|
76
|
+
"message": "Module loaded from old location. Restart Python.",
|
|
77
|
+
"category": "beginner"
|
|
78
|
+
},
|
|
79
|
+
"EDITING_WRONG_FILE": {
|
|
80
|
+
"pattern": r"source.*mismatch|wrong.*file",
|
|
81
|
+
"message": "SOURCE() points to different file. Check your .cp configuration.",
|
|
82
|
+
"category": "beginner"
|
|
83
|
+
},
|
|
84
|
+
"NO_COMPILER": {
|
|
85
|
+
"pattern": r"No C\+\+ compiler|compiler.*not found|g\+\+.*not found|cl\.exe.*not found",
|
|
86
|
+
"message": "No C++ compiler found.\n\nFix: Install g++ (MinGW/MSYS2) or Visual Studio",
|
|
87
|
+
"category": "beginner"
|
|
88
|
+
},
|
|
89
|
+
"WRONG_PYTHON_VERSION": {
|
|
90
|
+
"pattern": r"Python.*version.*mismatch|built.*Python\s*(\d+\.\d+).*running.*(\d+\.\d+)",
|
|
91
|
+
"message": "Built with different Python version.\n\nFix: includecpp rebuild",
|
|
92
|
+
"category": "beginner"
|
|
93
|
+
},
|
|
94
|
+
"MISSING_PYBIND11": {
|
|
95
|
+
"pattern": r"pybind11.*not found|No module.*pybind11",
|
|
96
|
+
"message": "pybind11 not found.\n\nFix: pip install pybind11",
|
|
97
|
+
"category": "beginner"
|
|
98
|
+
},
|
|
99
|
+
"CIRCULAR_IMPORT": {
|
|
100
|
+
"pattern": r"circular.*import|circular.*dependency|import cycle",
|
|
101
|
+
"message": "Circular import detected.\n\nFix: Use DEPENDS() in one .cp file, not both",
|
|
102
|
+
"category": "beginner"
|
|
103
|
+
},
|
|
104
|
+
"CLASS_NOT_IN_PUBLIC": {
|
|
105
|
+
"pattern": r"class '(\w+)'.*not.*PUBLIC|'(\w+)'.*not exported",
|
|
106
|
+
"message": "Class '{name}' exists but not in PUBLIC() block.\n\nFix: Add CLASS({name}) to PUBLIC()",
|
|
107
|
+
"category": "beginner"
|
|
108
|
+
},
|
|
109
|
+
"METHOD_NOT_IN_CLASS": {
|
|
110
|
+
"pattern": r"method '(\w+)'.*not.*listed|'(\w+)'.*not.*CLASS",
|
|
111
|
+
"message": "Method not listed in CLASS block.\n\nFix: Add METHOD({name}) inside CLASS(){{ }}",
|
|
112
|
+
"category": "beginner"
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
# ========== B. COMPILER ERRORS (21-45) ==========
|
|
116
|
+
"UNDEFINED_REFERENCE": {
|
|
117
|
+
"pattern": r"undefined reference to ['\"`]([^'\"`]+)['\"`]",
|
|
118
|
+
"message": "'{symbol}' declared but not defined.\n\nFix: Add implementation or check spelling",
|
|
119
|
+
"category": "compiler"
|
|
120
|
+
},
|
|
121
|
+
"NO_MATCHING_FUNCTION": {
|
|
122
|
+
"pattern": r"no matching function.*call to ['\"`]([^'\"`]+)['\"`]",
|
|
123
|
+
"message": "No matching function for '{func}'.\n\nFix: Check parameter types match declaration",
|
|
124
|
+
"category": "compiler"
|
|
125
|
+
},
|
|
126
|
+
"EXPECTED_SEMICOLON": {
|
|
127
|
+
"pattern": r"expected ['\"`];['\"`]|expected.*semicolon",
|
|
128
|
+
"message": "Missing semicolon.\n\nFix: Add ';' at indicated line",
|
|
129
|
+
"category": "compiler"
|
|
130
|
+
},
|
|
131
|
+
"EXPECTED_BRACE": {
|
|
132
|
+
"pattern": r"expected ['\"`][{}]['\"`]|unmatched.*brace",
|
|
133
|
+
"message": "Unmatched brace.\n\nFix: Check your { } pairs match",
|
|
134
|
+
"category": "compiler"
|
|
135
|
+
},
|
|
136
|
+
"UNDECLARED_IDENTIFIER": {
|
|
137
|
+
"pattern": r"['\"`](\w+)['\"`].*undeclared|undeclared identifier ['\"`](\w+)['\"`]",
|
|
138
|
+
"message": "'{id}' not declared.\n\nFix: Include header or check spelling",
|
|
139
|
+
"category": "compiler"
|
|
140
|
+
},
|
|
141
|
+
"NOT_A_MEMBER": {
|
|
142
|
+
"pattern": r"['\"`](\w+)['\"`] is not a member of ['\"`]([^'\"`]+)['\"`]",
|
|
143
|
+
"message": "'{member}' is not in class '{cls}'.\n\nFix: Check method name or add it to class",
|
|
144
|
+
"category": "compiler"
|
|
145
|
+
},
|
|
146
|
+
"INCOMPLETE_TYPE": {
|
|
147
|
+
"pattern": r"incomplete type ['\"`]([^'\"`]+)['\"`]",
|
|
148
|
+
"message": "Incomplete type '{type}'.\n\nFix: Include full definition or forward declare",
|
|
149
|
+
"category": "compiler"
|
|
150
|
+
},
|
|
151
|
+
"CANNOT_CONVERT": {
|
|
152
|
+
"pattern": r"cannot convert ['\"`]([^'\"`]+)['\"`].*to ['\"`]([^'\"`]+)['\"`]",
|
|
153
|
+
"message": "Can't convert '{from}' to '{to}'.\n\nFix: Use explicit cast or fix types",
|
|
154
|
+
"category": "compiler"
|
|
155
|
+
},
|
|
156
|
+
"AMBIGUOUS_CALL": {
|
|
157
|
+
"pattern": r"ambiguous.*call|call.*ambiguous",
|
|
158
|
+
"message": "Ambiguous function call. Multiple overloads match.\n\nFix: Be more specific with argument types",
|
|
159
|
+
"category": "compiler"
|
|
160
|
+
},
|
|
161
|
+
"PRIVATE_MEMBER": {
|
|
162
|
+
"pattern": r"['\"`](\w+)['\"`].*private.*['\"`]([^'\"`]+)['\"`]|private member",
|
|
163
|
+
"message": "'{member}' is private.\n\nFix: Make it public or add getter method",
|
|
164
|
+
"category": "compiler"
|
|
165
|
+
},
|
|
166
|
+
"PURE_VIRTUAL_COMPILE": {
|
|
167
|
+
"pattern": r"cannot.*instantiate.*pure virtual|pure virtual.*function",
|
|
168
|
+
"message": "Can't instantiate class with pure virtual methods.\n\nFix: Implement all virtual methods",
|
|
169
|
+
"category": "compiler"
|
|
170
|
+
},
|
|
171
|
+
"DELETED_FUNCTION": {
|
|
172
|
+
"pattern": r"use of deleted function|deleted.*constructor",
|
|
173
|
+
"message": "Using deleted function (copy/move).\n\nFix: Use pointers or implement copy/move",
|
|
174
|
+
"category": "compiler"
|
|
175
|
+
},
|
|
176
|
+
"NARROWING_CONVERSION": {
|
|
177
|
+
"pattern": r"narrowing conversion",
|
|
178
|
+
"message": "Narrowing conversion (losing precision).\n\nFix: Use explicit cast like static_cast<int>()",
|
|
179
|
+
"category": "compiler"
|
|
180
|
+
},
|
|
181
|
+
"TEMPLATE_ARGUMENT": {
|
|
182
|
+
"pattern": r"template argument|invalid.*template",
|
|
183
|
+
"message": "Template type mismatch.\n\nFix: Check template parameters match expected types",
|
|
184
|
+
"category": "compiler"
|
|
185
|
+
},
|
|
186
|
+
"DISCARDS_QUALIFIERS": {
|
|
187
|
+
"pattern": r"discards qualifiers|const.*correctness",
|
|
188
|
+
"message": "Const correctness issue.\n\nFix: Add 'const' or use non-const object",
|
|
189
|
+
"category": "compiler"
|
|
190
|
+
},
|
|
191
|
+
"NO_RETURN": {
|
|
192
|
+
"pattern": r"no return statement|control reaches end",
|
|
193
|
+
"message": "Function missing return statement.\n\nFix: Add return at end of function",
|
|
194
|
+
"category": "compiler"
|
|
195
|
+
},
|
|
196
|
+
"UNREACHABLE_CODE": {
|
|
197
|
+
"pattern": r"unreachable code|code.*never.*executed",
|
|
198
|
+
"message": "Code after return never runs.\n\nFix: Remove dead code",
|
|
199
|
+
"category": "compiler"
|
|
200
|
+
},
|
|
201
|
+
"UNINITIALIZED": {
|
|
202
|
+
"pattern": r"uninitialized|used.*before.*init",
|
|
203
|
+
"message": "Variable used before initialization.\n\nFix: Initialize variable before use",
|
|
204
|
+
"category": "compiler"
|
|
205
|
+
},
|
|
206
|
+
"ARRAY_BOUNDS": {
|
|
207
|
+
"pattern": r"array subscript|out of bounds|index.*range",
|
|
208
|
+
"message": "Array index possibly out of bounds.\n\nFix: Check array indices",
|
|
209
|
+
"category": "compiler"
|
|
210
|
+
},
|
|
211
|
+
"SIGNED_UNSIGNED": {
|
|
212
|
+
"pattern": r"signed.*unsigned|comparison.*signed",
|
|
213
|
+
"message": "Comparing signed and unsigned.\n\nFix: Cast one to match the other",
|
|
214
|
+
"category": "compiler"
|
|
215
|
+
},
|
|
216
|
+
"REDEFINITION": {
|
|
217
|
+
"pattern": r"redefinition of ['\"`]([^'\"`]+)['\"`]",
|
|
218
|
+
"message": "'{name}' defined twice.\n\nFix: Remove duplicate or use different names",
|
|
219
|
+
"category": "compiler"
|
|
220
|
+
},
|
|
221
|
+
"MULTIPLE_DEFINITION": {
|
|
222
|
+
"pattern": r"multiple definition of ['\"`]([^'\"`]+)['\"`]",
|
|
223
|
+
"message": "'{name}' defined in multiple files.\n\nFix: Move to header or make 'static'",
|
|
224
|
+
"category": "compiler"
|
|
225
|
+
},
|
|
226
|
+
"CONFLICTING_TYPES": {
|
|
227
|
+
"pattern": r"conflicting.*types|conflicting.*declaration",
|
|
228
|
+
"message": "Conflicting declarations.\n\nFix: Make declarations match",
|
|
229
|
+
"category": "compiler"
|
|
230
|
+
},
|
|
231
|
+
"UNKNOWN_TYPE": {
|
|
232
|
+
"pattern": r"unknown type name ['\"`](\w+)['\"`]",
|
|
233
|
+
"message": "Unknown type '{type}'.\n\nFix: Include its header",
|
|
234
|
+
"category": "compiler"
|
|
235
|
+
},
|
|
236
|
+
"STATIC_ASSERT": {
|
|
237
|
+
"pattern": r"static_assert|static assertion",
|
|
238
|
+
"message": "Compile-time assertion failed.\n\nFix: Read the assertion message for details",
|
|
239
|
+
"category": "compiler"
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
# ========== C. LINKER ERRORS (46-60) ==========
|
|
243
|
+
"UNDEFINED_SYMBOL": {
|
|
244
|
+
"pattern": r"undefined symbol ['\"`]([^'\"`]+)['\"`]",
|
|
245
|
+
"message": "Linker can't find '{symbol}'.\n\nFix: Implementation missing or file not compiled",
|
|
246
|
+
"category": "linker"
|
|
247
|
+
},
|
|
248
|
+
"UNRESOLVED_EXTERNAL": {
|
|
249
|
+
"pattern": r"unresolved external symbol ['\"`]([^'\"`]+)['\"`]",
|
|
250
|
+
"message": "MSVC: Unresolved symbol '{symbol}'.\n\nFix: Check lib paths and add missing library",
|
|
251
|
+
"category": "linker"
|
|
252
|
+
},
|
|
253
|
+
"CANNOT_FIND_LIB": {
|
|
254
|
+
"pattern": r"cannot find -l(\w+)",
|
|
255
|
+
"message": "Library '{lib}' not found.\n\nFix: Install it or fix -L path",
|
|
256
|
+
"category": "linker"
|
|
257
|
+
},
|
|
258
|
+
"MULTIPLE_SYMBOLS": {
|
|
259
|
+
"pattern": r"multiple.*symbols|symbol.*multiply defined",
|
|
260
|
+
"message": "Symbol defined in multiple files.\n\nFix: Make one 'static' or rename",
|
|
261
|
+
"category": "linker"
|
|
262
|
+
},
|
|
263
|
+
"UNDEFINED_VTABLE": {
|
|
264
|
+
"pattern": r"undefined.*vtable|vtable.*undefined",
|
|
265
|
+
"message": "Virtual function not implemented.\n\nFix: Add missing virtual method bodies",
|
|
266
|
+
"category": "linker"
|
|
267
|
+
},
|
|
268
|
+
"UNDEFINED_TYPEINFO": {
|
|
269
|
+
"pattern": r"undefined.*typeinfo|typeinfo.*undefined",
|
|
270
|
+
"message": "RTTI issue with virtual class.\n\nFix: Check virtual destructors, compile with -frtti",
|
|
271
|
+
"category": "linker"
|
|
272
|
+
},
|
|
273
|
+
"UNDEFINED_MAIN": {
|
|
274
|
+
"pattern": r"undefined.*main|main.*undefined",
|
|
275
|
+
"message": "This is a module, not a program.\n\nFix: Build as shared library, not executable",
|
|
276
|
+
"category": "linker"
|
|
277
|
+
},
|
|
278
|
+
"MISSING_LIBSTDCPP": {
|
|
279
|
+
"pattern": r"libstdc\+\+|cannot find.*stdc\+\+",
|
|
280
|
+
"message": "C++ runtime missing.\n\nFix: Install gcc-libs/libstdc++ package",
|
|
281
|
+
"category": "linker"
|
|
282
|
+
},
|
|
283
|
+
"MISSING_LIBPYTHON": {
|
|
284
|
+
"pattern": r"libpython|cannot find.*python",
|
|
285
|
+
"message": "Python dev libs missing.\n\nFix: Install python3-dev/python3-devel",
|
|
286
|
+
"category": "linker"
|
|
287
|
+
},
|
|
288
|
+
"ABI_MISMATCH": {
|
|
289
|
+
"pattern": r"ABI.*mismatch|incompatible.*ABI",
|
|
290
|
+
"message": "Compiled with different compiler version.\n\nFix: Rebuild everything with same compiler",
|
|
291
|
+
"category": "linker"
|
|
292
|
+
},
|
|
293
|
+
"SYMBOL_VERSION": {
|
|
294
|
+
"pattern": r"symbol.*version|version.*mismatch",
|
|
295
|
+
"message": "Library version mismatch.\n\nFix: Update or downgrade the library",
|
|
296
|
+
"category": "linker"
|
|
297
|
+
},
|
|
298
|
+
"RELOCATION": {
|
|
299
|
+
"pattern": r"relocation.*truncated|relocation.*error",
|
|
300
|
+
"message": "Position-independent code issue.\n\nFix: Add -fPIC flag to compilation",
|
|
301
|
+
"category": "linker"
|
|
302
|
+
},
|
|
303
|
+
"ENTRY_POINT": {
|
|
304
|
+
"pattern": r"entry point|cannot find entry",
|
|
305
|
+
"message": "Wrong entry point for shared library.\n\nFix: Don't link as executable",
|
|
306
|
+
"category": "linker"
|
|
307
|
+
},
|
|
308
|
+
"IMPORT_LIB_MISSING": {
|
|
309
|
+
"pattern": r"\.lib.*not found|cannot open.*\.lib",
|
|
310
|
+
"message": "MSVC: Import library missing.\n\nFix: Check library path or install library",
|
|
311
|
+
"category": "linker"
|
|
312
|
+
},
|
|
313
|
+
"DLL_NOT_FOUND": {
|
|
314
|
+
"pattern": r"DLL.*not found|cannot find.*\.dll",
|
|
315
|
+
"message": "Required DLL missing at runtime.\n\nFix: Add DLL location to PATH",
|
|
316
|
+
"category": "linker"
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
# ========== D. CMAKE ERRORS (61-75) ==========
|
|
320
|
+
"CMAKE_NOT_FOUND": {
|
|
321
|
+
"pattern": r"cmake.*not found|'cmake'.*not recognized",
|
|
322
|
+
"message": "CMake not installed.\n\nFix: Install CMake 3.15+",
|
|
323
|
+
"category": "cmake"
|
|
324
|
+
},
|
|
325
|
+
"CMAKE_GENERATOR_FAILED": {
|
|
326
|
+
"pattern": r"Generator.*failed|could not find.*generator",
|
|
327
|
+
"message": "CMake generator not available.\n\nFix: Install or try different generator",
|
|
328
|
+
"category": "cmake"
|
|
329
|
+
},
|
|
330
|
+
"CMAKE_NO_COMPILER": {
|
|
331
|
+
"pattern": r"No CMAKE_CXX_COMPILER|CMAKE_CXX_COMPILER.*NOTFOUND",
|
|
332
|
+
"message": "CMake can't find C++ compiler.\n\nFix: Install g++ or set CC/CXX env vars",
|
|
333
|
+
"category": "cmake"
|
|
334
|
+
},
|
|
335
|
+
"CMAKE_PYBIND11": {
|
|
336
|
+
"pattern": r"pybind11.*not found|Could not find.*pybind11",
|
|
337
|
+
"message": "CMake can't find pybind11.\n\nFix: pip install pybind11",
|
|
338
|
+
"category": "cmake"
|
|
339
|
+
},
|
|
340
|
+
"CMAKE_PYTHON": {
|
|
341
|
+
"pattern": r"Python.*not found|Could not find.*Python",
|
|
342
|
+
"message": "CMake can't find Python.\n\nFix: Set Python3_ROOT_DIR or add Python to PATH",
|
|
343
|
+
"category": "cmake"
|
|
344
|
+
},
|
|
345
|
+
"CMAKE_VERSION": {
|
|
346
|
+
"pattern": r"CMake.*version.*required|version.*too old",
|
|
347
|
+
"message": "CMake version too old.\n\nFix: Update CMake",
|
|
348
|
+
"category": "cmake"
|
|
349
|
+
},
|
|
350
|
+
"CMAKE_CONFIG_FAILED": {
|
|
351
|
+
"pattern": r"Configuring incomplete|configuration.*failed",
|
|
352
|
+
"message": "CMake configure failed.\n\nFix: Check CMakeError.log for details",
|
|
353
|
+
"category": "cmake"
|
|
354
|
+
},
|
|
355
|
+
"CMAKE_BUILD_FAILED": {
|
|
356
|
+
"pattern": r"Build.*failed|cmake --build.*failed",
|
|
357
|
+
"message": "CMake build failed.\n\nFix: See compiler error above",
|
|
358
|
+
"category": "cmake"
|
|
359
|
+
},
|
|
360
|
+
"NINJA_NOT_FOUND": {
|
|
361
|
+
"pattern": r"Ninja.*not found|'ninja'.*not recognized",
|
|
362
|
+
"message": "Ninja not installed.\n\nFix: Install Ninja or use different generator",
|
|
363
|
+
"category": "cmake"
|
|
364
|
+
},
|
|
365
|
+
"MAKE_NOT_FOUND": {
|
|
366
|
+
"pattern": r"make.*not found|'make'.*not recognized",
|
|
367
|
+
"message": "Make not found.\n\nFix: Install build-essential (Linux) or MinGW (Windows)",
|
|
368
|
+
"category": "cmake"
|
|
369
|
+
},
|
|
370
|
+
"VS_NOT_FOUND": {
|
|
371
|
+
"pattern": r"Visual Studio.*not found|could not find.*Visual Studio",
|
|
372
|
+
"message": "Visual Studio not installed.\n\nFix: Install VS Build Tools or use MinGW",
|
|
373
|
+
"category": "cmake"
|
|
374
|
+
},
|
|
375
|
+
"ARCHITECTURE_MISMATCH": {
|
|
376
|
+
"pattern": r"architecture.*mismatch|32.*64|x86.*x64",
|
|
377
|
+
"message": "32/64 bit mismatch.\n\nFix: Use matching compiler architecture",
|
|
378
|
+
"category": "cmake"
|
|
379
|
+
},
|
|
380
|
+
"CMAKE_POLICY": {
|
|
381
|
+
"pattern": r"CMP\d{4}|cmake.*policy",
|
|
382
|
+
"message": "CMake policy warning.\n\nFix: Usually safe to ignore",
|
|
383
|
+
"category": "cmake"
|
|
384
|
+
},
|
|
385
|
+
"TARGET_EXISTS": {
|
|
386
|
+
"pattern": r"target.*already exists|duplicate.*target",
|
|
387
|
+
"message": "Duplicate CMake target name.\n\nFix: Rename one of the modules",
|
|
388
|
+
"category": "cmake"
|
|
389
|
+
},
|
|
390
|
+
"CMAKE_FILE_NOT_FOUND": {
|
|
391
|
+
"pattern": r"include.*could not find|CMake.*file.*not found",
|
|
392
|
+
"message": "CMake can't find required file.\n\nFix: Check paths in CMakeLists.txt",
|
|
393
|
+
"category": "cmake"
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
# ========== E. PYBIND11 ERRORS (76-90) ==========
|
|
397
|
+
"NOT_COPYABLE": {
|
|
398
|
+
"pattern": r"is not copyable|cannot be copied",
|
|
399
|
+
"message": "Class can't be copied for Python.\n\nFix: Use py::return_value_policy::reference",
|
|
400
|
+
"category": "pybind11"
|
|
401
|
+
},
|
|
402
|
+
"HOLDER_TYPE": {
|
|
403
|
+
"pattern": r"holder type|incompatible.*holder",
|
|
404
|
+
"message": "Wrong smart pointer type.\n\nFix: Use std::shared_ptr consistently",
|
|
405
|
+
"category": "pybind11"
|
|
406
|
+
},
|
|
407
|
+
"ALREADY_REGISTERED": {
|
|
408
|
+
"pattern": r"already registered|type.*registered.*twice",
|
|
409
|
+
"message": "Type registered twice.\n\nFix: Check DEPENDS() or module structure",
|
|
410
|
+
"category": "pybind11"
|
|
411
|
+
},
|
|
412
|
+
"NO_CONSTRUCTOR": {
|
|
413
|
+
"pattern": r"no.*constructor.*match|constructor.*not found",
|
|
414
|
+
"message": "No matching constructor for binding.\n\nFix: Add CONSTRUCTOR() to .cp file",
|
|
415
|
+
"category": "pybind11"
|
|
416
|
+
},
|
|
417
|
+
"TYPE_NOT_REGISTERED": {
|
|
418
|
+
"pattern": r"type.*not.*registered|unknown.*type",
|
|
419
|
+
"message": "Type not bound to Python.\n\nFix: Add it to PUBLIC() block",
|
|
420
|
+
"category": "pybind11"
|
|
421
|
+
},
|
|
422
|
+
"RETURN_POLICY": {
|
|
423
|
+
"pattern": r"return_value_policy|lifetime.*unclear",
|
|
424
|
+
"message": "Can't determine object lifetime.\n\nFix: Specify return_value_policy explicitly",
|
|
425
|
+
"category": "pybind11"
|
|
426
|
+
},
|
|
427
|
+
"BUFFER_PROTOCOL": {
|
|
428
|
+
"pattern": r"buffer.*protocol|buffer.*interface",
|
|
429
|
+
"message": "Type doesn't support buffer protocol.\n\nFix: Implement buffer interface or use vector",
|
|
430
|
+
"category": "pybind11"
|
|
431
|
+
},
|
|
432
|
+
"OPAQUE_TYPE": {
|
|
433
|
+
"pattern": r"opaque.*type|PYBIND11_MAKE_OPAQUE",
|
|
434
|
+
"message": "Type needs PYBIND11_MAKE_OPAQUE.\n\nFix: Add macro before module definition",
|
|
435
|
+
"category": "pybind11"
|
|
436
|
+
},
|
|
437
|
+
"GIL_ISSUE": {
|
|
438
|
+
"pattern": r"GIL|Global Interpreter Lock",
|
|
439
|
+
"message": "Python GIL issue.\n\nFix: Use py::gil_scoped_release for long operations",
|
|
440
|
+
"category": "pybind11"
|
|
441
|
+
},
|
|
442
|
+
"OVERLOAD_CAST_AMBIG": {
|
|
443
|
+
"pattern": r"overload_cast.*ambiguous|ambiguous.*overload",
|
|
444
|
+
"message": "Ambiguous method overload.\n\nFix: Use METHOD(name, type1, type2) in .cp",
|
|
445
|
+
"category": "pybind11"
|
|
446
|
+
},
|
|
447
|
+
"TRAMPOLINE_NEEDED": {
|
|
448
|
+
"pattern": r"trampoline|virtual.*class.*binding",
|
|
449
|
+
"message": "Virtual class needs trampoline.\n\nFix: Complex - see pybind11 docs for virtual classes",
|
|
450
|
+
"category": "pybind11"
|
|
451
|
+
},
|
|
452
|
+
"KEEP_ALIVE": {
|
|
453
|
+
"pattern": r"prevent.*finalizer|prevent finalizer|reference.*invalid",
|
|
454
|
+
"message": "Object destroyed while Python holds reference.\n\nFix: Use py::keep_alive policy",
|
|
455
|
+
"category": "pybind11"
|
|
456
|
+
},
|
|
457
|
+
"TYPE_CASTER": {
|
|
458
|
+
"pattern": r"type_caster|no.*conversion",
|
|
459
|
+
"message": "No type conversion available.\n\nFix: Register custom type_caster or use different type",
|
|
460
|
+
"category": "pybind11"
|
|
461
|
+
},
|
|
462
|
+
"MODULE_NAME_MISMATCH": {
|
|
463
|
+
"pattern": r"module.*name.*mismatch|PYBIND11_MODULE.*mismatch",
|
|
464
|
+
"message": "Module name mismatch.\n\nFix: Check module name in .cp matches binding",
|
|
465
|
+
"category": "pybind11"
|
|
466
|
+
},
|
|
467
|
+
"INIT_ORDER": {
|
|
468
|
+
"pattern": r"init.*order|initialization.*order",
|
|
469
|
+
"message": "Modules initialized in wrong order.\n\nFix: Check DEPENDS() declarations",
|
|
470
|
+
"category": "pybind11"
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
# ========== F. RUNTIME ERRORS (91-105) ==========
|
|
474
|
+
"SEGFAULT": {
|
|
475
|
+
"pattern": r"Segmentation fault|SIGSEGV|segfault",
|
|
476
|
+
"message": "Code crashed (segfault).\n\nFix: Check null pointers and array bounds",
|
|
477
|
+
"category": "runtime"
|
|
478
|
+
},
|
|
479
|
+
"STACK_OVERFLOW": {
|
|
480
|
+
"pattern": r"stack overflow|stack.*exhausted",
|
|
481
|
+
"message": "Stack overflow.\n\nFix: Check recursion depth or reduce stack allocation",
|
|
482
|
+
"category": "runtime"
|
|
483
|
+
},
|
|
484
|
+
"BAD_ALLOC": {
|
|
485
|
+
"pattern": r"bad_alloc|std::bad_alloc|out of memory",
|
|
486
|
+
"message": "Out of memory.\n\nFix: Reduce data size or check for memory leaks",
|
|
487
|
+
"category": "runtime"
|
|
488
|
+
},
|
|
489
|
+
"PURE_VIRTUAL_CALL": {
|
|
490
|
+
"pattern": r"pure virtual.*call|call.*pure virtual",
|
|
491
|
+
"message": "Called pure virtual function.\n\nFix: Object was partially constructed or already destroyed",
|
|
492
|
+
"category": "runtime"
|
|
493
|
+
},
|
|
494
|
+
"INVALID_POINTER": {
|
|
495
|
+
"pattern": r"invalid pointer|dangling.*pointer",
|
|
496
|
+
"message": "Dangling pointer access.\n\nFix: Object was already deleted",
|
|
497
|
+
"category": "runtime"
|
|
498
|
+
},
|
|
499
|
+
"DOUBLE_FREE": {
|
|
500
|
+
"pattern": r"double free|free.*twice",
|
|
501
|
+
"message": "Memory freed twice.\n\nFix: Check ownership - use smart pointers",
|
|
502
|
+
"category": "runtime"
|
|
503
|
+
},
|
|
504
|
+
"HEAP_CORRUPT": {
|
|
505
|
+
"pattern": r"heap.*corrupt|memory.*corrupt",
|
|
506
|
+
"message": "Heap corruption.\n\nFix: Check array bounds and pointer arithmetic",
|
|
507
|
+
"category": "runtime"
|
|
508
|
+
},
|
|
509
|
+
"ACCESS_VIOLATION": {
|
|
510
|
+
"pattern": r"Access violation|0xC0000005",
|
|
511
|
+
"message": "Windows: Invalid memory access.\n\nFix: Same as segfault - check pointers",
|
|
512
|
+
"category": "runtime"
|
|
513
|
+
},
|
|
514
|
+
"DIVISION_ZERO": {
|
|
515
|
+
"pattern": r"division by zero|divide.*zero",
|
|
516
|
+
"message": "Division by zero.\n\nFix: Check divisor before dividing",
|
|
517
|
+
"category": "runtime"
|
|
518
|
+
},
|
|
519
|
+
"OUT_OF_RANGE": {
|
|
520
|
+
"pattern": r"out_of_range|std::out_of_range|index.*out.*range",
|
|
521
|
+
"message": "Index out of bounds.\n\nFix: Check vector/array indices",
|
|
522
|
+
"category": "runtime"
|
|
523
|
+
},
|
|
524
|
+
"BAD_CAST": {
|
|
525
|
+
"pattern": r"bad_cast|std::bad_cast|dynamic_cast.*failed",
|
|
526
|
+
"message": "Dynamic cast failed.\n\nFix: Object is not the expected type",
|
|
527
|
+
"category": "runtime"
|
|
528
|
+
},
|
|
529
|
+
"LOGIC_ERROR": {
|
|
530
|
+
"pattern": r"logic_error|std::logic_error",
|
|
531
|
+
"message": "Logic error - precondition violated.\n\nFix: Check your assumptions",
|
|
532
|
+
"category": "runtime"
|
|
533
|
+
},
|
|
534
|
+
"RUNTIME_ERROR": {
|
|
535
|
+
"pattern": r"runtime_error|std::runtime_error",
|
|
536
|
+
"message": "Runtime error.\n\nFix: Read the error message for details",
|
|
537
|
+
"category": "runtime"
|
|
538
|
+
},
|
|
539
|
+
"BAD_FUNCTION": {
|
|
540
|
+
"pattern": r"bad_function_call|std::bad_function_call",
|
|
541
|
+
"message": "Called empty std::function.\n\nFix: Check function is set before calling",
|
|
542
|
+
"category": "runtime"
|
|
543
|
+
},
|
|
544
|
+
"SYSTEM_ERROR": {
|
|
545
|
+
"pattern": r"system_error|std::system_error",
|
|
546
|
+
"message": "OS-level error.\n\nFix: Check errno (Linux) or GetLastError (Windows)",
|
|
547
|
+
"category": "runtime"
|
|
548
|
+
},
|
|
549
|
+
|
|
550
|
+
# ========== G. PLUGIN PARSING ERRORS (106-120) ==========
|
|
551
|
+
"CP_MISSING_PAREN": {
|
|
552
|
+
"pattern": r"\.cp.*missing.*\(|expected.*\(",
|
|
553
|
+
"message": "Missing parenthesis in .cp file.\n\nFix: Check FUNC(), CLASS() syntax",
|
|
554
|
+
"category": "plugin"
|
|
555
|
+
},
|
|
556
|
+
"CP_UNCLOSED_BRACE": {
|
|
557
|
+
"pattern": r"\.cp.*unclosed.*\{|expected.*\}",
|
|
558
|
+
"message": "Unclosed brace in .cp file.\n\nFix: Check CLASS(){} blocks",
|
|
559
|
+
"category": "plugin"
|
|
560
|
+
},
|
|
561
|
+
"CP_INVALID_KEYWORD": {
|
|
562
|
+
"pattern": r"unknown.*keyword|invalid.*keyword",
|
|
563
|
+
"message": "Unknown keyword in .cp.\n\nFix: Valid keywords: SOURCE, HEADER, PUBLIC, DEPENDS, CLASS, FUNC, METHOD",
|
|
564
|
+
"category": "plugin"
|
|
565
|
+
},
|
|
566
|
+
"CP_EMPTY_FUNC": {
|
|
567
|
+
"pattern": r"FUNC\(\s*\)|empty.*FUNC",
|
|
568
|
+
"message": "Empty FUNC().\n\nFix: Add function name: FUNC(my_function)",
|
|
569
|
+
"category": "plugin"
|
|
570
|
+
},
|
|
571
|
+
"CP_EMPTY_CLASS": {
|
|
572
|
+
"pattern": r"CLASS\(\s*\)|empty.*CLASS",
|
|
573
|
+
"message": "Empty CLASS().\n\nFix: Add class name: CLASS(MyClass)",
|
|
574
|
+
"category": "plugin"
|
|
575
|
+
},
|
|
576
|
+
"CP_INVALID_CHARS": {
|
|
577
|
+
"pattern": r"invalid.*character|illegal.*character",
|
|
578
|
+
"message": "Invalid character in .cp file.\n\nFix: Use ASCII only",
|
|
579
|
+
"category": "plugin"
|
|
580
|
+
},
|
|
581
|
+
"CP_DUPLICATE": {
|
|
582
|
+
"pattern": r"duplicate.*name|name.*already.*used",
|
|
583
|
+
"message": "Duplicate name in .cp.\n\nFix: Use unique names",
|
|
584
|
+
"category": "plugin"
|
|
585
|
+
},
|
|
586
|
+
"CP_RESERVED": {
|
|
587
|
+
"pattern": r"reserved.*word|reserved.*keyword",
|
|
588
|
+
"message": "Using reserved word.\n\nFix: Choose different name",
|
|
589
|
+
"category": "plugin"
|
|
590
|
+
},
|
|
591
|
+
"CP_BAD_SOURCE_PATH": {
|
|
592
|
+
"pattern": r"SOURCE.*invalid.*path|bad.*path.*SOURCE",
|
|
593
|
+
"message": "Invalid SOURCE() path.\n\nFix: Use forward slashes: SOURCE(include/file.cpp)",
|
|
594
|
+
"category": "plugin"
|
|
595
|
+
},
|
|
596
|
+
"CP_MISSING_MODULE_NAME": {
|
|
597
|
+
"pattern": r"missing.*module.*name|SOURCE.*no.*name",
|
|
598
|
+
"message": "SOURCE() missing module name.\n\nFix: SOURCE(file.cpp) module_name",
|
|
599
|
+
"category": "plugin"
|
|
600
|
+
},
|
|
601
|
+
"CP_BAD_DEPENDS": {
|
|
602
|
+
"pattern": r"DEPENDS.*invalid|bad.*DEPENDS",
|
|
603
|
+
"message": "Invalid DEPENDS() syntax.\n\nFix: DEPENDS(module1, module2)",
|
|
604
|
+
"category": "plugin"
|
|
605
|
+
},
|
|
606
|
+
"CP_SELF_DEPEND": {
|
|
607
|
+
"pattern": r"depends.*itself|self.*dependency",
|
|
608
|
+
"message": "Module depends on itself.\n\nFix: Remove circular DEPENDS()",
|
|
609
|
+
"category": "plugin"
|
|
610
|
+
},
|
|
611
|
+
"CP_NO_IMPL": {
|
|
612
|
+
"pattern": r"no.*implementation|function.*not.*found.*source",
|
|
613
|
+
"message": "Function declared in .cp but not in source.\n\nFix: Add implementation or remove from .cp",
|
|
614
|
+
"category": "plugin"
|
|
615
|
+
},
|
|
616
|
+
"CP_SIGNATURE_MISMATCH": {
|
|
617
|
+
"pattern": r"signature.*mismatch|parameter.*mismatch",
|
|
618
|
+
"message": "Method signature doesn't match C++ code.\n\nFix: Regenerate .cp with: includecpp plugin <name>",
|
|
619
|
+
"category": "plugin"
|
|
620
|
+
},
|
|
621
|
+
"CP_TEMPLATE_SYNTAX": {
|
|
622
|
+
"pattern": r"TEMPLATE.*syntax|TYPES.*invalid|bad.*TYPES",
|
|
623
|
+
"message": "Invalid template syntax.\n\nFix: TEMPLATE_FUNC(name) TYPES(int, float, double)",
|
|
624
|
+
"category": "plugin"
|
|
625
|
+
},
|
|
626
|
+
|
|
627
|
+
# ========== H. IMPORT/LOAD ERRORS (121-130) ==========
|
|
628
|
+
"DLL_LOAD_FAILED": {
|
|
629
|
+
"pattern": r"DLL load failed|ImportError.*DLL",
|
|
630
|
+
"message": "Can't load .pyd module.\n\nFix: Install VC++ Redistributable or check Python version",
|
|
631
|
+
"category": "import"
|
|
632
|
+
},
|
|
633
|
+
"IMPORT_ERROR": {
|
|
634
|
+
"pattern": r"ImportError|ModuleNotFoundError",
|
|
635
|
+
"message": "Can't import module.\n\nFix: includecpp rebuild",
|
|
636
|
+
"category": "import"
|
|
637
|
+
},
|
|
638
|
+
"MODULE_CORRUPT": {
|
|
639
|
+
"pattern": r"corrupt.*module|module.*corrupt|invalid.*module",
|
|
640
|
+
"message": "Module file corrupted.\n\nFix: includecpp rebuild --clean",
|
|
641
|
+
"category": "import"
|
|
642
|
+
},
|
|
643
|
+
"VERSION_MISMATCH": {
|
|
644
|
+
"pattern": r"version mismatch|wrong.*version",
|
|
645
|
+
"message": "Python version changed since build.\n\nFix: includecpp rebuild",
|
|
646
|
+
"category": "import"
|
|
647
|
+
},
|
|
648
|
+
"MISSING_DEP_MODULE": {
|
|
649
|
+
"pattern": r"depends.*on.*'(\w+)'|missing.*dependency.*'(\w+)'",
|
|
650
|
+
"message": "Module needs '{dep}'.\n\nFix: Build '{dep}' first or add DEPENDS({dep})",
|
|
651
|
+
"category": "import"
|
|
652
|
+
},
|
|
653
|
+
"PATH_ISSUE": {
|
|
654
|
+
"pattern": r"module.*not.*path|cannot.*find.*module.*path",
|
|
655
|
+
"message": "Module not in Python path.\n\nFix: Check PYTHONPATH or install location",
|
|
656
|
+
"category": "import"
|
|
657
|
+
},
|
|
658
|
+
"PERMISSION_ERROR": {
|
|
659
|
+
"pattern": r"permission denied|PermissionError|access.*denied",
|
|
660
|
+
"message": "Permission denied.\n\nFix: Check file permissions or run as admin",
|
|
661
|
+
"category": "import"
|
|
662
|
+
},
|
|
663
|
+
"FILE_LOCKED": {
|
|
664
|
+
"pattern": r"file.*locked|file.*in use|being used.*another",
|
|
665
|
+
"message": "File in use by another process.\n\nFix: Close other Python processes",
|
|
666
|
+
"category": "import"
|
|
667
|
+
},
|
|
668
|
+
"REGISTRY_MISSING": {
|
|
669
|
+
"pattern": r"registry.*not found|\.module_registry\.json.*missing",
|
|
670
|
+
"message": ".module_registry.json missing.\n\nFix: includecpp rebuild",
|
|
671
|
+
"category": "import"
|
|
672
|
+
},
|
|
673
|
+
"HASH_MISMATCH": {
|
|
674
|
+
"pattern": r"hash.*mismatch|checksum.*mismatch|source.*changed",
|
|
675
|
+
"message": "Source changed since build.\n\nFix: includecpp rebuild",
|
|
676
|
+
"category": "import"
|
|
677
|
+
},
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
def _extract_error_location(stderr: str) -> Tuple[Optional[str], Optional[int]]:
|
|
682
|
+
"""Extract file and line number from compiler error output.
|
|
683
|
+
|
|
684
|
+
Supports GCC/Clang format: file.cpp:42:10: error: ...
|
|
685
|
+
Supports MSVC format: file.cpp(42): error C1234: ...
|
|
686
|
+
|
|
687
|
+
Returns:
|
|
688
|
+
Tuple of (filename, line_number) or (None, None) if not found
|
|
689
|
+
"""
|
|
690
|
+
# GCC/Clang format: file:line:col: error:
|
|
691
|
+
gcc_match = re.search(r'([^\s:]+\.[ch](?:pp)?):(\d+):\d*:?\s*error:', stderr)
|
|
692
|
+
if gcc_match:
|
|
693
|
+
return gcc_match.group(1), int(gcc_match.group(2))
|
|
694
|
+
|
|
695
|
+
# MSVC format: file(line): error
|
|
696
|
+
msvc_match = re.search(r'([^\s(]+\.[ch](?:pp)?)\((\d+)\):\s*error', stderr)
|
|
697
|
+
if msvc_match:
|
|
698
|
+
return msvc_match.group(1), int(msvc_match.group(2))
|
|
699
|
+
|
|
700
|
+
# Try to find any line number mention
|
|
701
|
+
line_match = re.search(r':(\d+):', stderr)
|
|
702
|
+
if line_match:
|
|
703
|
+
return None, int(line_match.group(1))
|
|
704
|
+
|
|
705
|
+
return None, None
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
def get_error_message(stderr: str, context: Optional[Dict] = None) -> Optional[str]:
|
|
709
|
+
"""Match error text against catalog and return helpful message.
|
|
710
|
+
|
|
711
|
+
Args:
|
|
712
|
+
stderr: Error text (stderr, exception message, etc.)
|
|
713
|
+
context: Optional dict with extra info (module_name, file, line, etc.)
|
|
714
|
+
|
|
715
|
+
Returns:
|
|
716
|
+
Formatted error message or None if no match
|
|
717
|
+
"""
|
|
718
|
+
if not stderr:
|
|
719
|
+
return None
|
|
720
|
+
|
|
721
|
+
context = context or {}
|
|
722
|
+
|
|
723
|
+
# Extract location info from stderr
|
|
724
|
+
error_file, error_line = _extract_error_location(stderr)
|
|
725
|
+
|
|
726
|
+
for key, entry in ERROR_CATALOG.items():
|
|
727
|
+
match = re.search(entry["pattern"], stderr, re.IGNORECASE)
|
|
728
|
+
if match:
|
|
729
|
+
msg = entry["message"]
|
|
730
|
+
|
|
731
|
+
# Extract captured groups (filter None values)
|
|
732
|
+
groups = [g for g in match.groups() if g]
|
|
733
|
+
|
|
734
|
+
# Find all placeholders in message and replace with first captured value
|
|
735
|
+
if groups:
|
|
736
|
+
# Replace any placeholder with the first captured group
|
|
737
|
+
placeholder_pattern = re.compile(r'\{(\w+)\}')
|
|
738
|
+
for placeholder in placeholder_pattern.findall(msg):
|
|
739
|
+
msg = msg.replace(f'{{{placeholder}}}', groups[0])
|
|
740
|
+
|
|
741
|
+
# Add location info if found
|
|
742
|
+
location_info = []
|
|
743
|
+
if error_file:
|
|
744
|
+
location_info.append(f"File: {error_file}")
|
|
745
|
+
if error_line:
|
|
746
|
+
location_info.append(f"Line: {error_line}")
|
|
747
|
+
|
|
748
|
+
if location_info:
|
|
749
|
+
msg = f"{' | '.join(location_info)}\n\n{msg}"
|
|
750
|
+
|
|
751
|
+
# Add context info
|
|
752
|
+
if context.get("module"):
|
|
753
|
+
msg = f"[{context['module']}] {msg}"
|
|
754
|
+
|
|
755
|
+
return msg
|
|
756
|
+
|
|
757
|
+
return None
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
def format_error_box(message: str, title: str = "ERROR") -> str:
|
|
761
|
+
"""Format error in a visible box."""
|
|
762
|
+
width = 60
|
|
763
|
+
lines = message.split('\n')
|
|
764
|
+
|
|
765
|
+
box = []
|
|
766
|
+
box.append(f"+{'-' * (width - 2)}+")
|
|
767
|
+
box.append(f"| {title:<{width - 4}} |")
|
|
768
|
+
box.append(f"+{'-' * (width - 2)}+")
|
|
769
|
+
box.append("")
|
|
770
|
+
|
|
771
|
+
for line in lines:
|
|
772
|
+
box.append(line)
|
|
773
|
+
|
|
774
|
+
return '\n'.join(box)
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
def format_unknown_error(stderr: str) -> str:
|
|
778
|
+
"""Format unknown error with basic troubleshooting."""
|
|
779
|
+
# Extract first meaningful error line
|
|
780
|
+
lines = stderr.strip().split('\n')
|
|
781
|
+
first_error = next((l for l in lines if 'error' in l.lower()), lines[0] if lines else "Unknown error")
|
|
782
|
+
|
|
783
|
+
# Try to extract location info
|
|
784
|
+
error_file, error_line = _extract_error_location(stderr)
|
|
785
|
+
location_str = ""
|
|
786
|
+
if error_file or error_line:
|
|
787
|
+
parts = []
|
|
788
|
+
if error_file:
|
|
789
|
+
parts.append(f"File: {error_file}")
|
|
790
|
+
if error_line:
|
|
791
|
+
parts.append(f"Line: {error_line}")
|
|
792
|
+
location_str = f"{' | '.join(parts)}\n\n"
|
|
793
|
+
|
|
794
|
+
return f"""Unknown error occurred.
|
|
795
|
+
|
|
796
|
+
{location_str}{first_error[:200]}
|
|
797
|
+
|
|
798
|
+
Troubleshooting:
|
|
799
|
+
1. Run with --verbose for full output
|
|
800
|
+
2. Check C++ syntax in your source files
|
|
801
|
+
3. Try: includecpp rebuild --clean
|
|
802
|
+
4. Report bug: includecpp bug"""
|