UNPKG

21.4 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const erros_1 = require("./erros");
4class Include {
5 constructor(local) {
6 this.local = local;
7 this.includesObsoletos = [];
8 this.includesObsoletos.push("PROTHEUS.CH");
9 this.includesObsoletos.push("DIALOG.CH");
10 this.includesObsoletos.push("FONT.CH");
11 this.includesObsoletos.push("PTMENU.CH");
12 this.includesObsoletos.push("PRINT.CH");
13 this.includesObsoletos.push("COLORS.CH");
14 this.includesObsoletos.push("FOLDER.CH");
15 this.includesObsoletos.push("MSOBJECT.CH");
16 this.includesObsoletos.push("VKEY.CH");
17 this.includesObsoletos.push("WINAPI.CH");
18 this.includesObsoletos.push("FWCOMMAND.CH");
19 this.includesObsoletos.push("FWCSS.CH");
20 this.includeExpressoes = [];
21 //AP5MAIL.CH
22 this.includeExpressoes.push({
23 expressoes: [
24 /CONNECT+(\ |\t)+SMTP+(\ |\t)+SERVER/,
25 /CONNECT+(\ |\t)+POP+(\ |\t)+SERVER/,
26 /DISCONNECT+(\ |\t)+SMTP+(\ |\t)+SERVER/,
27 /DISCONNECT+(\ |\t)+POP+(\ |\t)+SERVER/,
28 /POP+(\ |\t)+MESSAGE+(\ |\t)+COUNT/,
29 /SEND+(\ |\t)+MAIL+(\ |\t)+FROM/,
30 /GET+(\ |\t)+MAIL+(\ |\t)+ERROR/,
31 /RECEIVE+(\ |\t)+MAIL+(\ |\t)+MESSAGE/
32 ],
33 include: "AP5MAIL.CH",
34 precisa: false,
35 includes: []
36 });
37 //APVISIO.CH
38 //APWEB.CH
39 this.includeExpressoes.push({
40 expressoes: [
41 /APWEB+(\ |\t)+INIT+(\ |\t)+.+(\ |\t)+USING/,
42 /APWEB+(\ |\t)+END/
43 ],
44 include: "APWEB.CH",
45 precisa: false,
46 includes: []
47 });
48 //APWEBEX.CH
49 this.includeExpressoes.push({
50 expressoes: [
51 /OPEN+(\ |\t)+QUERY+(\ |\t)+ALIAS/,
52 /CLOSE+(\ |\t)+QUERY/,
53 /WEB+(\ |\t)+EXTENDED+(\ |\t)+INIT/,
54 /WEB+(\ |\t)+EXTENDED+(\ |\t)+END/
55 ],
56 include: "APWEBEX.CH",
57 precisa: false,
58 includes: []
59 });
60 //APWEBSRV.CH
61 this.includeExpressoes.push({
62 expressoes: [
63 /(\ |\t|\(|\,)+SOAPFAULT_VERSIONMISMATCH/,
64 /(\ |\t|\(|\,)+SOAPFAULT_MUSTUNDERSTAND/,
65 /(\ |\t|\(|\,)+SOAPFAULT_DTDNOTSUPPORTED/,
66 /(\ |\t|\(|\,)+SOAPFAULT_DATAENCODINGUNKNOWN/,
67 /(\ |\t|\(|\,)+SOAPFAULT_SENDER/,
68 /(\ |\t|\(|\,)+SOAPFAULT_RECEIVER/,
69 /(\ |\t|\(|\,)+BYREF/,
70 /(\ |\t|\(|\,)+WSSTRUCT/,
71 /(\ |\t|\(|\,)+WSSERVICE/,
72 /(\ |\t|\(|\,)+WSCLIENT/,
73 /(\ |\t|\(|\,)+WSMETHOD/,
74 /(\ |\t|\(|\,)+_WSPARMS_/,
75 /(\ |\t|\(|\,)+WSDATA/
76 ],
77 include: "APWEBSRV.CH",
78 precisa: false,
79 includes: []
80 });
81 //APWIZARD.CH
82 this.includeExpressoes.push({
83 expressoes: [
84 /DEFINE+(\ |\t)+WIZARD/,
85 /ACTIVATE+(\ |\t)+WIZARD/,
86 /CREATE+(\ |\t)+PANEL/
87 ],
88 include: "APWIZARD.CH",
89 precisa: false,
90 includes: []
91 });
92 //AVPRINT.CH
93 //AXSDEF.CH
94 //BIRTDATASET.CH
95 //COLORS.CH - DENTRO DO PROTHEUS.CH
96 //COMMON.CH
97 //CONSTANT.CH
98 //DBFCDXAX.CH
99 //TOPCONN.CH
100 this.includeExpressoes.push({
101 expressoes: [/TCQUERY+(\ |\t)/],
102 include: "TOPCONN.CH",
103 precisa: false,
104 includes: []
105 });
106 //TBICONN.CH
107 this.includeExpressoes.push({
108 expressoes: [
109 /CREATE+(\ |\t)+RPCCONN+(\ |\t)/,
110 /CLOSE+(\ |\t)+RPCCONN+(\ |\t)/,
111 /PREPARE+(\ |\t)+ENVIRONMENT+(\ |\t)/,
112 /RESET+(\ |\t)+ENVIRONMENT+(\ |\t)/,
113 /OPEN+(\ |\t)+REMOTE+(\ |\t)+TRANSACTION+(\ |\t)/,
114 /CLOSE+(\ |\t)+REMOTE+(\ |\t)+TRANSACTION+(\ |\t)/,
115 /CALLPROC+(\ |\t)+IN+(\ |\t)/,
116 /OPEN+(\ |\t)+REMOTE+(\ |\t)+TABLES+(\ |\t)/
117 ],
118 include: "TBICONN.CH",
119 precisa: false,
120 includes: ["AP5MAIL.CH"]
121 });
122 //REPORT.CH
123 this.includeExpressoes.push({
124 expressoes: [
125 /DEFINE+(\ |\t)+REPORT+(\ |\t)+.+(\ |\t)+NAME+(\ |\t)/,
126 /DEFINE+(\ |\t)+SECTION+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/,
127 /DEFINE+(\ |\t)+CELL+(\ |\t)+NAME+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/,
128 /DEFINE+(\ |\t)+BREAK+(\ |\t)+OF+(\ |\t)/,
129 /DEFINE+(\ |\t)+FUNCTION+(\ |\t)+FROM+(\ |\t)/,
130 /DEFINE+(\ |\t)+COLLECTION+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/,
131 /DEFINE+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)+/,
132 /DEFINE+(\ |\t)+HEADER+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/,
133 /DEFINE+(\ |\t)+CELL+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/,
134 /DEFINE+(\ |\t)+CELL+(\ |\t)+HEADER+(\ |\t)+BORDER+(\ |\t)+.+(\ |\t)+OF+(\ |\t)/
135 ],
136 include: "REPORT.CH",
137 precisa: false,
138 includes: []
139 });
140 //FILEIO.CH
141 this.includeExpressoes.push({
142 expressoes: [
143 /(\ |\t|\(|\,)+F_ERROR/,
144 /(\ |\t|\(|\,)+FS_SET/,
145 /(\ |\t|\(|\,)+FS_RELATIVE/,
146 /(\ |\t|\(|\,)+FS_END/,
147 /(\ |\t|\(|\,)+FO_READ/,
148 /(\ |\t|\(|\,)+FO_WRITE/,
149 /(\ |\t|\(|\,)+FO_READWRITE/,
150 /(\ |\t|\(|\,)+FO_COMPAT/,
151 /(\ |\t|\(|\,)+FO_EXCLUSIVE/,
152 /(\ |\t|\(|\,)+FO_DENYWRITE/,
153 /(\ |\t|\(|\,)+FO_DENYREAD/,
154 /(\ |\t|\(|\,)+FO_DENYNONE/,
155 /(\ |\t|\(|\,)+FO_SHARED/,
156 /(\ |\t|\(|\,)+FC_NORMAL/,
157 /(\ |\t|\(|\,)+FC_READONLY/,
158 /(\ |\t|\(|\,)+FC_HIDDEN/,
159 /(\ |\t|\(|\,)+FC_SYSTEM/,
160 /(\ |\t|\(|\,)+FD_RAW/,
161 /(\ |\t|\(|\,)+FD_BINARY/,
162 /(\ |\t|\(|\,)+FD_COOKED/,
163 /(\ |\t|\(|\,)+FD_TEXT/,
164 /(\ |\t|\(|\,)+FD_ASCII/
165 ],
166 include: "FILEIO.CH",
167 precisa: false,
168 includes: []
169 });
170 //TBICODE.CH
171 this.includeExpressoes.push({
172 expressoes: [
173 /(\ |\t|\(|\,)+RPC_LOGIN/,
174 /(\ |\t|\(|\,)+RPC_LOGOFF/,
175 /(\ |\t|\(|\,)+RPC_SEND_COTACAO/,
176 /(\ |\t|\(|\,)+RPC_ESTORNA_COTACAO/,
177 /(\ |\t|\(|\,)+RPC_READ_COTACAO/,
178 /(\ |\t|\(|\,)+RPC_SEND_ORCAMENTO/,
179 /(\ |\t|\(|\,)+RPC_ESTORNA_ORCAMENTO/,
180 /(\ |\t|\(|\,)+RPC_READ_ORCAMENTO/
181 ],
182 include: "TBICODE.CH",
183 precisa: false,
184 includes: []
185 });
186 //PARMTYPE.CH
187 this.includeExpressoes.push({
188 expressoes: [
189 /(\ |\t|\(|\,)+PARAMEXCEPTION/,
190 /(\ |\t|\(|\,)+CLASSEXCEPTION/,
191 /(\ |\t|\(|\,)+CLASSPARAMEXCEPTION/,
192 /(\ |\t|\(|\,)+BLOCKPARAMEXCEPTION/,
193 /(\ |\t|\(|\,)+PARAMTYPE/
194 ],
195 include: "PARMTYPE.CH",
196 precisa: false,
197 includes: []
198 });
199 //FWMVCDEF.CH
200 this.includeExpressoes.push({
201 expressoes: [
202 /(\ |\t|\(|\,)+FORM_STRUCT_TABLE_/,
203 /(\ |\t|\(|\,)+FORM_STRUCT_CARGO_/,
204 /(\ |\t|\(|\,)+MVC_BUTTON_/,
205 /(\ |\t|\(|\,)+MVC_TOOLBAR_/,
206 /(\ |\t|\(|\,)+MODELO_PK_/,
207 /(\ |\t|\(|\,)+MODEL_TRIGGER_/,
208 /(\ |\t|\(|\,)+MODEL_FIELD_/,
209 /(\ |\t|\(|\,)+MODEL_RELATION_/,
210 /(\ |\t|\(|\,)+MODEL_STRUCT_/,
211 /(\ |\t|\(|\,)+STRUCT_FEATURE_/,
212 /(\ |\t|\(|\,)+STRUCT_RULES_/,
213 /(\ |\t|\(|\,)+MODEL_GRID_/,
214 /(\ |\t|\(|\,)+MODEL_GRIDLINE_/,
215 /(\ |\t|\(|\,)+MODEL_RULES_/,
216 /(\ |\t|\(|\,)+MODEL_MSGERR_/,
217 /(\ |\t|\(|\,)+MODEL_OPERATION_/,
218 /(\ |\t|\(|\,)+MVC_LOADFILTER_/,
219 /(\ |\t|\(|\,)+MODEL_CONTROL_/,
220 /(\ |\t|\(|\,)+VIEWS_VIEW_/,
221 /(\ |\t|\(|\,)+MVC_VIEW_/,
222 /(\ |\t|\(|\,)+MVC_MODEL_/,
223 /(\ |\t|\(|\,)+FORMSTRUFIELD/,
224 /(\ |\t|\(|\,)+FORMSTRUTRIGGER/,
225 /(\ |\t|\(|\,)+VIEWSTRUFIELD/,
226 /(\ |\t|\(|\,)+VIEWSTRUFOLDER/,
227 /(\ |\t|\(|\,)+VIEWSTRUDOCKWINDOW/,
228 /(\ |\t|\(|\,)+VIEWSTRUGROUP/,
229 /(\ |\t|\(|\,)+VIEW_BUTTON_/,
230 /(\ |\t|\(|\,)+OP_PESQUISAR/,
231 /(\ |\t|\(|\,)+OP_VISUALIZAR/,
232 /(\ |\t|\(|\,)+OP_INCLUIR/,
233 /(\ |\t|\(|\,)+OP_ALTERAR/,
234 /(\ |\t|\(|\,)+OP_EXCLUIR/,
235 /(\ |\t|\(|\,)+OP_IMPRIMIR/,
236 /(\ |\t|\(|\,)+OP_COPIA/,
237 /(\ |\t|\(|\,)+ADD+(\ |\t)+FWTOOLBUTTON/,
238 /(\ |\t|\(|\,)+NEW+(\ |\t)+MODEL/,
239 /(\ |\t|\(|\,)+PUBLISH+(\ |\t)+MODEL+(\ |\t)+REST+(\ |\t)+NAME/,
240 /(\ |\t|\(|\,)+ADD+(\ |\t)+OPTION+(\ |\t)+.+(\ |\t)+TITLE+(\ |\t)+(.|)+(\ |\t)+ACTION+(\ |\t)+(.|)+(\ |\t)+OPERATION+(\ |\t)+(.|)+(\ |\t)+ACCESS+(\ |\t)/
241 ],
242 include: "FWMVCDEF.CH",
243 precisa: false,
244 includes: ["PARMTYPE.CH", "FWMBROWSE.CH"]
245 });
246 //AARRAY.CH
247 this.includeExpressoes.push({
248 expressoes: [/\[+(\ |\t|)+\#+(.|)+\]/],
249 include: "AARRAY.CH",
250 precisa: false,
251 includes: []
252 });
253 //RPTDEF.CH
254 this.includeExpressoes.push({
255 expressoes: [
256 /(\ |\t|\(|\,)+CELL_ALIGN_LEFT/,
257 /(\ |\t|\(|\,)+CELL_ALIGN_CENTER/,
258 /(\ |\t|\(|\,)+CELL_ALIGN_RIGHT/,
259 /(\ |\t|\(|\,)+BORDER_NONE/,
260 /(\ |\t|\(|\,)+BORDER_CONTINUOUS/,
261 /(\ |\t|\(|\,)+BORDER_PARENT/,
262 /(\ |\t|\(|\,)+BORDER_HEADERPARENT/,
263 /(\ |\t|\(|\,)+BORDER_CELL/,
264 /(\ |\t|\(|\,)+BORDER_FUNCTION/,
265 /(\ |\t|\(|\,)+BORDER_SECTION/,
266 /(\ |\t|\(|\,)+EDGE_TOP/,
267 /(\ |\t|\(|\,)+EDGE_BOTTOM/,
268 /(\ |\t|\(|\,)+EDGE_LEFT/,
269 /(\ |\t|\(|\,)+EDGE_RIGHT/,
270 /(\ |\t|\(|\,)+EDGE_ALL/,
271 /(\ |\t|\(|\,)+NEGATIVE_PARENTHESES/,
272 /(\ |\t|\(|\,)+NEGATIVE_SIGNAL/,
273 /(\ |\t|\(|\,)+IMP_DISCO/,
274 /(\ |\t|\(|\,)+IMP_SPOOL/,
275 /(\ |\t|\(|\,)+IMP_EMAIL/,
276 /(\ |\t|\(|\,)+IMP_EXCEL/,
277 /(\ |\t|\(|\,)+IMP_HTML/,
278 /(\ |\t|\(|\,)+IMP_PDF/,
279 /(\ |\t|\(|\,)+IMP_ODF/,
280 /(\ |\t|\(|\,)+IMP_PDFMAIL/,
281 /(\ |\t|\(|\,)+IMP_MAILCOMPROVA/,
282 /(\ |\t|\(|\,)+IMP_ECM/,
283 /(\ |\t|\(|\,)+AMB_SERVER/,
284 /(\ |\t|\(|\,)+AMB_CLIENT/,
285 /(\ |\t|\(|\,)+AMB_ECM+(\ |\t)/,
286 /(\ |\t|\(|\,)+PORTRAIT+(\ |\t)/,
287 /(\ |\t|\(|\,)+LANDSCAPE+(\ |\t)/,
288 /(\ |\t|\(|\,)+NO_REMOTE/,
289 /(\ |\t|\(|\,)+REMOTE_DELPHI/,
290 /(\ |\t|\(|\,)+REMOTE_QTWIN/,
291 /(\ |\t|\(|\,)+REMOTE_QTLINUX/,
292 /(\ |\t|\(|\,)+TYPE_CELL/,
293 /(\ |\t|\(|\,)+TYPE_FORMULA/,
294 /(\ |\t|\(|\,)+TYPE_FUNCTION/,
295 /(\ |\t|\(|\,)+TYPE_USER/,
296 /(\ |\t|\(|\,)+COLLECTION_VALUE/,
297 /(\ |\t|\(|\,)+COLLECTION_REPORT/,
298 /(\ |\t|\(|\,)+COLLECTION_SECTION/,
299 /(\ |\t|\(|\,)+COLLECTION_PAGE/,
300 /(\ |\t|\(|\,)+TSEEK/,
301 /(\ |\t|\(|\,)+TCACHE/,
302 /(\ |\t|\(|\,)+TSTRUCT/,
303 /(\ |\t|\(|\,)+TALIAS/,
304 /(\ |\t|\(|\,)+TDESC/,
305 /(\ |\t|\(|\,)+FSTRUCTALL/,
306 /(\ |\t|\(|\,)+FSTRUCTFIELD/,
307 /(\ |\t|\(|\,)+FTITLE/,
308 /(\ |\t|\(|\,)+FTOOLTIP/,
309 /(\ |\t|\(|\,)+FFIELD/,
310 /(\ |\t|\(|\,)+FTYPE/,
311 /(\ |\t|\(|\,)+FSIZE/,
312 /(\ |\t|\(|\,)+FDECIMAL/,
313 /(\ |\t|\(|\,)+FCOMBOBOX/,
314 /(\ |\t|\(|\,)+FOBRIGAT/,
315 /(\ |\t|\(|\,)+FUSED/,
316 /(\ |\t|\(|\,)+FCONTEXT/,
317 /(\ |\t|\(|\,)+FNIVEL/,
318 /(\ |\t|\(|\,)+FTABLE/,
319 /(\ |\t|\(|\,)+FPICTURE/,
320 /(\ |\t|\(|\,)+FCONPAD/,
321 /(\ |\t|\(|\,)+ISTRUCTALL/,
322 /(\ |\t|\(|\,)+ISTRUCTINDEX/,
323 /(\ |\t|\(|\,)+IDESC/,
324 /(\ |\t|\(|\,)+IKEY/,
325 /(\ |\t|\(|\,)+IDESC/,
326 /(\ |\t|\(|\,)+ITABLE/,
327 /(\ |\t|\(|\,)+PGROUP/,
328 /(\ |\t|\(|\,)+PORDER/,
329 /(\ |\t|\(|\,)+PGSC/,
330 /(\ |\t|\(|\,)+PTYPE/,
331 /(\ |\t|\(|\,)+PDESC/,
332 /(\ |\t|\(|\,)+PPERG1/,
333 /(\ |\t|\(|\,)+PPERG2/,
334 /(\ |\t|\(|\,)+PPERG3/,
335 /(\ |\t|\(|\,)+PPERG4/,
336 /(\ |\t|\(|\,)+PPERG5/,
337 /(\ |\t|\(|\,)+PPYME/,
338 /(\ |\t|\(|\,)+PPICTURE/
339 ],
340 include: "RPTDEF.CH",
341 precisa: false,
342 includes: []
343 });
344 //FWPRINTSETUP.CH
345 this.includeExpressoes.push({
346 expressoes: [
347 /(\ |\t|\(|\,)+PD_ISTOTVSPRINTER/,
348 /(\ |\t|\(|\,)+PD_DISABLEDESTINATION/,
349 /(\ |\t|\(|\,)+PD_DISABLEORIENTATION/,
350 /(\ |\t|\(|\,)+PD_DISABLEPAPERSIZE/,
351 /(\ |\t|\(|\,)+PD_DISABLEPREVIEW/,
352 /(\ |\t|\(|\,)+PD_DISABLEMARGIN/,
353 /(\ |\t|\(|\,)+PD_TYPE_FILE/,
354 /(\ |\t|\(|\,)+PD_TYPE_SPOOL/,
355 /(\ |\t|\(|\,)+PD_TYPE_EMAIL/,
356 /(\ |\t|\(|\,)+PD_TYPE_EXCEL/,
357 /(\ |\t|\(|\,)+PD_TYPE_HTML/,
358 /(\ |\t|\(|\,)+PD_TYPE_PDF/,
359 /(\ |\t|\(|\,)+PD_DESTINATION/,
360 /(\ |\t|\(|\,)+PD_PRINTTYPE/,
361 /(\ |\t|\(|\,)+PD_ORIENTATION/,
362 /(\ |\t|\(|\,)+PD_PAPERSIZE/,
363 /(\ |\t|\(|\,)+PD_PREVIEW/,
364 /(\ |\t|\(|\,)+PD_VALUETYPE/,
365 /(\ |\t|\(|\,)+PD_MARGIN/,
366 /(\ |\t|\(|\,)+PD_MARGIN_LEFT/,
367 /(\ |\t|\(|\,)+PD_MARGIN_TOP/,
368 /(\ |\t|\(|\,)+PD_MARGIN_RIGHT/,
369 /(\ |\t|\(|\,)+PD_MARGIN_BOTTOM/,
370 /(\ |\t|\(|\,)+PD_OK/,
371 /(\ |\t|\(|\,)+PD_CANCEL/
372 ],
373 include: "FWPRINTSETUP.CH",
374 precisa: false,
375 includes: []
376 });
377 //MSOLE.CH
378 this.includeExpressoes.push({
379 expressoes: [
380 /(\ |\t|\(|\,)+OLEONERROR/,
381 /(\ |\t|\(|\,)+OLEWDLEFT/,
382 /(\ |\t|\(|\,)+OLEWDTOP/,
383 /(\ |\t|\(|\,)+OLEWDWIDTH/,
384 /(\ |\t|\(|\,)+OLEWDHEIGHT/,
385 /(\ |\t|\(|\,)+OLEWDCAPTION/,
386 /(\ |\t|\(|\,)+OLEWDVISIBLE/,
387 /(\ |\t|\(|\,)+OLEWDWINDOWSTATE/,
388 /(\ |\t|\(|\,)+OLEWDPRINTBACK/,
389 /(\ |\t|\(|\,)+OLEWDVERSION/,
390 /(\ |\t|\(|\,)+OLEWDFORMATDOCUMENT/,
391 /(\ |\t|\(|\,)+OLEWDFORMATTEMPLATE/,
392 /(\ |\t|\(|\,)+OLEWDFORMATTEXT/,
393 /(\ |\t|\(|\,)+OLEWDFORMATTEXTLINEBREAKS/,
394 /(\ |\t|\(|\,)+OLEWDFORMATDOSTEXT/,
395 /(\ |\t|\(|\,)+OLEWDFORMATDOSTEXTLINEBREAKS/,
396 /(\ |\t|\(|\,)+OLEWDFORMATRTF/,
397 /(\ |\t|\(|\,)+OLEWDFORMATUNICODETEXT/,
398 /(\ |\t|\(|\,)+WDFORMATHTML/,
399 /(\ |\t|\(|\,)+WDFORMATDOCUMENTDEFAULT/,
400 /(\ |\t|\(|\,)+OLEWDFORMATHTML/
401 ],
402 include: "MSOLE.CH",
403 precisa: false,
404 includes: []
405 });
406 //RWMAKE.CH
407 this.includeExpressoes.push({
408 expressoes: [
409 /@+(\ |\t)+.+\,+.+(\ |\t)+TO+(\ |\t)+.+\,+.+(\ |\t)+DIALOG/,
410 /@+(\ |\t)+.+\,+.+(\ |\t)+BMPBUTTON/
411 ],
412 include: "RWMAKE.CH",
413 precisa: false,
414 includes: ["STDWIN.CH"]
415 });
416 }
417 valida(objetoValidacao, conteudoFile) {
418 //Monta array com includes no fonte
419 let includesFonte = objetoValidacao.includes.map((x) => x.include);
420 let includesAnalise = this.includeExpressoes.map((x) => x.include);
421 if (!objetoValidacao.includes.indexOf((x) => x.include === "TOTVS.CH")) {
422 objetoValidacao.aErros.push(new erros_1.Erro(0, 0, traduz("includes.faltaTOTVS", this.local), erros_1.Severity.Warning));
423 }
424 //Busca includes duplicados
425 objetoValidacao.includes.forEach((include) => {
426 //Verifica se o include é obsoleto
427 if (this.includesObsoletos.indexOf(include.include) !== -1) {
428 objetoValidacao.aErros.push(new erros_1.Erro(include.linha, include.linha, traduz("includes.oInclude", this.local) +
429 include.include +
430 traduz("includes.SubstTOTVS", this.local), erros_1.Severity.Warning));
431 }
432 //Verifica se há o mesmo include em uma linha diferente do mesmo fonte
433 if (objetoValidacao.includes.findIndex(function (x) {
434 return x.include === include.include && x.linha !== include.linha;
435 }) !== -1) {
436 objetoValidacao.aErros.push(new erros_1.Erro(include.linha, include.linha, traduz("includes.oInclude", this.local) +
437 include.include +
438 traduz("includes.emDuplicidade", this.local), erros_1.Severity.Warning));
439 }
440 });
441 //valida necessidade de includes
442 let linhas = conteudoFile.split("\n");
443 for (var key in linhas) {
444 //seta linha atual
445 let linha = " " + linhas[key];
446 this.includeExpressoes.forEach(element => {
447 element.expressoes.forEach((expressao) => {
448 if (linha.search(expressao) !== -1) {
449 element.precisa = true;
450 //se não estiver na lista de includes
451 if (includesFonte.indexOf(element.include) === -1) {
452 objetoValidacao.aErros.push(new erros_1.Erro(parseInt(key), parseInt(key), traduz("includes.faltaInclude", this.local) +
453 element.include +
454 "!", erros_1.Severity.Error));
455 }
456 }
457 });
458 });
459 }
460 //Verifica se o include é desnecessário
461 objetoValidacao.includes.forEach((include) => {
462 //se o include é analisado
463 let includeAnalise = this.includeExpressoes[includesAnalise.indexOf(include.include)];
464 if (includeAnalise) {
465 if (!includeAnalise.precisa) {
466 objetoValidacao.aErros.push(new erros_1.Erro(include.linha, include.linha, "Include " +
467 include.include +
468 traduz("includes.desnecessario", this.local), erros_1.Severity.Warning));
469 }
470 //Verifica se há algum include que está contido nesse INCLUDE
471 includeAnalise.includes.forEach((includeContido) => {
472 let includeAnaliseContido = objetoValidacao.includes[includesFonte.indexOf(includeContido)];
473 if (includeAnaliseContido) {
474 objetoValidacao.aErros.push(new erros_1.Erro(includeAnaliseContido.linha, includeAnaliseContido.linha, traduz("includes.oInclude", this.local) +
475 includeAnaliseContido.include +
476 traduz("includes.desnecessarioContido", this.local) +
477 include.include +
478 "!", erros_1.Severity.Warning));
479 }
480 });
481 }
482 });
483 }
484}
485exports.Include = Include;
486function traduz(key, local) {
487 let locales = ["en", "pt-br"];
488 let i18n = require("i18n");
489 i18n.configure({
490 locales: locales,
491 directory: __dirname + "/locales"
492 });
493 i18n.setLocale(locales.indexOf(local) + 1 ? local : "en");
494 return i18n.__(key);
495}
496//# sourceMappingURL=include.js.map
\No newline at end of file