-
Notifications
You must be signed in to change notification settings - Fork 0
/
compiler_output_parser.hpp
330 lines (322 loc) · 19.8 KB
/
compiler_output_parser.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/*
* Compiler Output Parser: Parse error, warning and messages
* Copyright (C) 2024 Christo Joseph
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMPILER_OUTPUT_PARSER_HPP_INCLUDED
#define COMPILER_OUTPUT_PARSER_HPP_INCLUDED
#include "ctre.hpp"
enum class CompilerOutputLineType
{
normal,
warning,
error,
info
};
struct CompilerOutputLineInfo
{
CompilerOutputLineType type;
std::string fileName;
std::string line;
std::string message;
};
struct CompilerRegexInfo
{
const char* name{nullptr};
CompilerOutputLineType type;
size_t fileNameIdx;
size_t lineIdx;
size_t messageIdx;
};
#define POPULATE_INFO(info, match, regexInfo) \
{ \
info.type = regexInfo.type; \
/*std::cout << "Matched : name : [" << regexInfo.name << "] type [" << static_cast<int>(regexInfo.type) << "]\n";*/ \
if (compilerRegexInfo.fileNameIdx) info.fileName = match.get<compilerRegexInfo.fileNameIdx>().to_string(); \
if (compilerRegexInfo.lineIdx) info.line = match.get<compilerRegexInfo.lineIdx>().to_string(); \
if (compilerRegexInfo.messageIdx) info.message = match.get<compilerRegexInfo.messageIdx>().to_string(); \
}
inline CompilerOutputLineInfo GetCompilerOutputLineInfo(std::string_view line)
{
CompilerOutputLineInfo ret;
//<![CDATA[FATAL:[[:blank:]]*(.*)]]>
if (auto m = ctre::match<"FATAL:[[:blank:]]*(.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Fatal error", .type = CompilerOutputLineType::error, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):[[:blank:]]+([iI]n
//([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):[[:blank:]]+([iI]n "
"([cC]lass|[cC]onstructor|[dD]estructor|[fF]unction|[mM]ember [fF]unction).*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "'In function...' info", .type = CompilerOutputLineType::info, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]]+(\[[[:blank:]]+[Ss]kipping [0-9]+ instantiation
// contexts[[:blank:]]+\])]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]]+(\\[[[:blank:]]+[Ss]kipping "
"[0-9]+ instantiation contexts[[:blank:]]+\\])">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {.name = "'Skipping N instantiation contexts' info (2)",
.type = CompilerOutputLineType::info,
.fileNameIdx = 1,
.lineIdx = 2,
.messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]]+(\[[[:blank:]]+[Ss]kipping [0-9]+ instantiation
// contexts[[:blank:]]+\])]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]]+(\\[[[:blank:]]+[Ss]kipping "
"[0-9]+ instantiation contexts[[:blank:]]+\\])">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {.name = "'Skipping N instantiation contexts' info",
.type = CompilerOutputLineType::info,
.fileNameIdx = 1,
.lineIdx = 2,
.messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):[[:blank:]]+([Ii]n [Ii]nstantiation.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):[[:blank:]]+([Ii]n [Ii]nstantiation.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "'In instantiation' warning", .type = CompilerOutputLineType::warning, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]]+([Rr]equired from.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]]+([Rr]equired from.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "'Required from' warning", .type = CompilerOutputLineType::warning, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]]+([Ii]nstantiated from .*)]]>
else if (auto m =
ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]]+([Ii]nstantiated from .*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "'Instantiated from' info (2)", .type = CompilerOutputLineType::info, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]]+([Ii]nstantiated from .*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]]+([Ii]nstantiated from .*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "'Instantiated from' info", .type = CompilerOutputLineType::info, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[windres.exe:[[:blank:]]([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]](.*)]]>
else if (auto m = ctre::match<"windres.exe:[[:blank:]]([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Resource compiler error", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[windres.exe:[[:blank:]](.*)]]>
else if (auto m = ctre::match<"windres.exe:[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Resource compiler error (2)", .type = CompilerOutputLineType::error, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):([0-9]+):[[:blank:]]([Ww]arning:[[:blank:]].*)]]>
else if (auto m =
ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):([0-9]+):[[:blank:]]([Ww]arning:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Preprocessor warning", .type = CompilerOutputLineType::warning, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 4};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]]([Nn]ote:[[:blank:]].*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]]([Nn]ote:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler note (2)", .type = CompilerOutputLineType::info, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]]([Nn]ote:[[:blank:]].*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]]([Nn]ote:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler note", .type = CompilerOutputLineType::info, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([Nn]ote:[[:blank:]].*)]]>
else if (auto m = ctre::match<".{0,1023}([Nn]ote:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "General note", .type = CompilerOutputLineType::info, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]](.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Preprocessor error", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]]([Ww]arning:[[:blank:]].*)]]>
else if (auto m =
ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]]([Ww]arning:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler warning (2)", .type = CompilerOutputLineType::warning, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]]([Ww]arning:[[:blank:]].*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]]([Ww]arning:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler warning", .type = CompilerOutputLineType::warning, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[[][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+\.o:([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]](undefined
// reference.*)]]>
else if (auto m = ctre::match<"[{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}\\.o:([{}()[:blank:]#%$~[:alnum:]!&_:+/"
"\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]](undefined reference.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Undefined reference (2)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]](.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler error (2)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[[:blank:]](.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler error", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):\(\.text\+[0-9a-fA-FxX]+\):[[:blank:]]([Ww]arning:[[:blank:]].*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/"
"\\\\\\.\\-]{1,512}):\\(\\.text\\+[0-9a-fA-FxX]+\\):[[:blank:]]([Ww]arning:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker warning", .type = CompilerOutputLineType::warning, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):([0-9]+):[0-9]+:[[:blank:]](.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):([0-9]+):[0-9]+:[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker error", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 2, .messageIdx = 3};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[[][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+\(.text\+[0-9A-Za-z]+\):([[:blank:]A-Za-z0-9_:+/\.-]+):[[:blank:]](.*)]]>
else if (auto m = ctre::match<"[{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}\\(.text\\+[0-9A-Za-z]+\\):([[:blank:]A-Za-z0-9_:+/"
"\\.\\-]{1,512}):[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker error (2)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):\(\.text\+[0-9a-fA-FxX]+\):(.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):\\(\\.text\\+[0-9a-fA-FxX]+\\):(.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker error (3)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[.*(ld.*):[[:blank:]](cannot find.*)]]>
else if (auto m = ctre::match<".{0,1023}(ld.{0,1023}):[[:blank:]](cannot find.*)">(line)) // Error
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker error (lib not found)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[.*(ld.*):[[:blank:]](cannot open output file.*):[[:blank:]](.*)]]>
else if (auto m = ctre::match<".{0,1023}(ld.{0,1023}):[[:blank:]](cannot open output file.*):[[:blank:]](.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker error (cannot open output file)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
// TODO msg2
}
//<![CDATA[.*(ld.*):[[:blank:]](unrecognized option.*)]]>
else if (auto m = ctre::match<".{0,1023}(ld.{0,1023}):[[:blank:]](unrecognized option.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Linker error (unrecognized option)", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[.*cc.*:[[:blank:]]([Uu]nrecognized.*option.*)]]>
else if (auto m = ctre::match<".{0,1023}cc.{0,1023}:[[:blank:]]([Uu]nrecognized.*option.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Compiler error (unrecognized option)", .type = CompilerOutputLineType::error, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[.*:(.*):[[:blank:]](No such file or directory.*)]]>
else if (auto m = ctre::match<".{0,1023}:(.{0,1023}):[[:blank:]](No such file or directory.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "No such file or directory", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):[[:blank:]](undefined reference.*)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):[[:blank:]](undefined reference.*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Undefined reference", .type = CompilerOutputLineType::error, .fileNameIdx = 1, .lineIdx = 0, .messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([Ee]rror:[[:blank:]].*)]]>
else if (auto m = ctre::match<".{0,1023}([Ee]rror:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "General error", .type = CompilerOutputLineType::error, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([Ww]arning:[[:blank:]].*)]]>
else if (auto m = ctre::match<".{0,1023}([Ww]arning:[[:blank:]].*)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "General warning", .type = CompilerOutputLineType::warning, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([Ii]nfo:[[:blank:]].*)\(auto-import\)]]>
else if (auto m = ctre::match<"(.{0,1023}[Ii]nfo:[[:blank:]].*)\\(auto-import\\)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {
.name = "Auto-import info", .type = CompilerOutputLineType::info, .fileNameIdx = 0, .lineIdx = 0, .messageIdx = 1};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
//<![CDATA[([][{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+):[[:blank:]]+(duplicate section.*has different size)]]>
else if (auto m = ctre::match<"([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\\\\.\\-]{1,512}):[[:blank:]]+(duplicate section.*has different size)">(line))
{
static constexpr CompilerRegexInfo compilerRegexInfo = {.name = "Linker warning (different sized sections)",
.type = CompilerOutputLineType::warning,
.fileNameIdx = 1,
.lineIdx = 0,
.messageIdx = 2};
POPULATE_INFO(ret, m, compilerRegexInfo);
}
else
{
ret.type = CompilerOutputLineType::normal;
/*std::cout << "Match failed!\n";*/
}
return ret;
}
#endif // COMPILER_OUTPUT_PARSER_HPP_INCLUDED