@designliquido/delegua 0.35.1 → 0.35.3
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.
- package/analisador-semantico/analisador-semantico-base.d.ts +3 -0
- package/analisador-semantico/analisador-semantico-base.d.ts.map +1 -1
- package/analisador-semantico/analisador-semantico-base.js +10 -0
- package/analisador-semantico/analisador-semantico-base.js.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.d.ts +3 -3
- package/avaliador-sintatico/avaliador-sintatico.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.js +236 -231
- package/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/bibliotecas/biblioteca-global.d.ts.map +1 -1
- package/bin/package.json +1 -1
- package/construtos/atribuir.d.ts +3 -1
- package/construtos/atribuir.d.ts.map +1 -1
- package/construtos/atribuir.js +7 -1
- package/construtos/atribuir.js.map +1 -1
- package/construtos/binario.d.ts +18 -7
- package/construtos/binario.d.ts.map +1 -1
- package/construtos/binario.js +18 -7
- package/construtos/binario.js.map +1 -1
- package/construtos/expressao-regular.d.ts +1 -1
- package/construtos/expressao-regular.d.ts.map +1 -1
- package/construtos/index.d.ts +0 -1
- package/construtos/index.d.ts.map +1 -1
- package/construtos/index.js +0 -1
- package/construtos/index.js.map +1 -1
- package/construtos/vetor.d.ts +2 -1
- package/construtos/vetor.d.ts.map +1 -1
- package/construtos/vetor.js +7 -1
- package/construtos/vetor.js.map +1 -1
- package/estruturas/delegua-funcao.d.ts +1 -0
- package/estruturas/delegua-funcao.d.ts.map +1 -1
- package/estruturas/delegua-funcao.js +14 -7
- package/estruturas/delegua-funcao.js.map +1 -1
- package/interfaces/formatador-comum-interface.d.ts +12 -0
- package/interfaces/formatador-comum-interface.d.ts.map +1 -0
- package/interfaces/formatador-comum-interface.js +3 -0
- package/interfaces/formatador-comum-interface.js.map +1 -0
- package/interfaces/index.d.ts +1 -0
- package/interfaces/index.d.ts.map +1 -1
- package/interfaces/index.js +1 -0
- package/interfaces/index.js.map +1 -1
- package/interfaces/pilha-escopos-execucao-interface.d.ts +1 -1
- package/interfaces/pilha-escopos-execucao-interface.d.ts.map +1 -1
- package/interfaces/variavel-hipotetica-interface.d.ts +1 -0
- package/interfaces/variavel-hipotetica-interface.d.ts.map +1 -1
- package/interfaces/visitante-comum-interface.d.ts +21 -21
- package/interfaces/visitante-comum-interface.d.ts.map +1 -1
- package/interpretador/interpretador-base.d.ts +9 -2
- package/interpretador/interpretador-base.d.ts.map +1 -1
- package/interpretador/interpretador-base.js +22 -10
- package/interpretador/interpretador-base.js.map +1 -1
- package/interpretador/pilha-escopos-execucao.d.ts +1 -1
- package/interpretador/pilha-escopos-execucao.d.ts.map +1 -1
- package/interpretador/pilha-escopos-execucao.js +16 -6
- package/interpretador/pilha-escopos-execucao.js.map +1 -1
- package/package.json +1 -1
- package/tradutores/tradutor-javascript.d.ts +1 -1
- package/tradutores/tradutor-javascript.d.ts.map +1 -1
- package/tradutores/tradutor-javascript.js +8 -4
- package/tradutores/tradutor-javascript.js.map +1 -1
- package/umd/delegua.js +436 -398
- package/construtos/constante-ou-variavel.d.ts +0 -20
- package/construtos/constante-ou-variavel.d.ts.map +0 -1
- package/construtos/constante-ou-variavel.js +0 -26
- package/construtos/constante-ou-variavel.js.map +0 -1
package/umd/delegua.js
CHANGED
|
@@ -223,21 +223,21 @@ class AvaliadorSintaticoBase {
|
|
|
223
223
|
}
|
|
224
224
|
exports.AvaliadorSintaticoBase = AvaliadorSintaticoBase;
|
|
225
225
|
|
|
226
|
-
},{"../construtos":
|
|
226
|
+
},{"../construtos":39,"../declaracoes":77,"../tipos-de-simbolos/comum":156,"./erro-avaliador-sintatico":7}],2:[function(require,module,exports){
|
|
227
227
|
"use strict";
|
|
228
228
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
229
229
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
230
230
|
};
|
|
231
231
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
232
232
|
exports.AvaliadorSintatico = void 0;
|
|
233
|
-
const delegua_1 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
234
|
-
const delegua_2 = __importDefault(require("../tipos-de-dados/delegua"));
|
|
235
233
|
const browser_process_hrtime_1 = __importDefault(require("browser-process-hrtime"));
|
|
234
|
+
const delegua_1 = __importDefault(require("../tipos-de-dados/delegua"));
|
|
235
|
+
const delegua_2 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
236
236
|
const construtos_1 = require("../construtos");
|
|
237
237
|
const erro_avaliador_sintatico_1 = require("./erro-avaliador-sintatico");
|
|
238
|
+
const tuplas_1 = require("../construtos/tuplas");
|
|
238
239
|
const declaracoes_1 = require("../declaracoes");
|
|
239
240
|
const lexador_1 = require("../lexador");
|
|
240
|
-
const tuplas_1 = require("../construtos/tuplas");
|
|
241
241
|
/**
|
|
242
242
|
* O avaliador sintático (_Parser_) é responsável por transformar os símbolos do Lexador em estruturas de alto nível.
|
|
243
243
|
* Essas estruturas de alto nível são as partes que executam lógica de programação de fato.
|
|
@@ -273,13 +273,13 @@ class AvaliadorSintatico {
|
|
|
273
273
|
return this.simbolos[this.atual + 1].tipo === tipo;
|
|
274
274
|
}
|
|
275
275
|
verificarDefinicaoTipoAtual() {
|
|
276
|
-
const tipos = [...Object.values(
|
|
276
|
+
const tipos = [...Object.values(delegua_1.default)];
|
|
277
277
|
const lexema = this.simboloAtual().lexema.toLowerCase();
|
|
278
278
|
const contemTipo = tipos.find((tipo) => tipo === lexema);
|
|
279
|
-
if (contemTipo && this.verificarTipoProximoSimbolo(
|
|
279
|
+
if (contemTipo && this.verificarTipoProximoSimbolo(delegua_2.default.COLCHETE_ESQUERDO)) {
|
|
280
280
|
const tiposVetores = ['inteiro[]', 'numero[]', 'número[]', 'qualquer[]', 'real[]', 'texto[]'];
|
|
281
281
|
this.avancarEDevolverAnterior();
|
|
282
|
-
if (!this.verificarTipoProximoSimbolo(
|
|
282
|
+
if (!this.verificarTipoProximoSimbolo(delegua_2.default.COLCHETE_DIREITO)) {
|
|
283
283
|
throw this.erro(this.simbolos[this.atual], "Esperado símbolo de fechamento do vetor ']'.");
|
|
284
284
|
}
|
|
285
285
|
const contemTipoVetor = tiposVetores.find((tipo) => tipo === `${lexema}[]`);
|
|
@@ -316,124 +316,124 @@ class AvaliadorSintatico {
|
|
|
316
316
|
const simboloAtual = this.simbolos[this.atual];
|
|
317
317
|
let valores = [];
|
|
318
318
|
switch (simboloAtual.tipo) {
|
|
319
|
-
case
|
|
319
|
+
case delegua_2.default.CHAVE_ESQUERDA:
|
|
320
320
|
this.avancarEDevolverAnterior();
|
|
321
321
|
const chaves = [];
|
|
322
322
|
valores = [];
|
|
323
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
323
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_DIREITA)) {
|
|
324
324
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloAtual.linha), [], []);
|
|
325
325
|
}
|
|
326
|
-
while (!this.verificarSeSimboloAtualEIgualA(
|
|
326
|
+
while (!this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_DIREITA)) {
|
|
327
327
|
const chave = this.atribuir();
|
|
328
|
-
this.consumir(
|
|
328
|
+
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' entre chave e valor.");
|
|
329
329
|
const valor = this.atribuir();
|
|
330
330
|
chaves.push(chave);
|
|
331
331
|
valores.push(valor);
|
|
332
|
-
if (this.simbolos[this.atual].tipo !==
|
|
333
|
-
this.consumir(
|
|
332
|
+
if (this.simbolos[this.atual].tipo !== delegua_2.default.CHAVE_DIREITA) {
|
|
333
|
+
this.consumir(delegua_2.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloAtual.linha), chaves, valores);
|
|
337
|
-
case
|
|
337
|
+
case delegua_2.default.COLCHETE_ESQUERDO:
|
|
338
338
|
this.avancarEDevolverAnterior();
|
|
339
339
|
valores = [];
|
|
340
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
340
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.COLCHETE_DIREITO)) {
|
|
341
341
|
return new construtos_1.Vetor(this.hashArquivo, Number(simboloAtual.linha), []);
|
|
342
342
|
}
|
|
343
|
-
while (!this.verificarSeSimboloAtualEIgualA(
|
|
343
|
+
while (!this.verificarSeSimboloAtualEIgualA(delegua_2.default.COLCHETE_DIREITO)) {
|
|
344
344
|
let valor = null;
|
|
345
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
345
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.PARENTESE_ESQUERDO)) {
|
|
346
346
|
const expressao = this.expressao();
|
|
347
347
|
const argumentos = [expressao];
|
|
348
|
-
while (this.simbolos[this.atual].tipo ===
|
|
348
|
+
while (this.simbolos[this.atual].tipo === delegua_2.default.VIRGULA) {
|
|
349
349
|
this.avancarEDevolverAnterior();
|
|
350
350
|
argumentos.push(this.expressao());
|
|
351
351
|
}
|
|
352
|
-
this.consumir(
|
|
353
|
-
this.consumir(
|
|
352
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após a expressão.");
|
|
353
|
+
this.consumir(delegua_2.default.COLCHETE_DIREITO, "Esperado ']' após a expressão.");
|
|
354
354
|
return new tuplas_1.SeletorTuplas(...argumentos);
|
|
355
355
|
}
|
|
356
356
|
valor = this.atribuir();
|
|
357
357
|
valores.push(valor);
|
|
358
|
-
if (this.simbolos[this.atual].tipo !==
|
|
359
|
-
this.consumir(
|
|
358
|
+
if (this.simbolos[this.atual].tipo !== delegua_2.default.COLCHETE_DIREITO) {
|
|
359
|
+
this.consumir(delegua_2.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
return new construtos_1.Vetor(this.hashArquivo, Number(simboloAtual.linha), valores);
|
|
363
|
-
case
|
|
363
|
+
case delegua_2.default.FALSO:
|
|
364
364
|
this.avancarEDevolverAnterior();
|
|
365
365
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), false);
|
|
366
|
-
case
|
|
367
|
-
case
|
|
366
|
+
case delegua_2.default.FUNCAO:
|
|
367
|
+
case delegua_2.default.FUNÇÃO:
|
|
368
368
|
const simboloFuncao = this.avancarEDevolverAnterior();
|
|
369
369
|
return this.corpoDaFuncao(simboloFuncao.lexema);
|
|
370
|
-
case
|
|
370
|
+
case delegua_2.default.IDENTIFICADOR:
|
|
371
371
|
const simboloIdentificador = this.avancarEDevolverAnterior();
|
|
372
372
|
// Se o próximo símbolo é um incremento ou um decremento,
|
|
373
373
|
// aqui deve retornar um unário correspondente.
|
|
374
374
|
// Caso contrário, apenas retornar um construto de variável.
|
|
375
375
|
if (this.simbolos[this.atual] &&
|
|
376
|
-
[
|
|
376
|
+
[delegua_2.default.INCREMENTAR, delegua_2.default.DECREMENTAR].includes(this.simbolos[this.atual].tipo)) {
|
|
377
377
|
const simboloIncrementoDecremento = this.avancarEDevolverAnterior();
|
|
378
378
|
return new construtos_1.Unario(this.hashArquivo, simboloIncrementoDecremento, new construtos_1.Variavel(this.hashArquivo, simboloIdentificador), 'DEPOIS');
|
|
379
379
|
}
|
|
380
380
|
return new construtos_1.Variavel(this.hashArquivo, simboloIdentificador);
|
|
381
|
-
case
|
|
381
|
+
case delegua_2.default.IMPORTAR:
|
|
382
382
|
this.avancarEDevolverAnterior();
|
|
383
383
|
return this.declaracaoImportar();
|
|
384
|
-
case
|
|
384
|
+
case delegua_2.default.ISTO:
|
|
385
385
|
this.avancarEDevolverAnterior();
|
|
386
386
|
return new construtos_1.Isto(this.hashArquivo, Number(simboloAtual.linha), simboloAtual);
|
|
387
|
-
case
|
|
387
|
+
case delegua_2.default.NULO:
|
|
388
388
|
this.avancarEDevolverAnterior();
|
|
389
389
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), null);
|
|
390
|
-
case
|
|
391
|
-
case
|
|
390
|
+
case delegua_2.default.NUMERO:
|
|
391
|
+
case delegua_2.default.TEXTO:
|
|
392
392
|
const simboloNumeroTexto = this.avancarEDevolverAnterior();
|
|
393
393
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloNumeroTexto.linha), simboloNumeroTexto.literal);
|
|
394
|
-
case
|
|
394
|
+
case delegua_2.default.PARENTESE_ESQUERDO:
|
|
395
395
|
this.avancarEDevolverAnterior();
|
|
396
396
|
const expressao = this.expressao();
|
|
397
|
-
this.consumir(
|
|
397
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após a expressão.");
|
|
398
398
|
return new construtos_1.Agrupamento(this.hashArquivo, Number(simboloAtual.linha), expressao);
|
|
399
|
-
case
|
|
399
|
+
case delegua_2.default.SUPER:
|
|
400
400
|
const simboloSuper = this.avancarEDevolverAnterior();
|
|
401
401
|
// Se o próximo símbolo for uma abertura de parênteses, significa que
|
|
402
402
|
// é uma chamada ao construtor da classe ancestral (superclasse).
|
|
403
403
|
// Se o próximo símbolo for um ponto, significa que é uma chamada
|
|
404
404
|
// a um método da superclasse.
|
|
405
405
|
switch (this.simbolos[this.atual].tipo) {
|
|
406
|
-
case
|
|
407
|
-
return new construtos_1.Super(this.hashArquivo, simboloSuper, new lexador_1.Simbolo(
|
|
406
|
+
case delegua_2.default.PARENTESE_ESQUERDO:
|
|
407
|
+
return new construtos_1.Super(this.hashArquivo, simboloSuper, new lexador_1.Simbolo(delegua_2.default.IDENTIFICADOR, 'construtor', null, simboloSuper.linha, this.hashArquivo));
|
|
408
408
|
default:
|
|
409
|
-
this.consumir(
|
|
410
|
-
const metodoSuperclasse = this.consumir(
|
|
409
|
+
this.consumir(delegua_2.default.PONTO, "Esperado '.' após 'super'.");
|
|
410
|
+
const metodoSuperclasse = this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome do método da Superclasse.');
|
|
411
411
|
return new construtos_1.Super(this.hashArquivo, simboloSuper, metodoSuperclasse);
|
|
412
412
|
}
|
|
413
|
-
case
|
|
413
|
+
case delegua_2.default.VERDADEIRO:
|
|
414
414
|
this.avancarEDevolverAnterior();
|
|
415
415
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), true);
|
|
416
|
-
case
|
|
416
|
+
case delegua_2.default.TIPO:
|
|
417
417
|
this.avancarEDevolverAnterior();
|
|
418
|
-
this.consumir(
|
|
418
|
+
this.consumir(delegua_2.default.DE, "Esperado 'de' após 'tipo'.");
|
|
419
419
|
let _expressao;
|
|
420
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
420
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.ESCREVA, delegua_2.default.LEIA, delegua_2.default.FUNCAO, delegua_2.default.FUNÇÃO, delegua_2.default.SE, delegua_2.default.ENQUANTO, delegua_2.default.PARA, delegua_2.default.RETORNA, delegua_1.default.INTEIRO, delegua_1.default.TEXTO, delegua_1.default.VETOR, delegua_1.default.LOGICO, delegua_1.default.LÓGICO, delegua_1.default.VAZIO)) {
|
|
421
421
|
_expressao = this.simboloAnterior();
|
|
422
422
|
}
|
|
423
423
|
else {
|
|
424
424
|
_expressao = this.expressao();
|
|
425
425
|
}
|
|
426
426
|
return new construtos_1.TipoDe(this.hashArquivo, simboloAtual, _expressao instanceof construtos_1.Literal ? _expressao.valor : _expressao);
|
|
427
|
-
case
|
|
427
|
+
case delegua_2.default.EXPRESSAO_REGULAR:
|
|
428
428
|
let valor = '';
|
|
429
429
|
let linhaAtual = this.simbolos[this.atual].linha;
|
|
430
|
-
let eParExpressaoRegular = this.simbolos.filter((l) => l.linha === linhaAtual && l.tipo ===
|
|
430
|
+
let eParExpressaoRegular = this.simbolos.filter((l) => l.linha === linhaAtual && l.tipo === delegua_2.default.EXPRESSAO_REGULAR)
|
|
431
431
|
.length %
|
|
432
432
|
2 ===
|
|
433
433
|
0;
|
|
434
434
|
if (eParExpressaoRegular) {
|
|
435
435
|
this.avancarEDevolverAnterior();
|
|
436
|
-
while (!this.verificarTipoSimboloAtual(
|
|
436
|
+
while (!this.verificarTipoSimboloAtual(delegua_2.default.EXPRESSAO_REGULAR)) {
|
|
437
437
|
valor += this.simboloAtual().lexema || '';
|
|
438
438
|
this.avancarEDevolverAnterior();
|
|
439
439
|
}
|
|
@@ -445,30 +445,30 @@ class AvaliadorSintatico {
|
|
|
445
445
|
}
|
|
446
446
|
finalizarChamada(entidadeChamada) {
|
|
447
447
|
const argumentos = [];
|
|
448
|
-
if (!this.verificarTipoSimboloAtual(
|
|
448
|
+
if (!this.verificarTipoSimboloAtual(delegua_2.default.PARENTESE_DIREITO)) {
|
|
449
449
|
do {
|
|
450
450
|
if (argumentos.length >= 255) {
|
|
451
451
|
throw this.erro(this.simbolos[this.atual], 'Não pode haver mais de 255 argumentos.');
|
|
452
452
|
}
|
|
453
453
|
argumentos.push(this.expressao());
|
|
454
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
454
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
455
455
|
}
|
|
456
|
-
const parenteseDireito = this.consumir(
|
|
456
|
+
const parenteseDireito = this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após os argumentos.");
|
|
457
457
|
return new construtos_1.Chamada(this.hashArquivo, entidadeChamada, parenteseDireito, argumentos);
|
|
458
458
|
}
|
|
459
459
|
chamar() {
|
|
460
460
|
let expressao = this.primario();
|
|
461
461
|
while (true) {
|
|
462
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
462
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.PARENTESE_ESQUERDO)) {
|
|
463
463
|
expressao = this.finalizarChamada(expressao);
|
|
464
464
|
}
|
|
465
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
466
|
-
const nome = this.consumir(
|
|
465
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO)) {
|
|
466
|
+
const nome = this.consumir(delegua_2.default.IDENTIFICADOR, "Esperado nome de método ou propriedade após '.'.");
|
|
467
467
|
expressao = new construtos_1.AcessoMetodoOuPropriedade(this.hashArquivo, expressao, nome);
|
|
468
468
|
}
|
|
469
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
469
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.COLCHETE_ESQUERDO)) {
|
|
470
470
|
const indice = this.expressao();
|
|
471
|
-
const simboloFechamento = this.consumir(
|
|
471
|
+
const simboloFechamento = this.consumir(delegua_2.default.COLCHETE_DIREITO, "Esperado ']' após escrita do indice.");
|
|
472
472
|
expressao = new construtos_1.AcessoIndiceVariavel(this.hashArquivo, expressao, indice, simboloFechamento);
|
|
473
473
|
}
|
|
474
474
|
else {
|
|
@@ -478,7 +478,7 @@ class AvaliadorSintatico {
|
|
|
478
478
|
return expressao;
|
|
479
479
|
}
|
|
480
480
|
unario() {
|
|
481
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
481
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.NEGACAO, delegua_2.default.SUBTRACAO, delegua_2.default.BIT_NOT, delegua_2.default.INCREMENTAR, delegua_2.default.DECREMENTAR)) {
|
|
482
482
|
const operador = this.simbolos[this.atual - 1];
|
|
483
483
|
const direito = this.unario();
|
|
484
484
|
return new construtos_1.Unario(this.hashArquivo, operador, direito, 'ANTES');
|
|
@@ -487,7 +487,7 @@ class AvaliadorSintatico {
|
|
|
487
487
|
}
|
|
488
488
|
exponenciacao() {
|
|
489
489
|
let expressao = this.unario();
|
|
490
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
490
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.EXPONENCIACAO)) {
|
|
491
491
|
const operador = this.simbolos[this.atual - 1];
|
|
492
492
|
const direito = this.unario();
|
|
493
493
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -496,7 +496,7 @@ class AvaliadorSintatico {
|
|
|
496
496
|
}
|
|
497
497
|
multiplicar() {
|
|
498
498
|
let expressao = this.exponenciacao();
|
|
499
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
499
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.DIVISAO, delegua_2.default.DIVISAO_IGUAL, delegua_2.default.DIVISAO_INTEIRA, delegua_2.default.DIVISAO_INTEIRA_IGUAL, delegua_2.default.MODULO, delegua_2.default.MODULO_IGUAL, delegua_2.default.MULTIPLICACAO, delegua_2.default.MULTIPLICACAO_IGUAL)) {
|
|
500
500
|
const operador = this.simbolos[this.atual - 1];
|
|
501
501
|
const direito = this.exponenciacao();
|
|
502
502
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -510,7 +510,7 @@ class AvaliadorSintatico {
|
|
|
510
510
|
*/
|
|
511
511
|
adicaoOuSubtracao() {
|
|
512
512
|
let expressao = this.multiplicar();
|
|
513
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
513
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.SUBTRACAO, delegua_2.default.ADICAO, delegua_2.default.MAIS_IGUAL, delegua_2.default.MENOS_IGUAL)) {
|
|
514
514
|
const operador = this.simbolos[this.atual - 1];
|
|
515
515
|
const direito = this.multiplicar();
|
|
516
516
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -519,7 +519,7 @@ class AvaliadorSintatico {
|
|
|
519
519
|
}
|
|
520
520
|
bitShift() {
|
|
521
521
|
let expressao = this.adicaoOuSubtracao();
|
|
522
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
522
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.MENOR_MENOR, delegua_2.default.MAIOR_MAIOR)) {
|
|
523
523
|
const operador = this.simbolos[this.atual - 1];
|
|
524
524
|
const direito = this.adicaoOuSubtracao();
|
|
525
525
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -528,7 +528,7 @@ class AvaliadorSintatico {
|
|
|
528
528
|
}
|
|
529
529
|
bitE() {
|
|
530
530
|
let expressao = this.bitShift();
|
|
531
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
531
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.BIT_AND)) {
|
|
532
532
|
const operador = this.simbolos[this.atual - 1];
|
|
533
533
|
const direito = this.bitShift();
|
|
534
534
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -537,7 +537,7 @@ class AvaliadorSintatico {
|
|
|
537
537
|
}
|
|
538
538
|
bitOu() {
|
|
539
539
|
let expressao = this.bitE();
|
|
540
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
540
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.BIT_OR, delegua_2.default.BIT_XOR)) {
|
|
541
541
|
const operador = this.simbolos[this.atual - 1];
|
|
542
542
|
const direito = this.bitE();
|
|
543
543
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -546,7 +546,7 @@ class AvaliadorSintatico {
|
|
|
546
546
|
}
|
|
547
547
|
comparar() {
|
|
548
548
|
let expressao = this.bitOu();
|
|
549
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
549
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.MAIOR, delegua_2.default.MAIOR_IGUAL, delegua_2.default.MENOR, delegua_2.default.MENOR_IGUAL)) {
|
|
550
550
|
const operador = this.simbolos[this.atual - 1];
|
|
551
551
|
const direito = this.bitOu();
|
|
552
552
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -555,7 +555,7 @@ class AvaliadorSintatico {
|
|
|
555
555
|
}
|
|
556
556
|
comparacaoIgualdade() {
|
|
557
557
|
let expressao = this.comparar();
|
|
558
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
558
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.DIFERENTE, delegua_2.default.IGUAL_IGUAL)) {
|
|
559
559
|
const operador = this.simbolos[this.atual - 1];
|
|
560
560
|
const direito = this.comparar();
|
|
561
561
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
@@ -564,7 +564,7 @@ class AvaliadorSintatico {
|
|
|
564
564
|
}
|
|
565
565
|
em() {
|
|
566
566
|
let expressao = this.comparacaoIgualdade();
|
|
567
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
567
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.EM)) {
|
|
568
568
|
const operador = this.simbolos[this.atual - 1];
|
|
569
569
|
const direito = this.comparacaoIgualdade();
|
|
570
570
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
@@ -573,7 +573,7 @@ class AvaliadorSintatico {
|
|
|
573
573
|
}
|
|
574
574
|
e() {
|
|
575
575
|
let expressao = this.em();
|
|
576
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
576
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.E)) {
|
|
577
577
|
const operador = this.simbolos[this.atual - 1];
|
|
578
578
|
const direito = this.em();
|
|
579
579
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
@@ -582,7 +582,7 @@ class AvaliadorSintatico {
|
|
|
582
582
|
}
|
|
583
583
|
ou() {
|
|
584
584
|
let expressao = this.e();
|
|
585
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
585
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.OU)) {
|
|
586
586
|
const operador = this.simbolos[this.atual - 1];
|
|
587
587
|
const direito = this.e();
|
|
588
588
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
@@ -597,16 +597,21 @@ class AvaliadorSintatico {
|
|
|
597
597
|
const expressao = this.ou();
|
|
598
598
|
if (expressao instanceof construtos_1.Binario &&
|
|
599
599
|
[
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
600
|
+
delegua_2.default.MAIS_IGUAL,
|
|
601
|
+
delegua_2.default.MENOS_IGUAL,
|
|
602
|
+
delegua_2.default.MULTIPLICACAO_IGUAL,
|
|
603
|
+
delegua_2.default.DIVISAO_IGUAL,
|
|
604
|
+
delegua_2.default.DIVISAO_INTEIRA_IGUAL,
|
|
605
|
+
delegua_2.default.MODULO_IGUAL,
|
|
606
606
|
].includes(expressao.operador.tipo)) {
|
|
607
|
-
|
|
607
|
+
let simbolo = expressao.esquerda.simbolo;
|
|
608
|
+
if (expressao.esquerda instanceof construtos_1.AcessoIndiceVariavel) {
|
|
609
|
+
simbolo = expressao.esquerda.entidadeChamada.simbolo;
|
|
610
|
+
return new construtos_1.Atribuir(this.hashArquivo, simbolo, expressao, expressao.esquerda.indice);
|
|
611
|
+
}
|
|
612
|
+
return new construtos_1.Atribuir(this.hashArquivo, simbolo, expressao);
|
|
608
613
|
}
|
|
609
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
614
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.IGUAL)) {
|
|
610
615
|
const igual = this.simbolos[this.atual - 1];
|
|
611
616
|
const valor = this.expressao();
|
|
612
617
|
if (expressao instanceof construtos_1.Variavel) {
|
|
@@ -625,13 +630,13 @@ class AvaliadorSintatico {
|
|
|
625
630
|
return expressao;
|
|
626
631
|
}
|
|
627
632
|
expressao() {
|
|
628
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
633
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.LEIA))
|
|
629
634
|
return this.declaracaoLeia();
|
|
630
635
|
return this.atribuir();
|
|
631
636
|
}
|
|
632
637
|
blocoEscopo() {
|
|
633
638
|
let declaracoes = [];
|
|
634
|
-
while (!this.verificarTipoSimboloAtual(
|
|
639
|
+
while (!this.verificarTipoSimboloAtual(delegua_2.default.CHAVE_DIREITA) && !this.estaNoFinal()) {
|
|
635
640
|
const retornoDeclaracao = this.resolverDeclaracaoForaDeBloco();
|
|
636
641
|
if (Array.isArray(retornoDeclaracao)) {
|
|
637
642
|
declaracoes = declaracoes.concat(retornoDeclaracao);
|
|
@@ -640,8 +645,8 @@ class AvaliadorSintatico {
|
|
|
640
645
|
declaracoes.push(retornoDeclaracao);
|
|
641
646
|
}
|
|
642
647
|
}
|
|
643
|
-
this.consumir(
|
|
644
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
648
|
+
this.consumir(delegua_2.default.CHAVE_DIREITA, "Esperado '}' após o bloco.");
|
|
649
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
645
650
|
return declaracoes;
|
|
646
651
|
}
|
|
647
652
|
declaracaoEnquanto() {
|
|
@@ -657,22 +662,22 @@ class AvaliadorSintatico {
|
|
|
657
662
|
}
|
|
658
663
|
declaracaoEscreva() {
|
|
659
664
|
const simboloAtual = this.simbolos[this.atual];
|
|
660
|
-
this.consumir(
|
|
665
|
+
this.consumir(delegua_2.default.PARENTESE_ESQUERDO, "Esperado '(' antes dos valores em escreva.");
|
|
661
666
|
const argumentos = [];
|
|
662
|
-
if (!this.verificarTipoSimboloAtual(
|
|
667
|
+
if (!this.verificarTipoSimboloAtual(delegua_2.default.PARENTESE_DIREITO)) {
|
|
663
668
|
do {
|
|
664
669
|
argumentos.push(this.expressao());
|
|
665
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
670
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
666
671
|
}
|
|
667
|
-
this.consumir(
|
|
672
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após os valores em escreva.");
|
|
668
673
|
// Ponto-e-vírgula é opcional aqui.
|
|
669
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
674
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
670
675
|
return new declaracoes_1.Escreva(Number(simboloAtual.linha), simboloAtual.hashArquivo, argumentos);
|
|
671
676
|
}
|
|
672
677
|
declaracaoExpressao() {
|
|
673
678
|
const expressao = this.expressao();
|
|
674
679
|
// Ponto-e-vírgula é opcional aqui.
|
|
675
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
680
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
676
681
|
return new declaracoes_1.Expressao(expressao);
|
|
677
682
|
}
|
|
678
683
|
declaracaoComentarioMultilinha() {
|
|
@@ -681,7 +686,7 @@ class AvaliadorSintatico {
|
|
|
681
686
|
do {
|
|
682
687
|
simboloComentario = this.avancarEDevolverAnterior();
|
|
683
688
|
conteudos.push(simboloComentario.literal);
|
|
684
|
-
} while (simboloComentario.tipo ===
|
|
689
|
+
} while (simboloComentario.tipo === delegua_2.default.LINHA_COMENTARIO);
|
|
685
690
|
return new construtos_1.Comentario(simboloComentario.hashArquivo, simboloComentario.linha, conteudos, true);
|
|
686
691
|
}
|
|
687
692
|
declaracaoComentarioUmaLinha() {
|
|
@@ -693,24 +698,24 @@ class AvaliadorSintatico {
|
|
|
693
698
|
this.erro(this.simbolos[this.atual - 1], "'continua' precisa estar em um laço de repetição.");
|
|
694
699
|
}
|
|
695
700
|
// Ponto-e-vírgula é opcional aqui.
|
|
696
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
701
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
697
702
|
return new declaracoes_1.Continua(this.simbolos[this.atual - 1]);
|
|
698
703
|
}
|
|
699
704
|
declaracaoEscolha() {
|
|
700
705
|
try {
|
|
701
706
|
this.blocos += 1;
|
|
702
707
|
const condicao = this.expressao();
|
|
703
|
-
this.consumir(
|
|
708
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo do 'escolha'.");
|
|
704
709
|
const caminhos = [];
|
|
705
710
|
let caminhoPadrao = null;
|
|
706
|
-
while (!this.verificarSeSimboloAtualEIgualA(
|
|
707
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
711
|
+
while (!this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_DIREITA) && !this.estaNoFinal()) {
|
|
712
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CASO)) {
|
|
708
713
|
const caminhoCondicoes = [this.expressao()];
|
|
709
|
-
this.consumir(
|
|
710
|
-
while (this.verificarTipoSimboloAtual(
|
|
711
|
-
this.consumir(
|
|
714
|
+
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' após o 'caso'.");
|
|
715
|
+
while (this.verificarTipoSimboloAtual(delegua_2.default.CASO)) {
|
|
716
|
+
this.consumir(delegua_2.default.CASO, null);
|
|
712
717
|
caminhoCondicoes.push(this.expressao());
|
|
713
|
-
this.consumir(
|
|
718
|
+
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' após declaração do 'caso'.");
|
|
714
719
|
}
|
|
715
720
|
let declaracoes = [];
|
|
716
721
|
do {
|
|
@@ -721,27 +726,27 @@ class AvaliadorSintatico {
|
|
|
721
726
|
else {
|
|
722
727
|
declaracoes.push(retornoDeclaracao);
|
|
723
728
|
}
|
|
724
|
-
} while (!this.verificarTipoSimboloAtual(
|
|
725
|
-
!this.verificarTipoSimboloAtual(
|
|
726
|
-
!this.verificarTipoSimboloAtual(
|
|
729
|
+
} while (!this.verificarTipoSimboloAtual(delegua_2.default.CASO) &&
|
|
730
|
+
!this.verificarTipoSimboloAtual(delegua_2.default.PADRAO) &&
|
|
731
|
+
!this.verificarTipoSimboloAtual(delegua_2.default.CHAVE_DIREITA));
|
|
727
732
|
caminhos.push({
|
|
728
733
|
condicoes: caminhoCondicoes,
|
|
729
734
|
declaracoes,
|
|
730
735
|
});
|
|
731
736
|
}
|
|
732
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
737
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.PADRAO)) {
|
|
733
738
|
if (caminhoPadrao !== null) {
|
|
734
739
|
const excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(this.simbolos[this.atual], "Você só pode ter um 'padrao' em cada declaração de 'escolha'.");
|
|
735
740
|
this.erros.push(excecao);
|
|
736
741
|
throw excecao;
|
|
737
742
|
}
|
|
738
|
-
this.consumir(
|
|
743
|
+
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' após declaração do 'padrao'.");
|
|
739
744
|
const declaracoes = [];
|
|
740
745
|
do {
|
|
741
746
|
declaracoes.push(this.resolverDeclaracao());
|
|
742
|
-
} while (!this.verificarTipoSimboloAtual(
|
|
743
|
-
!this.verificarTipoSimboloAtual(
|
|
744
|
-
!this.verificarTipoSimboloAtual(
|
|
747
|
+
} while (!this.verificarTipoSimboloAtual(delegua_2.default.CASO) &&
|
|
748
|
+
!this.verificarTipoSimboloAtual(delegua_2.default.PADRAO) &&
|
|
749
|
+
!this.verificarTipoSimboloAtual(delegua_2.default.CHAVE_DIREITA));
|
|
745
750
|
caminhoPadrao = {
|
|
746
751
|
declaracoes,
|
|
747
752
|
};
|
|
@@ -762,7 +767,7 @@ class AvaliadorSintatico {
|
|
|
762
767
|
try {
|
|
763
768
|
this.blocos += 1;
|
|
764
769
|
const caminhoFazer = this.resolverDeclaracao();
|
|
765
|
-
this.consumir(
|
|
770
|
+
this.consumir(delegua_2.default.ENQUANTO, "Esperado declaração do 'enquanto' após o escopo do 'fazer'.");
|
|
766
771
|
const condicaoEnquanto = this.expressao();
|
|
767
772
|
return new declaracoes_1.Fazer(simboloFazer.hashArquivo, Number(simboloFazer.linha), caminhoFazer, condicaoEnquanto);
|
|
768
773
|
}
|
|
@@ -771,9 +776,9 @@ class AvaliadorSintatico {
|
|
|
771
776
|
}
|
|
772
777
|
}
|
|
773
778
|
declaracaoImportar() {
|
|
774
|
-
this.consumir(
|
|
779
|
+
this.consumir(delegua_2.default.PARENTESE_ESQUERDO, "Esperado '(' após declaração.");
|
|
775
780
|
const caminho = this.expressao();
|
|
776
|
-
const simboloFechamento = this.consumir(
|
|
781
|
+
const simboloFechamento = this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após declaração.");
|
|
777
782
|
return new declaracoes_1.Importar(caminho, simboloFechamento);
|
|
778
783
|
}
|
|
779
784
|
/**
|
|
@@ -782,21 +787,21 @@ class AvaliadorSintatico {
|
|
|
782
787
|
*/
|
|
783
788
|
declaracaoLeia() {
|
|
784
789
|
const simboloLeia = this.simbolos[this.atual];
|
|
785
|
-
this.consumir(
|
|
790
|
+
this.consumir(delegua_2.default.PARENTESE_ESQUERDO, "Esperado '(' antes dos argumentos em instrução `leia`.");
|
|
786
791
|
const argumentos = [];
|
|
787
|
-
if (this.simbolos[this.atual].tipo !==
|
|
792
|
+
if (this.simbolos[this.atual].tipo !== delegua_2.default.PARENTESE_DIREITO) {
|
|
788
793
|
do {
|
|
789
794
|
argumentos.push(this.expressao());
|
|
790
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
795
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
791
796
|
}
|
|
792
|
-
this.consumir(
|
|
797
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após os argumentos em instrução `leia`.");
|
|
793
798
|
return new declaracoes_1.Leia(simboloLeia, argumentos);
|
|
794
799
|
}
|
|
795
800
|
declaracaoPara() {
|
|
796
801
|
try {
|
|
797
802
|
const simboloPara = this.simbolos[this.atual - 1];
|
|
798
803
|
this.blocos += 1;
|
|
799
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
804
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CADA)) {
|
|
800
805
|
return this.declaracaoParaCada(simboloPara);
|
|
801
806
|
}
|
|
802
807
|
return this.declaracaoParaTradicional(simboloPara);
|
|
@@ -806,8 +811,8 @@ class AvaliadorSintatico {
|
|
|
806
811
|
}
|
|
807
812
|
}
|
|
808
813
|
declaracaoParaCada(simboloPara) {
|
|
809
|
-
const nomeVariavelIteracao = this.consumir(
|
|
810
|
-
if (!this.verificarSeSimboloAtualEIgualA(
|
|
814
|
+
const nomeVariavelIteracao = this.consumir(delegua_2.default.IDENTIFICADOR, "Esperado identificador de variável de iteração para instrução 'para cada'.");
|
|
815
|
+
if (!this.verificarSeSimboloAtualEIgualA(delegua_2.default.DE, delegua_2.default.EM)) {
|
|
811
816
|
throw this.erro(this.simbolos[this.atual], "Esperado palavras reservadas 'em' ou 'de' após variável de iteração em instrução 'para cada'.");
|
|
812
817
|
}
|
|
813
818
|
const vetor = this.expressao();
|
|
@@ -815,33 +820,33 @@ class AvaliadorSintatico {
|
|
|
815
820
|
return new declaracoes_1.ParaCada(this.hashArquivo, Number(simboloPara.linha), nomeVariavelIteracao.lexema, vetor, corpo);
|
|
816
821
|
}
|
|
817
822
|
declaracaoParaTradicional(simboloPara) {
|
|
818
|
-
const comParenteses = this.verificarSeSimboloAtualEIgualA(
|
|
823
|
+
const comParenteses = this.verificarSeSimboloAtualEIgualA(delegua_2.default.PARENTESE_ESQUERDO);
|
|
819
824
|
let inicializador;
|
|
820
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
825
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA)) {
|
|
821
826
|
inicializador = null;
|
|
822
827
|
}
|
|
823
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
828
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VARIAVEL)) {
|
|
824
829
|
inicializador = this.declaracaoDeVariaveis();
|
|
825
830
|
}
|
|
826
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
831
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CONSTANTE)) {
|
|
827
832
|
inicializador = this.declaracaoDeConstantes();
|
|
828
833
|
}
|
|
829
834
|
else {
|
|
830
835
|
inicializador = this.declaracaoExpressao();
|
|
831
836
|
}
|
|
832
837
|
let condicao = null;
|
|
833
|
-
if (!this.verificarTipoSimboloAtual(
|
|
838
|
+
if (!this.verificarTipoSimboloAtual(delegua_2.default.PONTO_E_VIRGULA)) {
|
|
834
839
|
condicao = this.expressao();
|
|
835
840
|
}
|
|
836
841
|
// Ponto-e-vírgula é opcional aqui.
|
|
837
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
842
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
838
843
|
let incrementar = null;
|
|
839
|
-
if (!this.verificarTipoSimboloAtual(
|
|
844
|
+
if (!this.verificarTipoSimboloAtual(delegua_2.default.PARENTESE_DIREITO)) {
|
|
840
845
|
incrementar = this.expressao();
|
|
841
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
846
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.INCREMENTAR, delegua_2.default.DECREMENTAR);
|
|
842
847
|
}
|
|
843
848
|
if (comParenteses) {
|
|
844
|
-
this.consumir(
|
|
849
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após cláusulas de inicialização, condição e incremento.");
|
|
845
850
|
}
|
|
846
851
|
const corpo = this.resolverDeclaracao();
|
|
847
852
|
return new declaracoes_1.Para(this.hashArquivo, Number(simboloPara.linha), inicializador, condicao, incrementar, corpo);
|
|
@@ -850,30 +855,30 @@ class AvaliadorSintatico {
|
|
|
850
855
|
const simboloChave = this.simbolos[this.atual - 1];
|
|
851
856
|
let valor = null;
|
|
852
857
|
if ([
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
858
|
+
delegua_2.default.CHAVE_ESQUERDA,
|
|
859
|
+
delegua_2.default.COLCHETE_ESQUERDO,
|
|
860
|
+
delegua_2.default.FALSO,
|
|
861
|
+
delegua_2.default.IDENTIFICADOR,
|
|
862
|
+
delegua_2.default.ISTO,
|
|
863
|
+
delegua_2.default.NEGACAO,
|
|
864
|
+
delegua_2.default.NUMERO,
|
|
865
|
+
delegua_2.default.NULO,
|
|
866
|
+
delegua_2.default.PARENTESE_ESQUERDO,
|
|
867
|
+
delegua_2.default.SUPER,
|
|
868
|
+
delegua_2.default.TEXTO,
|
|
869
|
+
delegua_2.default.VERDADEIRO,
|
|
865
870
|
].includes(this.simbolos[this.atual].tipo)) {
|
|
866
871
|
valor = this.expressao();
|
|
867
872
|
}
|
|
868
873
|
// Ponto-e-vírgula é opcional aqui.
|
|
869
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
874
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
870
875
|
return new declaracoes_1.Retorna(simboloChave, valor);
|
|
871
876
|
}
|
|
872
877
|
declaracaoSe() {
|
|
873
878
|
const condicao = this.expressao();
|
|
874
879
|
const caminhoEntao = this.resolverDeclaracao();
|
|
875
880
|
let caminhoSenao = null;
|
|
876
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
881
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.SENAO, delegua_2.default.SENÃO)) {
|
|
877
882
|
caminhoSenao = this.resolverDeclaracao();
|
|
878
883
|
}
|
|
879
884
|
return new declaracoes_1.Se(condicao, caminhoEntao, [], caminhoSenao);
|
|
@@ -883,16 +888,16 @@ class AvaliadorSintatico {
|
|
|
883
888
|
this.erro(this.simbolos[this.atual - 1], "'sustar' ou 'pausa' deve estar dentro de um laço de repetição.");
|
|
884
889
|
}
|
|
885
890
|
// Ponto-e-vírgula é opcional aqui.
|
|
886
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
891
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
887
892
|
return new declaracoes_1.Sustar(this.simbolos[this.atual - 1]);
|
|
888
893
|
}
|
|
889
894
|
declaracaoTente() {
|
|
890
895
|
const simboloTente = this.simbolos[this.atual - 1];
|
|
891
|
-
this.consumir(
|
|
896
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'tente'.");
|
|
892
897
|
const blocoTente = this.blocoEscopo();
|
|
893
898
|
let blocoPegue = null;
|
|
894
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
895
|
-
if (this.verificarTipoSimboloAtual(
|
|
899
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.PEGUE)) {
|
|
900
|
+
if (this.verificarTipoSimboloAtual(delegua_2.default.PARENTESE_ESQUERDO)) {
|
|
896
901
|
// Caso 1: com parâmetro de erro.
|
|
897
902
|
// `pegue` recebe um `FuncaoConstruto`.
|
|
898
903
|
blocoPegue = this.corpoDaFuncao('bloco `pegue`');
|
|
@@ -900,25 +905,25 @@ class AvaliadorSintatico {
|
|
|
900
905
|
else {
|
|
901
906
|
// Caso 2: sem parâmetro de erro.
|
|
902
907
|
// `pegue` recebe um bloco.
|
|
903
|
-
this.consumir(
|
|
908
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'pegue'.");
|
|
904
909
|
blocoPegue = this.blocoEscopo();
|
|
905
910
|
}
|
|
906
911
|
}
|
|
907
912
|
let blocoSenao = null;
|
|
908
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
909
|
-
this.consumir(
|
|
913
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.SENAO, delegua_2.default.SENÃO)) {
|
|
914
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'senão'.");
|
|
910
915
|
blocoSenao = this.blocoEscopo();
|
|
911
916
|
}
|
|
912
917
|
let blocoFinalmente = null;
|
|
913
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
914
|
-
this.consumir(
|
|
918
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.FINALMENTE)) {
|
|
919
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'finalmente'.");
|
|
915
920
|
blocoFinalmente = this.blocoEscopo();
|
|
916
921
|
}
|
|
917
922
|
return new declaracoes_1.Tente(simboloTente.hashArquivo, Number(simboloTente.linha), blocoTente, blocoPegue, blocoSenao, blocoFinalmente);
|
|
918
923
|
}
|
|
919
924
|
resolverDecorador() {
|
|
920
925
|
this.pilhaDecoradores = [];
|
|
921
|
-
while (this.verificarTipoSimboloAtual(
|
|
926
|
+
while (this.verificarTipoSimboloAtual(delegua_2.default.ARROBA)) {
|
|
922
927
|
let nomeDecorador = '';
|
|
923
928
|
let linha;
|
|
924
929
|
let parametros = [];
|
|
@@ -926,12 +931,12 @@ class AvaliadorSintatico {
|
|
|
926
931
|
linha = this.simbolos[this.atual].linha;
|
|
927
932
|
let simbolosLinhaAtual = this.simbolos.filter((l) => l.linha === linha);
|
|
928
933
|
for (let simbolo of simbolosLinhaAtual) {
|
|
929
|
-
parenteseEsquerdo = this.verificarSeSimboloAtualEIgualA(
|
|
934
|
+
parenteseEsquerdo = this.verificarSeSimboloAtualEIgualA(delegua_2.default.PARENTESE_ESQUERDO);
|
|
930
935
|
if (parenteseEsquerdo) {
|
|
931
|
-
if (!this.verificarTipoSimboloAtual(
|
|
936
|
+
if (!this.verificarTipoSimboloAtual(delegua_2.default.PARENTESE_DIREITO)) {
|
|
932
937
|
parametros = this.logicaComumParametros();
|
|
933
938
|
}
|
|
934
|
-
this.consumir(
|
|
939
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após parâmetros.");
|
|
935
940
|
break;
|
|
936
941
|
}
|
|
937
942
|
this.avancarEDevolverAnterior();
|
|
@@ -950,65 +955,65 @@ class AvaliadorSintatico {
|
|
|
950
955
|
*/
|
|
951
956
|
resolverDeclaracao() {
|
|
952
957
|
switch (this.simbolos[this.atual].tipo) {
|
|
953
|
-
case
|
|
958
|
+
case delegua_2.default.CHAVE_ESQUERDA:
|
|
954
959
|
const simboloInicioBloco = this.avancarEDevolverAnterior();
|
|
955
960
|
return new declaracoes_1.Bloco(simboloInicioBloco.hashArquivo, Number(simboloInicioBloco.linha), this.blocoEscopo());
|
|
956
|
-
case
|
|
961
|
+
case delegua_2.default.COMENTARIO:
|
|
957
962
|
return this.declaracaoComentarioUmaLinha();
|
|
958
|
-
case
|
|
963
|
+
case delegua_2.default.CONSTANTE:
|
|
959
964
|
this.avancarEDevolverAnterior();
|
|
960
965
|
return this.declaracaoDeConstantes();
|
|
961
|
-
case
|
|
966
|
+
case delegua_2.default.CONTINUA:
|
|
962
967
|
this.avancarEDevolverAnterior();
|
|
963
968
|
return this.declaracaoContinua();
|
|
964
|
-
case
|
|
969
|
+
case delegua_2.default.ENQUANTO:
|
|
965
970
|
this.avancarEDevolverAnterior();
|
|
966
971
|
return this.declaracaoEnquanto();
|
|
967
|
-
case
|
|
972
|
+
case delegua_2.default.ESCOLHA:
|
|
968
973
|
this.avancarEDevolverAnterior();
|
|
969
974
|
return this.declaracaoEscolha();
|
|
970
|
-
case
|
|
975
|
+
case delegua_2.default.ESCREVA:
|
|
971
976
|
this.avancarEDevolverAnterior();
|
|
972
977
|
return this.declaracaoEscreva();
|
|
973
|
-
case
|
|
978
|
+
case delegua_2.default.FALHAR:
|
|
974
979
|
this.avancarEDevolverAnterior();
|
|
975
980
|
return this.declaracaoFalhar();
|
|
976
|
-
case
|
|
981
|
+
case delegua_2.default.FAZER:
|
|
977
982
|
this.avancarEDevolverAnterior();
|
|
978
983
|
return this.declaracaoFazer();
|
|
979
|
-
case
|
|
984
|
+
case delegua_2.default.LINHA_COMENTARIO:
|
|
980
985
|
return this.declaracaoComentarioMultilinha();
|
|
981
|
-
case
|
|
986
|
+
case delegua_2.default.PARA:
|
|
982
987
|
this.avancarEDevolverAnterior();
|
|
983
988
|
return this.declaracaoPara();
|
|
984
|
-
case
|
|
985
|
-
case
|
|
989
|
+
case delegua_2.default.PAUSA:
|
|
990
|
+
case delegua_2.default.SUSTAR:
|
|
986
991
|
this.avancarEDevolverAnterior();
|
|
987
992
|
return this.declaracaoSustar();
|
|
988
|
-
case
|
|
993
|
+
case delegua_2.default.SE:
|
|
989
994
|
this.avancarEDevolverAnterior();
|
|
990
995
|
return this.declaracaoSe();
|
|
991
|
-
case
|
|
996
|
+
case delegua_2.default.RETORNA:
|
|
992
997
|
this.avancarEDevolverAnterior();
|
|
993
998
|
return this.declaracaoRetorna();
|
|
994
|
-
case
|
|
999
|
+
case delegua_2.default.TENDO:
|
|
995
1000
|
this.avancarEDevolverAnterior();
|
|
996
1001
|
return this.declaracaoTendoComo();
|
|
997
|
-
case
|
|
1002
|
+
case delegua_2.default.TENTE:
|
|
998
1003
|
this.avancarEDevolverAnterior();
|
|
999
1004
|
return this.declaracaoTente();
|
|
1000
|
-
case
|
|
1005
|
+
case delegua_2.default.VARIAVEL:
|
|
1001
1006
|
this.avancarEDevolverAnterior();
|
|
1002
1007
|
return this.declaracaoDeVariaveis();
|
|
1003
1008
|
}
|
|
1004
1009
|
const simboloAtual = this.simbolos[this.atual];
|
|
1005
|
-
if (simboloAtual.tipo ===
|
|
1010
|
+
if (simboloAtual.tipo === delegua_2.default.IDENTIFICADOR) {
|
|
1006
1011
|
// Pela gramática, a seguinte situação não pode ocorrer:
|
|
1007
1012
|
// 1. O símbolo anterior ser um identificador; e
|
|
1008
1013
|
// 2. O símbolo anterior estar na mesma linha do identificador atual.
|
|
1009
1014
|
const simboloAnterior = this.simbolos[this.atual - 1];
|
|
1010
1015
|
if (!!simboloAnterior &&
|
|
1011
|
-
simboloAnterior.tipo ===
|
|
1016
|
+
simboloAnterior.tipo === delegua_2.default.IDENTIFICADOR &&
|
|
1012
1017
|
simboloAnterior.linha === simboloAtual.linha) {
|
|
1013
1018
|
this.erro(this.simbolos[this.atual], 'Não é permitido ter dois identificadores seguidos na mesma linha.');
|
|
1014
1019
|
}
|
|
@@ -1018,19 +1023,19 @@ class AvaliadorSintatico {
|
|
|
1018
1023
|
declaracaoTendoComo() {
|
|
1019
1024
|
const simboloTendo = this.simbolos[this.atual - 1];
|
|
1020
1025
|
const expressaoInicializacao = this.expressao();
|
|
1021
|
-
this.consumir(
|
|
1022
|
-
const simboloNomeVariavel = this.consumir(
|
|
1023
|
-
this.consumir(
|
|
1026
|
+
this.consumir(delegua_2.default.COMO, "Esperado palavra reservada 'como' após expressão de inicialização de variável, em declaração 'tendo'.");
|
|
1027
|
+
const simboloNomeVariavel = this.consumir(delegua_2.default.IDENTIFICADOR, "Esperado nome do identificador em declaração 'tendo'.");
|
|
1028
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado chave esquerda para abertura de bloco em declaração 'tendo'.");
|
|
1024
1029
|
const blocoCorpo = this.blocoEscopo();
|
|
1025
1030
|
return new declaracoes_1.TendoComo(simboloTendo.linha, simboloTendo.hashArquivo, simboloNomeVariavel, expressaoInicializacao, new declaracoes_1.Bloco(simboloTendo.linha, simboloTendo.hashArquivo, blocoCorpo));
|
|
1026
1031
|
}
|
|
1027
1032
|
declaracaoDesestruturacaoVariavel() {
|
|
1028
1033
|
const identificadores = [];
|
|
1029
1034
|
do {
|
|
1030
|
-
identificadores.push(this.consumir(
|
|
1031
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1032
|
-
this.consumir(
|
|
1033
|
-
this.consumir(
|
|
1035
|
+
identificadores.push(this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome da variável.'));
|
|
1036
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1037
|
+
this.consumir(delegua_2.default.CHAVE_DIREITA, 'Esperado chave direita para concluir relação de variáveis a serem desestruturadas.');
|
|
1038
|
+
this.consumir(delegua_2.default.IGUAL, 'Esperado igual após relação de propriedades da desestruturação.');
|
|
1034
1039
|
const inicializador = this.expressao();
|
|
1035
1040
|
// TODO: Para cada variável dos identificadores, emitir um `AcessoMetodoOuPropriedade` usando
|
|
1036
1041
|
// como prefixo o nome do inicializador, e o sufixo o nome de cada propriedade.
|
|
@@ -1048,45 +1053,45 @@ class AvaliadorSintatico {
|
|
|
1048
1053
|
const identificadores = [];
|
|
1049
1054
|
let retorno = [];
|
|
1050
1055
|
let tipo = null;
|
|
1051
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1056
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_ESQUERDA)) {
|
|
1052
1057
|
return this.declaracaoDesestruturacaoVariavel();
|
|
1053
1058
|
}
|
|
1054
1059
|
do {
|
|
1055
|
-
identificadores.push(this.consumir(
|
|
1056
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1057
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1060
|
+
identificadores.push(this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome da variável.'));
|
|
1061
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1062
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.DOIS_PONTOS)) {
|
|
1058
1063
|
tipo = this.verificarDefinicaoTipoAtual();
|
|
1059
1064
|
this.avancarEDevolverAnterior();
|
|
1060
1065
|
}
|
|
1061
|
-
if (!this.verificarSeSimboloAtualEIgualA(
|
|
1066
|
+
if (!this.verificarSeSimboloAtualEIgualA(delegua_2.default.IGUAL)) {
|
|
1062
1067
|
// Inicialização de variáveis sem valor.
|
|
1063
1068
|
for (let [indice, identificador] of identificadores.entries()) {
|
|
1064
1069
|
retorno.push(new declaracoes_1.Var(identificador, null, tipo));
|
|
1065
1070
|
}
|
|
1066
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
1071
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
1067
1072
|
return retorno;
|
|
1068
1073
|
}
|
|
1069
1074
|
const inicializadores = [];
|
|
1070
1075
|
do {
|
|
1071
1076
|
inicializadores.push(this.expressao());
|
|
1072
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1077
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1073
1078
|
if (identificadores.length !== inicializadores.length) {
|
|
1074
1079
|
throw this.erro(this.simboloAtual(), 'Quantidade de identificadores à esquerda do igual é diferente da quantidade de valores à direita.');
|
|
1075
1080
|
}
|
|
1076
1081
|
for (let [indice, identificador] of identificadores.entries()) {
|
|
1077
|
-
tipo = inicializadores[indice] instanceof tuplas_1.Tupla ?
|
|
1082
|
+
tipo = inicializadores[indice] instanceof tuplas_1.Tupla ? delegua_1.default.TUPLA : tipo;
|
|
1078
1083
|
retorno.push(new declaracoes_1.Var(identificador, inicializadores[indice], tipo));
|
|
1079
1084
|
}
|
|
1080
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
1085
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
1081
1086
|
return retorno;
|
|
1082
1087
|
}
|
|
1083
1088
|
declaracaoDesestruturacaoConstante() {
|
|
1084
1089
|
const identificadores = [];
|
|
1085
1090
|
do {
|
|
1086
|
-
identificadores.push(this.consumir(
|
|
1087
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1088
|
-
this.consumir(
|
|
1089
|
-
this.consumir(
|
|
1091
|
+
identificadores.push(this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome da variável.'));
|
|
1092
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1093
|
+
this.consumir(delegua_2.default.CHAVE_DIREITA, 'Esperado chave direita para concluir relação de variáveis a serem desestruturadas.');
|
|
1094
|
+
this.consumir(delegua_2.default.IGUAL, 'Esperado igual após relação de propriedades da desestruturação.');
|
|
1090
1095
|
const inicializador = this.expressao();
|
|
1091
1096
|
// TODO: Para cada variável dos identificadores, emitir um `AcessoMetodoOuPropriedade` usando
|
|
1092
1097
|
// como prefixo o nome do inicializador, e o sufixo o nome de cada propriedade.
|
|
@@ -1103,21 +1108,21 @@ class AvaliadorSintatico {
|
|
|
1103
1108
|
declaracaoDeConstantes() {
|
|
1104
1109
|
const identificadores = [];
|
|
1105
1110
|
let tipo = null;
|
|
1106
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1111
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CHAVE_ESQUERDA)) {
|
|
1107
1112
|
return this.declaracaoDesestruturacaoConstante();
|
|
1108
1113
|
}
|
|
1109
1114
|
do {
|
|
1110
|
-
identificadores.push(this.consumir(
|
|
1111
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1112
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1115
|
+
identificadores.push(this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome da constante.'));
|
|
1116
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1117
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.DOIS_PONTOS)) {
|
|
1113
1118
|
tipo = this.verificarDefinicaoTipoAtual();
|
|
1114
1119
|
this.avancarEDevolverAnterior();
|
|
1115
1120
|
}
|
|
1116
|
-
this.consumir(
|
|
1121
|
+
this.consumir(delegua_2.default.IGUAL, "Esperado '=' após identificador em instrução 'constante'.");
|
|
1117
1122
|
const inicializadores = [];
|
|
1118
1123
|
do {
|
|
1119
1124
|
inicializadores.push(this.expressao());
|
|
1120
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1125
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1121
1126
|
if (identificadores.length !== inicializadores.length) {
|
|
1122
1127
|
throw this.erro(this.simboloAtual(), 'Quantidade de identificadores à esquerda do igual é diferente da quantidade de valores à direita.');
|
|
1123
1128
|
}
|
|
@@ -1125,18 +1130,18 @@ class AvaliadorSintatico {
|
|
|
1125
1130
|
for (let [indice, identificador] of identificadores.entries()) {
|
|
1126
1131
|
retorno.push(new declaracoes_1.Const(identificador, inicializadores[indice], tipo));
|
|
1127
1132
|
}
|
|
1128
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
1133
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
1129
1134
|
return retorno;
|
|
1130
1135
|
}
|
|
1131
1136
|
funcao(tipo) {
|
|
1132
1137
|
let simbolo;
|
|
1133
1138
|
switch (this.simbolos[this.atual].tipo) {
|
|
1134
|
-
case
|
|
1139
|
+
case delegua_2.default.CONSTRUTOR:
|
|
1135
1140
|
simbolo = this.avancarEDevolverAnterior();
|
|
1136
1141
|
this.pilhaDecoradores = [];
|
|
1137
1142
|
break;
|
|
1138
1143
|
default:
|
|
1139
|
-
simbolo = this.consumir(
|
|
1144
|
+
simbolo = this.consumir(delegua_2.default.IDENTIFICADOR, `Esperado nome de ${tipo}.`);
|
|
1140
1145
|
break;
|
|
1141
1146
|
}
|
|
1142
1147
|
return new declaracoes_1.FuncaoDeclaracao(simbolo, this.corpoDaFuncao(tipo), null, this.pilhaDecoradores);
|
|
@@ -1145,18 +1150,18 @@ class AvaliadorSintatico {
|
|
|
1145
1150
|
const parametros = [];
|
|
1146
1151
|
do {
|
|
1147
1152
|
const parametro = {};
|
|
1148
|
-
if (this.simbolos[this.atual].tipo ===
|
|
1149
|
-
this.consumir(
|
|
1153
|
+
if (this.simbolos[this.atual].tipo === delegua_2.default.MULTIPLICACAO) {
|
|
1154
|
+
this.consumir(delegua_2.default.MULTIPLICACAO, null);
|
|
1150
1155
|
parametro.abrangencia = 'multiplo';
|
|
1151
1156
|
}
|
|
1152
1157
|
else {
|
|
1153
1158
|
parametro.abrangencia = 'padrao';
|
|
1154
1159
|
}
|
|
1155
|
-
parametro.nome = this.consumir(
|
|
1156
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1160
|
+
parametro.nome = this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome do parâmetro.');
|
|
1161
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.IGUAL)) {
|
|
1157
1162
|
parametro.valorPadrao = this.primario();
|
|
1158
1163
|
}
|
|
1159
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1164
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.DOIS_PONTOS)) {
|
|
1160
1165
|
let tipoDadoParametro = this.verificarDefinicaoTipoAtual();
|
|
1161
1166
|
parametro.tipoDado = {
|
|
1162
1167
|
nome: this.simbolos[this.atual - 2].lexema,
|
|
@@ -1168,43 +1173,43 @@ class AvaliadorSintatico {
|
|
|
1168
1173
|
parametros.push(parametro);
|
|
1169
1174
|
if (parametro.abrangencia === 'multiplo')
|
|
1170
1175
|
break;
|
|
1171
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
1176
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_2.default.VIRGULA));
|
|
1172
1177
|
return parametros;
|
|
1173
1178
|
}
|
|
1174
1179
|
corpoDaFuncao(tipo) {
|
|
1175
1180
|
// O parêntese esquerdo é considerado o símbolo inicial para
|
|
1176
1181
|
// fins de pragma.
|
|
1177
|
-
const parenteseEsquerdo = this.consumir(
|
|
1182
|
+
const parenteseEsquerdo = this.consumir(delegua_2.default.PARENTESE_ESQUERDO, `Esperado '(' após o nome ${tipo}.`);
|
|
1178
1183
|
let parametros = [];
|
|
1179
|
-
if (!this.verificarTipoSimboloAtual(
|
|
1184
|
+
if (!this.verificarTipoSimboloAtual(delegua_2.default.PARENTESE_DIREITO)) {
|
|
1180
1185
|
parametros = this.logicaComumParametros();
|
|
1181
1186
|
}
|
|
1182
|
-
this.consumir(
|
|
1187
|
+
this.consumir(delegua_2.default.PARENTESE_DIREITO, "Esperado ')' após parâmetros.");
|
|
1183
1188
|
let tipoRetorno = null;
|
|
1184
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1189
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.DOIS_PONTOS)) {
|
|
1185
1190
|
tipoRetorno = this.verificarDefinicaoTipoAtual();
|
|
1186
1191
|
this.avancarEDevolverAnterior();
|
|
1187
1192
|
}
|
|
1188
|
-
this.consumir(
|
|
1193
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, `Esperado '{' antes do escopo do ${tipo}.`);
|
|
1189
1194
|
const corpo = this.blocoEscopo();
|
|
1190
1195
|
return new construtos_1.FuncaoConstruto(this.hashArquivo, Number(parenteseEsquerdo.linha), parametros, corpo, tipoRetorno);
|
|
1191
1196
|
}
|
|
1192
1197
|
declaracaoDeClasse() {
|
|
1193
|
-
const simbolo = this.consumir(
|
|
1198
|
+
const simbolo = this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome da classe.');
|
|
1194
1199
|
const pilhaDecoradoresClasse = this.pilhaDecoradores;
|
|
1195
1200
|
let superClasse = null;
|
|
1196
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1197
|
-
this.consumir(
|
|
1201
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.HERDA)) {
|
|
1202
|
+
this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado nome da Superclasse.');
|
|
1198
1203
|
superClasse = new construtos_1.Variavel(this.hashArquivo, this.simbolos[this.atual - 1]);
|
|
1199
1204
|
}
|
|
1200
|
-
this.consumir(
|
|
1205
|
+
this.consumir(delegua_2.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo da classe.");
|
|
1201
1206
|
this.pilhaDecoradores = [];
|
|
1202
1207
|
const metodos = [];
|
|
1203
1208
|
const propriedades = [];
|
|
1204
|
-
while (!this.verificarTipoSimboloAtual(
|
|
1209
|
+
while (!this.verificarTipoSimboloAtual(delegua_2.default.CHAVE_DIREITA) && !this.estaNoFinal()) {
|
|
1205
1210
|
// Se o símbolo atual é arroba, é um decorador.
|
|
1206
1211
|
// Caso contrário, verificamos o próximo símbolo.
|
|
1207
|
-
if (this.simbolos[this.atual].tipo ===
|
|
1212
|
+
if (this.simbolos[this.atual].tipo === delegua_2.default.ARROBA) {
|
|
1208
1213
|
this.resolverDecorador();
|
|
1209
1214
|
continue;
|
|
1210
1215
|
}
|
|
@@ -1212,15 +1217,15 @@ class AvaliadorSintatico {
|
|
|
1212
1217
|
// Caso contrário, é uma propriedade.
|
|
1213
1218
|
const proximoSimbolo = this.simbolos[this.atual + 1];
|
|
1214
1219
|
switch (proximoSimbolo.tipo) {
|
|
1215
|
-
case
|
|
1220
|
+
case delegua_2.default.PARENTESE_ESQUERDO:
|
|
1216
1221
|
metodos.push(this.funcao('método'));
|
|
1217
1222
|
this.pilhaDecoradores = [];
|
|
1218
1223
|
break;
|
|
1219
|
-
case
|
|
1220
|
-
const nomePropriedade = this.consumir(
|
|
1221
|
-
this.consumir(
|
|
1224
|
+
case delegua_2.default.DOIS_PONTOS:
|
|
1225
|
+
const nomePropriedade = this.consumir(delegua_2.default.IDENTIFICADOR, 'Esperado identificador para nome de propriedade.');
|
|
1226
|
+
this.consumir(delegua_2.default.DOIS_PONTOS, 'Esperado dois-pontos após nome de propriedade.');
|
|
1222
1227
|
const tipoPropriedade = this.avancarEDevolverAnterior();
|
|
1223
|
-
this.verificarSeSimboloAtualEIgualA(
|
|
1228
|
+
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
1224
1229
|
propriedades.push(new declaracoes_1.PropriedadeClasse(nomePropriedade, tipoPropriedade.lexema, this.pilhaDecoradores));
|
|
1225
1230
|
this.pilhaDecoradores = [];
|
|
1226
1231
|
break;
|
|
@@ -1228,7 +1233,7 @@ class AvaliadorSintatico {
|
|
|
1228
1233
|
throw this.erro(this.simbolos[this.atual], 'Esperado definição de método ou propriedade.');
|
|
1229
1234
|
}
|
|
1230
1235
|
}
|
|
1231
|
-
this.consumir(
|
|
1236
|
+
this.consumir(delegua_2.default.CHAVE_DIREITA, "Esperado '}' após o escopo da classe.");
|
|
1232
1237
|
return new declaracoes_1.Classe(simbolo, superClasse, metodos, propriedades, pilhaDecoradoresClasse);
|
|
1233
1238
|
}
|
|
1234
1239
|
/**
|
|
@@ -1241,13 +1246,13 @@ class AvaliadorSintatico {
|
|
|
1241
1246
|
*/
|
|
1242
1247
|
resolverDeclaracaoForaDeBloco() {
|
|
1243
1248
|
try {
|
|
1244
|
-
if ((this.verificarTipoSimboloAtual(
|
|
1245
|
-
this.verificarTipoSimboloAtual(
|
|
1246
|
-
this.verificarTipoProximoSimbolo(
|
|
1249
|
+
if ((this.verificarTipoSimboloAtual(delegua_2.default.FUNCAO) ||
|
|
1250
|
+
this.verificarTipoSimboloAtual(delegua_2.default.FUNÇÃO)) &&
|
|
1251
|
+
this.verificarTipoProximoSimbolo(delegua_2.default.IDENTIFICADOR)) {
|
|
1247
1252
|
this.avancarEDevolverAnterior();
|
|
1248
1253
|
return this.funcao('funcao');
|
|
1249
1254
|
}
|
|
1250
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
1255
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.CLASSE)) {
|
|
1251
1256
|
return this.declaracaoDeClasse();
|
|
1252
1257
|
}
|
|
1253
1258
|
return this.resolverDeclaracao();
|
|
@@ -1268,15 +1273,15 @@ class AvaliadorSintatico {
|
|
|
1268
1273
|
while (!this.estaNoFinal()) {
|
|
1269
1274
|
const tipoSimboloAtual = this.simbolos[this.atual - 1].tipo;
|
|
1270
1275
|
switch (tipoSimboloAtual) {
|
|
1271
|
-
case
|
|
1272
|
-
case
|
|
1273
|
-
case
|
|
1274
|
-
case
|
|
1275
|
-
case
|
|
1276
|
-
case
|
|
1277
|
-
case
|
|
1278
|
-
case
|
|
1279
|
-
case
|
|
1276
|
+
case delegua_2.default.CLASSE:
|
|
1277
|
+
case delegua_2.default.FUNCAO:
|
|
1278
|
+
case delegua_2.default.FUNÇÃO:
|
|
1279
|
+
case delegua_2.default.VARIAVEL:
|
|
1280
|
+
case delegua_2.default.PARA:
|
|
1281
|
+
case delegua_2.default.SE:
|
|
1282
|
+
case delegua_2.default.ENQUANTO:
|
|
1283
|
+
case delegua_2.default.ESCREVA:
|
|
1284
|
+
case delegua_2.default.RETORNA:
|
|
1280
1285
|
return;
|
|
1281
1286
|
}
|
|
1282
1287
|
this.avancarEDevolverAnterior();
|
|
@@ -1313,7 +1318,7 @@ class AvaliadorSintatico {
|
|
|
1313
1318
|
}
|
|
1314
1319
|
exports.AvaliadorSintatico = AvaliadorSintatico;
|
|
1315
1320
|
|
|
1316
|
-
},{"../construtos":
|
|
1321
|
+
},{"../construtos":39,"../construtos/tuplas":48,"../declaracoes":77,"../lexador":146,"../tipos-de-dados/delegua":154,"../tipos-de-simbolos/delegua":157,"./erro-avaliador-sintatico":7,"browser-process-hrtime":332}],3:[function(require,module,exports){
|
|
1317
1322
|
"use strict";
|
|
1318
1323
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1319
1324
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -1963,7 +1968,7 @@ class AvaliadorSintaticoEguaClassico {
|
|
|
1963
1968
|
}
|
|
1964
1969
|
exports.AvaliadorSintaticoEguaClassico = AvaliadorSintaticoEguaClassico;
|
|
1965
1970
|
|
|
1966
|
-
},{"../../construtos":
|
|
1971
|
+
},{"../../construtos":39,"../../declaracoes":77,"../../tipos-de-simbolos/egua-classico":158,"../erro-avaliador-sintatico":7}],4:[function(require,module,exports){
|
|
1967
1972
|
"use strict";
|
|
1968
1973
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1969
1974
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -2735,7 +2740,7 @@ class AvaliadorSintaticoPitugues {
|
|
|
2735
2740
|
}
|
|
2736
2741
|
exports.AvaliadorSintaticoPitugues = AvaliadorSintaticoPitugues;
|
|
2737
2742
|
|
|
2738
|
-
},{"../../construtos":
|
|
2743
|
+
},{"../../construtos":39,"../../declaracoes":77,"../../lexador":146,"../../tipos-de-simbolos/pitugues":161,"../erro-avaliador-sintatico":7,"browser-process-hrtime":332}],5:[function(require,module,exports){
|
|
2739
2744
|
"use strict";
|
|
2740
2745
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2741
2746
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -2905,7 +2910,7 @@ class AvaliadorSintaticoPortugolIpt extends avaliador_sintatico_base_1.Avaliador
|
|
|
2905
2910
|
}
|
|
2906
2911
|
exports.AvaliadorSintaticoPortugolIpt = AvaliadorSintaticoPortugolIpt;
|
|
2907
2912
|
|
|
2908
|
-
},{"../../construtos":
|
|
2913
|
+
},{"../../construtos":39,"../../declaracoes":77,"../../tipos-de-simbolos/portugol-ipt":162,"../avaliador-sintatico-base":1}],6:[function(require,module,exports){
|
|
2909
2914
|
"use strict";
|
|
2910
2915
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2911
2916
|
if (k2 === undefined) k2 = k;
|
|
@@ -3081,7 +3086,7 @@ class MicroAvaliadorSintaticoBase {
|
|
|
3081
3086
|
}
|
|
3082
3087
|
exports.MicroAvaliadorSintaticoBase = MicroAvaliadorSintaticoBase;
|
|
3083
3088
|
|
|
3084
|
-
},{"../construtos":
|
|
3089
|
+
},{"../construtos":39,"../tipos-de-simbolos/comum":156,"./erro-avaliador-sintatico":7}],10:[function(require,module,exports){
|
|
3085
3090
|
"use strict";
|
|
3086
3091
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3087
3092
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -3370,7 +3375,7 @@ class MicroAvaliadorSintatico extends micro_avaliador_sintatico_base_1.MicroAval
|
|
|
3370
3375
|
}
|
|
3371
3376
|
exports.MicroAvaliadorSintatico = MicroAvaliadorSintatico;
|
|
3372
3377
|
|
|
3373
|
-
},{"../construtos":
|
|
3378
|
+
},{"../construtos":39,"../tipos-de-simbolos/microgramaticas/delegua":160,"./erro-avaliador-sintatico":7,"./micro-avaliador-sintatico-base":9}],11:[function(require,module,exports){
|
|
3374
3379
|
"use strict";
|
|
3375
3380
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3376
3381
|
if (k2 === undefined) k2 = k;
|
|
@@ -3903,7 +3908,7 @@ async function tupla(interpretador, vetor) {
|
|
|
3903
3908
|
}
|
|
3904
3909
|
exports.tupla = tupla;
|
|
3905
3910
|
|
|
3906
|
-
},{"../construtos":
|
|
3911
|
+
},{"../construtos":39,"../estruturas":100,"../estruturas/delegua-classe":97,"../estruturas/funcao-padrao":99,"../estruturas/objeto-delegua-classe":103,"../excecoes":106}],16:[function(require,module,exports){
|
|
3907
3912
|
"use strict";
|
|
3908
3913
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3909
3914
|
exports.default = {
|
|
@@ -4171,11 +4176,17 @@ exports.Atribuir = void 0;
|
|
|
4171
4176
|
* Construto de atribuição de um valor a um símbolo.
|
|
4172
4177
|
*/
|
|
4173
4178
|
class Atribuir {
|
|
4174
|
-
constructor(hashArquivo, simbolo, valor
|
|
4179
|
+
constructor(hashArquivo, simbolo, valor,
|
|
4180
|
+
// indice so é usado para variaveis de vetores
|
|
4181
|
+
// TODO: criar alguma validaçao para garantir que indice so seja passado para variaveis de vetores
|
|
4182
|
+
indice) {
|
|
4175
4183
|
this.linha = Number(simbolo.linha);
|
|
4176
4184
|
this.hashArquivo = hashArquivo;
|
|
4177
4185
|
this.simbolo = simbolo;
|
|
4178
4186
|
this.valor = valor;
|
|
4187
|
+
if (indice !== undefined) {
|
|
4188
|
+
this.indice = indice;
|
|
4189
|
+
}
|
|
4179
4190
|
}
|
|
4180
4191
|
async aceitar(visitante) {
|
|
4181
4192
|
return await visitante.visitarExpressaoDeAtribuicao(this);
|
|
@@ -4189,14 +4200,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4189
4200
|
exports.Binario = void 0;
|
|
4190
4201
|
/**
|
|
4191
4202
|
* Binário é uma estrutura com um operador e dois operandos: esquerda e direita.
|
|
4192
|
-
* Implementa as seguintes operações:
|
|
4203
|
+
* Implementa as seguintes operações para Delégua e todos os dialetos:
|
|
4193
4204
|
*
|
|
4194
|
-
* - `+` (Adição)
|
|
4195
|
-
* - `-` (Subtração)
|
|
4196
|
-
* - `*` (Multiplicação)
|
|
4197
|
-
* - `/` (Divisão)
|
|
4198
|
-
* - `%` (Módulo)
|
|
4199
|
-
*
|
|
4205
|
+
* - `+` (Adição);
|
|
4206
|
+
* - `-` (Subtração);
|
|
4207
|
+
* - `*` (Multiplicação);
|
|
4208
|
+
* - `/` (Divisão);
|
|
4209
|
+
* - `%` (Módulo);
|
|
4210
|
+
*
|
|
4211
|
+
* Algumas outras operações podem ser suportadas de dialeto para dialeto,
|
|
4212
|
+
* como por exemplo:
|
|
4213
|
+
*
|
|
4214
|
+
* - `+=` (Adição com Atribuição);
|
|
4215
|
+
* - `-=` (Subtração com Atribuição);
|
|
4216
|
+
* - `*=` (Multiplicação com Atribuição);
|
|
4217
|
+
* - `/=` (Divisão com Atribuição);
|
|
4218
|
+
* - `%=` (Módulo com Atribuição);
|
|
4219
|
+
* - `**` (Exponenciação);
|
|
4220
|
+
* - `::` (Concatenação);
|
|
4221
|
+
* - `\` (Divisão inteira).
|
|
4200
4222
|
*/
|
|
4201
4223
|
class Binario {
|
|
4202
4224
|
constructor(hashArquivo, esquerda, operador, direita) {
|
|
@@ -4235,7 +4257,7 @@ class Chamada {
|
|
|
4235
4257
|
}
|
|
4236
4258
|
exports.Chamada = Chamada;
|
|
4237
4259
|
|
|
4238
|
-
},{"../geracao-identificadores":
|
|
4260
|
+
},{"../geracao-identificadores":109}],29:[function(require,module,exports){
|
|
4239
4261
|
"use strict";
|
|
4240
4262
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4241
4263
|
exports.Comentario = void 0;
|
|
@@ -4260,33 +4282,6 @@ exports.Comentario = Comentario;
|
|
|
4260
4282
|
},{}],30:[function(require,module,exports){
|
|
4261
4283
|
"use strict";
|
|
4262
4284
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4263
|
-
exports.ConstanteOuVariavel = void 0;
|
|
4264
|
-
/**
|
|
4265
|
-
* Este construto existe para alguns dialetos, como Potigol, onde
|
|
4266
|
-
* não é possível definir se um construto é constante, variável,
|
|
4267
|
-
* identificador de função, tipo ou classe no momento da avaliação
|
|
4268
|
-
* primária.
|
|
4269
|
-
*
|
|
4270
|
-
* Durante o restante da avaliação sintática, esse construto deve **obrigatoriamente**
|
|
4271
|
-
* resolver para `Constante`, `Variavel` ou algum construto de chamada/declaração de
|
|
4272
|
-
* função.
|
|
4273
|
-
*/
|
|
4274
|
-
class ConstanteOuVariavel {
|
|
4275
|
-
constructor(hashArquivo, simbolo) {
|
|
4276
|
-
this.linha = Number(simbolo.linha);
|
|
4277
|
-
this.hashArquivo = hashArquivo;
|
|
4278
|
-
this.simbolo = simbolo;
|
|
4279
|
-
}
|
|
4280
|
-
async aceitar(visitante) {
|
|
4281
|
-
return Promise.reject(new Error('Este método não deveria ser chamado. ' +
|
|
4282
|
-
'O construto deve resolver como constante ou variável ainda na avaliação sintática.'));
|
|
4283
|
-
}
|
|
4284
|
-
}
|
|
4285
|
-
exports.ConstanteOuVariavel = ConstanteOuVariavel;
|
|
4286
|
-
|
|
4287
|
-
},{}],31:[function(require,module,exports){
|
|
4288
|
-
"use strict";
|
|
4289
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4290
4285
|
exports.Constante = void 0;
|
|
4291
4286
|
/**
|
|
4292
4287
|
* O construto de constante.
|
|
@@ -4303,11 +4298,11 @@ class Constante {
|
|
|
4303
4298
|
}
|
|
4304
4299
|
exports.Constante = Constante;
|
|
4305
4300
|
|
|
4306
|
-
},{}],
|
|
4301
|
+
},{}],31:[function(require,module,exports){
|
|
4307
4302
|
"use strict";
|
|
4308
4303
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4309
4304
|
|
|
4310
|
-
},{}],
|
|
4305
|
+
},{}],32:[function(require,module,exports){
|
|
4311
4306
|
"use strict";
|
|
4312
4307
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4313
4308
|
exports.Decorador = void 0;
|
|
@@ -4328,7 +4323,7 @@ class Decorador {
|
|
|
4328
4323
|
}
|
|
4329
4324
|
exports.Decorador = Decorador;
|
|
4330
4325
|
|
|
4331
|
-
},{}],
|
|
4326
|
+
},{}],33:[function(require,module,exports){
|
|
4332
4327
|
"use strict";
|
|
4333
4328
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4334
4329
|
exports.DefinirValor = void 0;
|
|
@@ -4346,7 +4341,7 @@ class DefinirValor {
|
|
|
4346
4341
|
}
|
|
4347
4342
|
exports.DefinirValor = DefinirValor;
|
|
4348
4343
|
|
|
4349
|
-
},{}],
|
|
4344
|
+
},{}],34:[function(require,module,exports){
|
|
4350
4345
|
"use strict";
|
|
4351
4346
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4352
4347
|
exports.Dicionario = void 0;
|
|
@@ -4363,7 +4358,7 @@ class Dicionario {
|
|
|
4363
4358
|
}
|
|
4364
4359
|
exports.Dicionario = Dicionario;
|
|
4365
4360
|
|
|
4366
|
-
},{}],
|
|
4361
|
+
},{}],35:[function(require,module,exports){
|
|
4367
4362
|
"use strict";
|
|
4368
4363
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4369
4364
|
exports.ExpressaoRegular = void 0;
|
|
@@ -4380,7 +4375,7 @@ class ExpressaoRegular {
|
|
|
4380
4375
|
}
|
|
4381
4376
|
exports.ExpressaoRegular = ExpressaoRegular;
|
|
4382
4377
|
|
|
4383
|
-
},{}],
|
|
4378
|
+
},{}],36:[function(require,module,exports){
|
|
4384
4379
|
"use strict";
|
|
4385
4380
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4386
4381
|
exports.FimPara = void 0;
|
|
@@ -4407,7 +4402,7 @@ class FimPara {
|
|
|
4407
4402
|
}
|
|
4408
4403
|
exports.FimPara = FimPara;
|
|
4409
4404
|
|
|
4410
|
-
},{}],
|
|
4405
|
+
},{}],37:[function(require,module,exports){
|
|
4411
4406
|
"use strict";
|
|
4412
4407
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4413
4408
|
exports.FormatacaoEscrita = void 0;
|
|
@@ -4430,7 +4425,7 @@ class FormatacaoEscrita {
|
|
|
4430
4425
|
}
|
|
4431
4426
|
exports.FormatacaoEscrita = FormatacaoEscrita;
|
|
4432
4427
|
|
|
4433
|
-
},{}],
|
|
4428
|
+
},{}],38:[function(require,module,exports){
|
|
4434
4429
|
"use strict";
|
|
4435
4430
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4436
4431
|
exports.FuncaoConstruto = void 0;
|
|
@@ -4448,7 +4443,7 @@ class FuncaoConstruto {
|
|
|
4448
4443
|
}
|
|
4449
4444
|
exports.FuncaoConstruto = FuncaoConstruto;
|
|
4450
4445
|
|
|
4451
|
-
},{}],
|
|
4446
|
+
},{}],39:[function(require,module,exports){
|
|
4452
4447
|
"use strict";
|
|
4453
4448
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4454
4449
|
if (k2 === undefined) k2 = k;
|
|
@@ -4476,7 +4471,6 @@ __exportStar(require("./binario"), exports);
|
|
|
4476
4471
|
__exportStar(require("./chamada"), exports);
|
|
4477
4472
|
__exportStar(require("./comentario"), exports);
|
|
4478
4473
|
__exportStar(require("./constante"), exports);
|
|
4479
|
-
__exportStar(require("./constante-ou-variavel"), exports);
|
|
4480
4474
|
__exportStar(require("./construto"), exports);
|
|
4481
4475
|
__exportStar(require("./decorador"), exports);
|
|
4482
4476
|
__exportStar(require("./definir-valor"), exports);
|
|
@@ -4496,7 +4490,7 @@ __exportStar(require("./variavel"), exports);
|
|
|
4496
4490
|
__exportStar(require("./vetor"), exports);
|
|
4497
4491
|
__exportStar(require("./qual-tipo"), exports);
|
|
4498
4492
|
|
|
4499
|
-
},{"./acesso-elemento-matriz":20,"./acesso-indice-variavel":21,"./acesso-metodo-ou-propriedade":22,"./agrupamento":23,"./atribuicao-por-indice":24,"./atribuicao-por-indices-matriz":25,"./atribuir":26,"./binario":27,"./chamada":28,"./comentario":29,"./constante":
|
|
4493
|
+
},{"./acesso-elemento-matriz":20,"./acesso-indice-variavel":21,"./acesso-metodo-ou-propriedade":22,"./agrupamento":23,"./atribuicao-por-indice":24,"./atribuicao-por-indices-matriz":25,"./atribuir":26,"./binario":27,"./chamada":28,"./comentario":29,"./constante":30,"./construto":31,"./decorador":32,"./definir-valor":33,"./dicionario":34,"./expressao-regular":35,"./fim-para":36,"./formatacao-escrita":37,"./funcao":38,"./isto":40,"./literal":41,"./logico":42,"./qual-tipo":43,"./super":44,"./tipo-de":45,"./tuplas":48,"./unario":57,"./variavel":58,"./vetor":59}],40:[function(require,module,exports){
|
|
4500
4494
|
"use strict";
|
|
4501
4495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4502
4496
|
exports.Isto = void 0;
|
|
@@ -4512,7 +4506,7 @@ class Isto {
|
|
|
4512
4506
|
}
|
|
4513
4507
|
exports.Isto = Isto;
|
|
4514
4508
|
|
|
4515
|
-
},{}],
|
|
4509
|
+
},{}],41:[function(require,module,exports){
|
|
4516
4510
|
"use strict";
|
|
4517
4511
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4518
4512
|
exports.Literal = void 0;
|
|
@@ -4528,7 +4522,7 @@ class Literal {
|
|
|
4528
4522
|
}
|
|
4529
4523
|
exports.Literal = Literal;
|
|
4530
4524
|
|
|
4531
|
-
},{}],
|
|
4525
|
+
},{}],42:[function(require,module,exports){
|
|
4532
4526
|
"use strict";
|
|
4533
4527
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4534
4528
|
exports.Logico = void 0;
|
|
@@ -4546,7 +4540,7 @@ class Logico {
|
|
|
4546
4540
|
}
|
|
4547
4541
|
exports.Logico = Logico;
|
|
4548
4542
|
|
|
4549
|
-
},{}],
|
|
4543
|
+
},{}],43:[function(require,module,exports){
|
|
4550
4544
|
"use strict";
|
|
4551
4545
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4552
4546
|
exports.QualTipo = void 0;
|
|
@@ -4564,7 +4558,7 @@ class QualTipo {
|
|
|
4564
4558
|
}
|
|
4565
4559
|
exports.QualTipo = QualTipo;
|
|
4566
4560
|
|
|
4567
|
-
},{}],
|
|
4561
|
+
},{}],44:[function(require,module,exports){
|
|
4568
4562
|
"use strict";
|
|
4569
4563
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4570
4564
|
exports.Super = void 0;
|
|
@@ -4581,7 +4575,7 @@ class Super {
|
|
|
4581
4575
|
}
|
|
4582
4576
|
exports.Super = Super;
|
|
4583
4577
|
|
|
4584
|
-
},{}],
|
|
4578
|
+
},{}],45:[function(require,module,exports){
|
|
4585
4579
|
"use strict";
|
|
4586
4580
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4587
4581
|
exports.TipoDe = void 0;
|
|
@@ -4598,7 +4592,7 @@ class TipoDe {
|
|
|
4598
4592
|
}
|
|
4599
4593
|
exports.TipoDe = TipoDe;
|
|
4600
4594
|
|
|
4601
|
-
},{}],
|
|
4595
|
+
},{}],46:[function(require,module,exports){
|
|
4602
4596
|
"use strict";
|
|
4603
4597
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4604
4598
|
exports.Deceto = void 0;
|
|
@@ -4632,7 +4626,7 @@ class Deceto extends tupla_1.Tupla {
|
|
|
4632
4626
|
}
|
|
4633
4627
|
exports.Deceto = Deceto;
|
|
4634
4628
|
|
|
4635
|
-
},{"./tupla":
|
|
4629
|
+
},{"./tupla":56}],47:[function(require,module,exports){
|
|
4636
4630
|
"use strict";
|
|
4637
4631
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4638
4632
|
exports.Dupla = void 0;
|
|
@@ -4646,7 +4640,7 @@ class Dupla extends tupla_1.Tupla {
|
|
|
4646
4640
|
}
|
|
4647
4641
|
exports.Dupla = Dupla;
|
|
4648
4642
|
|
|
4649
|
-
},{"./tupla":
|
|
4643
|
+
},{"./tupla":56}],48:[function(require,module,exports){
|
|
4650
4644
|
"use strict";
|
|
4651
4645
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4652
4646
|
if (k2 === undefined) k2 = k;
|
|
@@ -4715,7 +4709,7 @@ class SeletorTuplas {
|
|
|
4715
4709
|
}
|
|
4716
4710
|
exports.SeletorTuplas = SeletorTuplas;
|
|
4717
4711
|
|
|
4718
|
-
},{"./deceto":
|
|
4712
|
+
},{"./deceto":46,"./dupla":47,"./noneto":49,"./octeto":50,"./quarteto":51,"./quinteto":52,"./septeto":53,"./sexteto":54,"./trio":55,"./tupla":56}],49:[function(require,module,exports){
|
|
4719
4713
|
"use strict";
|
|
4720
4714
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4721
4715
|
exports.Noneto = void 0;
|
|
@@ -4742,7 +4736,7 @@ class Noneto extends tupla_1.Tupla {
|
|
|
4742
4736
|
}
|
|
4743
4737
|
exports.Noneto = Noneto;
|
|
4744
4738
|
|
|
4745
|
-
},{"./tupla":
|
|
4739
|
+
},{"./tupla":56}],50:[function(require,module,exports){
|
|
4746
4740
|
"use strict";
|
|
4747
4741
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4748
4742
|
exports.Octeto = void 0;
|
|
@@ -4768,7 +4762,7 @@ class Octeto extends tupla_1.Tupla {
|
|
|
4768
4762
|
}
|
|
4769
4763
|
exports.Octeto = Octeto;
|
|
4770
4764
|
|
|
4771
|
-
},{"./tupla":
|
|
4765
|
+
},{"./tupla":56}],51:[function(require,module,exports){
|
|
4772
4766
|
"use strict";
|
|
4773
4767
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4774
4768
|
exports.Quarteto = void 0;
|
|
@@ -4784,7 +4778,7 @@ class Quarteto extends tupla_1.Tupla {
|
|
|
4784
4778
|
}
|
|
4785
4779
|
exports.Quarteto = Quarteto;
|
|
4786
4780
|
|
|
4787
|
-
},{"./tupla":
|
|
4781
|
+
},{"./tupla":56}],52:[function(require,module,exports){
|
|
4788
4782
|
"use strict";
|
|
4789
4783
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4790
4784
|
exports.Quinteto = void 0;
|
|
@@ -4801,7 +4795,7 @@ class Quinteto extends tupla_1.Tupla {
|
|
|
4801
4795
|
}
|
|
4802
4796
|
exports.Quinteto = Quinteto;
|
|
4803
4797
|
|
|
4804
|
-
},{"./tupla":
|
|
4798
|
+
},{"./tupla":56}],53:[function(require,module,exports){
|
|
4805
4799
|
"use strict";
|
|
4806
4800
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4807
4801
|
exports.Septeto = void 0;
|
|
@@ -4826,7 +4820,7 @@ class Septeto extends tupla_1.Tupla {
|
|
|
4826
4820
|
}
|
|
4827
4821
|
exports.Septeto = Septeto;
|
|
4828
4822
|
|
|
4829
|
-
},{"./tupla":
|
|
4823
|
+
},{"./tupla":56}],54:[function(require,module,exports){
|
|
4830
4824
|
"use strict";
|
|
4831
4825
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4832
4826
|
exports.Sexteto = void 0;
|
|
@@ -4844,7 +4838,7 @@ class Sexteto extends tupla_1.Tupla {
|
|
|
4844
4838
|
}
|
|
4845
4839
|
exports.Sexteto = Sexteto;
|
|
4846
4840
|
|
|
4847
|
-
},{"./tupla":
|
|
4841
|
+
},{"./tupla":56}],55:[function(require,module,exports){
|
|
4848
4842
|
"use strict";
|
|
4849
4843
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4850
4844
|
exports.Trio = void 0;
|
|
@@ -4859,7 +4853,7 @@ class Trio extends tupla_1.Tupla {
|
|
|
4859
4853
|
}
|
|
4860
4854
|
exports.Trio = Trio;
|
|
4861
4855
|
|
|
4862
|
-
},{"./tupla":
|
|
4856
|
+
},{"./tupla":56}],56:[function(require,module,exports){
|
|
4863
4857
|
"use strict";
|
|
4864
4858
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4865
4859
|
exports.Tupla = void 0;
|
|
@@ -4870,7 +4864,7 @@ class Tupla {
|
|
|
4870
4864
|
}
|
|
4871
4865
|
exports.Tupla = Tupla;
|
|
4872
4866
|
|
|
4873
|
-
},{}],
|
|
4867
|
+
},{}],57:[function(require,module,exports){
|
|
4874
4868
|
"use strict";
|
|
4875
4869
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4876
4870
|
exports.Unario = void 0;
|
|
@@ -4888,7 +4882,7 @@ class Unario {
|
|
|
4888
4882
|
}
|
|
4889
4883
|
exports.Unario = Unario;
|
|
4890
4884
|
|
|
4891
|
-
},{}],
|
|
4885
|
+
},{}],58:[function(require,module,exports){
|
|
4892
4886
|
"use strict";
|
|
4893
4887
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4894
4888
|
exports.Variavel = void 0;
|
|
@@ -4904,15 +4898,21 @@ class Variavel {
|
|
|
4904
4898
|
}
|
|
4905
4899
|
exports.Variavel = Variavel;
|
|
4906
4900
|
|
|
4907
|
-
},{}],
|
|
4901
|
+
},{}],59:[function(require,module,exports){
|
|
4908
4902
|
"use strict";
|
|
4909
4903
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4910
4904
|
exports.Vetor = void 0;
|
|
4911
4905
|
class Vetor {
|
|
4912
|
-
constructor(hashArquivo, linha, valores) {
|
|
4906
|
+
constructor(hashArquivo, linha, valores, tamanho) {
|
|
4913
4907
|
this.linha = linha;
|
|
4914
4908
|
this.hashArquivo = hashArquivo;
|
|
4915
4909
|
this.valores = valores;
|
|
4910
|
+
if (tamanho) {
|
|
4911
|
+
this.tamanho = tamanho;
|
|
4912
|
+
}
|
|
4913
|
+
else {
|
|
4914
|
+
this.tamanho = this.valores.length;
|
|
4915
|
+
}
|
|
4916
4916
|
}
|
|
4917
4917
|
async aceitar(visitante) {
|
|
4918
4918
|
return await visitante.visitarExpressaoVetor(this);
|
|
@@ -4920,7 +4920,7 @@ class Vetor {
|
|
|
4920
4920
|
}
|
|
4921
4921
|
exports.Vetor = Vetor;
|
|
4922
4922
|
|
|
4923
|
-
},{}],
|
|
4923
|
+
},{}],60:[function(require,module,exports){
|
|
4924
4924
|
"use strict";
|
|
4925
4925
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4926
4926
|
exports.Aleatorio = void 0;
|
|
@@ -4937,7 +4937,7 @@ class Aleatorio extends declaracao_1.Declaracao {
|
|
|
4937
4937
|
}
|
|
4938
4938
|
exports.Aleatorio = Aleatorio;
|
|
4939
4939
|
|
|
4940
|
-
},{"./declaracao":
|
|
4940
|
+
},{"./declaracao":67}],61:[function(require,module,exports){
|
|
4941
4941
|
"use strict";
|
|
4942
4942
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4943
4943
|
exports.Bloco = void 0;
|
|
@@ -4953,7 +4953,7 @@ class Bloco extends declaracao_1.Declaracao {
|
|
|
4953
4953
|
}
|
|
4954
4954
|
exports.Bloco = Bloco;
|
|
4955
4955
|
|
|
4956
|
-
},{"./declaracao":
|
|
4956
|
+
},{"./declaracao":67}],62:[function(require,module,exports){
|
|
4957
4957
|
"use strict";
|
|
4958
4958
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4959
4959
|
exports.CabecalhoPrograma = void 0;
|
|
@@ -4969,7 +4969,7 @@ class CabecalhoPrograma extends declaracao_1.Declaracao {
|
|
|
4969
4969
|
}
|
|
4970
4970
|
exports.CabecalhoPrograma = CabecalhoPrograma;
|
|
4971
4971
|
|
|
4972
|
-
},{"./declaracao":
|
|
4972
|
+
},{"./declaracao":67}],63:[function(require,module,exports){
|
|
4973
4973
|
"use strict";
|
|
4974
4974
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4975
4975
|
exports.Classe = void 0;
|
|
@@ -4989,7 +4989,7 @@ class Classe extends declaracao_1.Declaracao {
|
|
|
4989
4989
|
}
|
|
4990
4990
|
exports.Classe = Classe;
|
|
4991
4991
|
|
|
4992
|
-
},{"./declaracao":
|
|
4992
|
+
},{"./declaracao":67}],64:[function(require,module,exports){
|
|
4993
4993
|
"use strict";
|
|
4994
4994
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4995
4995
|
exports.ConstMultiplo = void 0;
|
|
@@ -5010,7 +5010,7 @@ class ConstMultiplo extends declaracao_1.Declaracao {
|
|
|
5010
5010
|
}
|
|
5011
5011
|
exports.ConstMultiplo = ConstMultiplo;
|
|
5012
5012
|
|
|
5013
|
-
},{"./declaracao":
|
|
5013
|
+
},{"./declaracao":67}],65:[function(require,module,exports){
|
|
5014
5014
|
"use strict";
|
|
5015
5015
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5016
5016
|
exports.Const = void 0;
|
|
@@ -5031,7 +5031,7 @@ class Const extends declaracao_1.Declaracao {
|
|
|
5031
5031
|
}
|
|
5032
5032
|
exports.Const = Const;
|
|
5033
5033
|
|
|
5034
|
-
},{"./declaracao":
|
|
5034
|
+
},{"./declaracao":67}],66:[function(require,module,exports){
|
|
5035
5035
|
"use strict";
|
|
5036
5036
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5037
5037
|
exports.Continua = void 0;
|
|
@@ -5046,7 +5046,7 @@ class Continua extends declaracao_1.Declaracao {
|
|
|
5046
5046
|
}
|
|
5047
5047
|
exports.Continua = Continua;
|
|
5048
5048
|
|
|
5049
|
-
},{"./declaracao":
|
|
5049
|
+
},{"./declaracao":67}],67:[function(require,module,exports){
|
|
5050
5050
|
"use strict";
|
|
5051
5051
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5052
5052
|
exports.Declaracao = void 0;
|
|
@@ -5065,7 +5065,7 @@ class Declaracao {
|
|
|
5065
5065
|
}
|
|
5066
5066
|
exports.Declaracao = Declaracao;
|
|
5067
5067
|
|
|
5068
|
-
},{}],
|
|
5068
|
+
},{}],68:[function(require,module,exports){
|
|
5069
5069
|
"use strict";
|
|
5070
5070
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5071
5071
|
exports.Enquanto = void 0;
|
|
@@ -5082,7 +5082,7 @@ class Enquanto extends declaracao_1.Declaracao {
|
|
|
5082
5082
|
}
|
|
5083
5083
|
exports.Enquanto = Enquanto;
|
|
5084
5084
|
|
|
5085
|
-
},{"./declaracao":
|
|
5085
|
+
},{"./declaracao":67}],69:[function(require,module,exports){
|
|
5086
5086
|
"use strict";
|
|
5087
5087
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5088
5088
|
exports.Escolha = void 0;
|
|
@@ -5103,7 +5103,7 @@ class Escolha extends declaracao_1.Declaracao {
|
|
|
5103
5103
|
}
|
|
5104
5104
|
exports.Escolha = Escolha;
|
|
5105
5105
|
|
|
5106
|
-
},{"./declaracao":
|
|
5106
|
+
},{"./declaracao":67}],70:[function(require,module,exports){
|
|
5107
5107
|
"use strict";
|
|
5108
5108
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5109
5109
|
exports.EscrevaMesmaLinha = void 0;
|
|
@@ -5119,7 +5119,7 @@ class EscrevaMesmaLinha extends declaracao_1.Declaracao {
|
|
|
5119
5119
|
}
|
|
5120
5120
|
exports.EscrevaMesmaLinha = EscrevaMesmaLinha;
|
|
5121
5121
|
|
|
5122
|
-
},{"./declaracao":
|
|
5122
|
+
},{"./declaracao":67}],71:[function(require,module,exports){
|
|
5123
5123
|
"use strict";
|
|
5124
5124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5125
5125
|
exports.Escreva = void 0;
|
|
@@ -5135,7 +5135,7 @@ class Escreva extends declaracao_1.Declaracao {
|
|
|
5135
5135
|
}
|
|
5136
5136
|
exports.Escreva = Escreva;
|
|
5137
5137
|
|
|
5138
|
-
},{"./declaracao":
|
|
5138
|
+
},{"./declaracao":67}],72:[function(require,module,exports){
|
|
5139
5139
|
"use strict";
|
|
5140
5140
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5141
5141
|
exports.Expressao = void 0;
|
|
@@ -5151,7 +5151,7 @@ class Expressao extends declaracao_1.Declaracao {
|
|
|
5151
5151
|
}
|
|
5152
5152
|
exports.Expressao = Expressao;
|
|
5153
5153
|
|
|
5154
|
-
},{"./declaracao":
|
|
5154
|
+
},{"./declaracao":67}],73:[function(require,module,exports){
|
|
5155
5155
|
"use strict";
|
|
5156
5156
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5157
5157
|
exports.Falhar = void 0;
|
|
@@ -5168,7 +5168,7 @@ class Falhar extends declaracao_1.Declaracao {
|
|
|
5168
5168
|
}
|
|
5169
5169
|
exports.Falhar = Falhar;
|
|
5170
5170
|
|
|
5171
|
-
},{"./declaracao":
|
|
5171
|
+
},{"./declaracao":67}],74:[function(require,module,exports){
|
|
5172
5172
|
"use strict";
|
|
5173
5173
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5174
5174
|
exports.Fazer = void 0;
|
|
@@ -5185,7 +5185,7 @@ class Fazer extends declaracao_1.Declaracao {
|
|
|
5185
5185
|
}
|
|
5186
5186
|
exports.Fazer = Fazer;
|
|
5187
5187
|
|
|
5188
|
-
},{"./declaracao":
|
|
5188
|
+
},{"./declaracao":67}],75:[function(require,module,exports){
|
|
5189
5189
|
"use strict";
|
|
5190
5190
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5191
5191
|
exports.FuncaoDeclaracao = void 0;
|
|
@@ -5204,7 +5204,7 @@ class FuncaoDeclaracao extends declaracao_1.Declaracao {
|
|
|
5204
5204
|
}
|
|
5205
5205
|
exports.FuncaoDeclaracao = FuncaoDeclaracao;
|
|
5206
5206
|
|
|
5207
|
-
},{"./declaracao":
|
|
5207
|
+
},{"./declaracao":67}],76:[function(require,module,exports){
|
|
5208
5208
|
"use strict";
|
|
5209
5209
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5210
5210
|
exports.Importar = void 0;
|
|
@@ -5221,7 +5221,7 @@ class Importar extends declaracao_1.Declaracao {
|
|
|
5221
5221
|
}
|
|
5222
5222
|
exports.Importar = Importar;
|
|
5223
5223
|
|
|
5224
|
-
},{"./declaracao":
|
|
5224
|
+
},{"./declaracao":67}],77:[function(require,module,exports){
|
|
5225
5225
|
"use strict";
|
|
5226
5226
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5227
5227
|
if (k2 === undefined) k2 = k;
|
|
@@ -5270,7 +5270,7 @@ __exportStar(require("./var"), exports);
|
|
|
5270
5270
|
__exportStar(require("./var-multiplo"), exports);
|
|
5271
5271
|
__exportStar(require("./aleatorio"), exports);
|
|
5272
5272
|
|
|
5273
|
-
},{"./aleatorio":
|
|
5273
|
+
},{"./aleatorio":60,"./bloco":61,"./cabecalho-programa":62,"./classe":63,"./const":65,"./const-multiplo":64,"./continua":66,"./declaracao":67,"./enquanto":68,"./escolha":69,"./escreva":71,"./escreva-mesma-linha":70,"./expressao":72,"./falhar":73,"./fazer":74,"./funcao":75,"./importar":76,"./inicio-algoritmo":78,"./leia":80,"./leia-multiplo":79,"./para":82,"./para-cada":81,"./propriedade-classe":83,"./retorna":84,"./se":85,"./sustar":86,"./tendo-como":87,"./tente":88,"./var":90,"./var-multiplo":89}],78:[function(require,module,exports){
|
|
5274
5274
|
"use strict";
|
|
5275
5275
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5276
5276
|
exports.InicioAlgoritmo = void 0;
|
|
@@ -5285,7 +5285,7 @@ class InicioAlgoritmo extends declaracao_1.Declaracao {
|
|
|
5285
5285
|
}
|
|
5286
5286
|
exports.InicioAlgoritmo = InicioAlgoritmo;
|
|
5287
5287
|
|
|
5288
|
-
},{"./declaracao":
|
|
5288
|
+
},{"./declaracao":67}],79:[function(require,module,exports){
|
|
5289
5289
|
"use strict";
|
|
5290
5290
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5291
5291
|
exports.LeiaMultiplo = void 0;
|
|
@@ -5308,7 +5308,7 @@ class LeiaMultiplo extends declaracao_1.Declaracao {
|
|
|
5308
5308
|
}
|
|
5309
5309
|
exports.LeiaMultiplo = LeiaMultiplo;
|
|
5310
5310
|
|
|
5311
|
-
},{"../geracao-identificadores":
|
|
5311
|
+
},{"../geracao-identificadores":109,"./declaracao":67}],80:[function(require,module,exports){
|
|
5312
5312
|
"use strict";
|
|
5313
5313
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5314
5314
|
exports.Leia = void 0;
|
|
@@ -5331,7 +5331,7 @@ class Leia extends declaracao_1.Declaracao {
|
|
|
5331
5331
|
}
|
|
5332
5332
|
exports.Leia = Leia;
|
|
5333
5333
|
|
|
5334
|
-
},{"../geracao-identificadores":
|
|
5334
|
+
},{"../geracao-identificadores":109,"./declaracao":67}],81:[function(require,module,exports){
|
|
5335
5335
|
"use strict";
|
|
5336
5336
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5337
5337
|
exports.ParaCada = void 0;
|
|
@@ -5350,7 +5350,7 @@ class ParaCada extends declaracao_1.Declaracao {
|
|
|
5350
5350
|
}
|
|
5351
5351
|
exports.ParaCada = ParaCada;
|
|
5352
5352
|
|
|
5353
|
-
},{"./declaracao":
|
|
5353
|
+
},{"./declaracao":67}],82:[function(require,module,exports){
|
|
5354
5354
|
"use strict";
|
|
5355
5355
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5356
5356
|
exports.Para = void 0;
|
|
@@ -5376,7 +5376,7 @@ class Para extends declaracao_1.Declaracao {
|
|
|
5376
5376
|
}
|
|
5377
5377
|
exports.Para = Para;
|
|
5378
5378
|
|
|
5379
|
-
},{"./declaracao":
|
|
5379
|
+
},{"./declaracao":67}],83:[function(require,module,exports){
|
|
5380
5380
|
"use strict";
|
|
5381
5381
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5382
5382
|
exports.PropriedadeClasse = void 0;
|
|
@@ -5394,7 +5394,7 @@ class PropriedadeClasse extends declaracao_1.Declaracao {
|
|
|
5394
5394
|
}
|
|
5395
5395
|
exports.PropriedadeClasse = PropriedadeClasse;
|
|
5396
5396
|
|
|
5397
|
-
},{"./declaracao":
|
|
5397
|
+
},{"./declaracao":67}],84:[function(require,module,exports){
|
|
5398
5398
|
"use strict";
|
|
5399
5399
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5400
5400
|
exports.Retorna = void 0;
|
|
@@ -5411,7 +5411,7 @@ class Retorna extends declaracao_1.Declaracao {
|
|
|
5411
5411
|
}
|
|
5412
5412
|
exports.Retorna = Retorna;
|
|
5413
5413
|
|
|
5414
|
-
},{"./declaracao":
|
|
5414
|
+
},{"./declaracao":67}],85:[function(require,module,exports){
|
|
5415
5415
|
"use strict";
|
|
5416
5416
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5417
5417
|
exports.Se = void 0;
|
|
@@ -5430,7 +5430,7 @@ class Se extends declaracao_1.Declaracao {
|
|
|
5430
5430
|
}
|
|
5431
5431
|
exports.Se = Se;
|
|
5432
5432
|
|
|
5433
|
-
},{"./declaracao":
|
|
5433
|
+
},{"./declaracao":67}],86:[function(require,module,exports){
|
|
5434
5434
|
"use strict";
|
|
5435
5435
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5436
5436
|
exports.Sustar = void 0;
|
|
@@ -5445,7 +5445,7 @@ class Sustar extends declaracao_1.Declaracao {
|
|
|
5445
5445
|
}
|
|
5446
5446
|
exports.Sustar = Sustar;
|
|
5447
5447
|
|
|
5448
|
-
},{"./declaracao":
|
|
5448
|
+
},{"./declaracao":67}],87:[function(require,module,exports){
|
|
5449
5449
|
"use strict";
|
|
5450
5450
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5451
5451
|
exports.TendoComo = void 0;
|
|
@@ -5468,7 +5468,7 @@ class TendoComo extends declaracao_1.Declaracao {
|
|
|
5468
5468
|
}
|
|
5469
5469
|
exports.TendoComo = TendoComo;
|
|
5470
5470
|
|
|
5471
|
-
},{"./declaracao":
|
|
5471
|
+
},{"./declaracao":67}],88:[function(require,module,exports){
|
|
5472
5472
|
"use strict";
|
|
5473
5473
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5474
5474
|
exports.Tente = void 0;
|
|
@@ -5490,7 +5490,7 @@ class Tente extends declaracao_1.Declaracao {
|
|
|
5490
5490
|
}
|
|
5491
5491
|
exports.Tente = Tente;
|
|
5492
5492
|
|
|
5493
|
-
},{"./declaracao":
|
|
5493
|
+
},{"./declaracao":67}],89:[function(require,module,exports){
|
|
5494
5494
|
"use strict";
|
|
5495
5495
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5496
5496
|
exports.VarMultiplo = void 0;
|
|
@@ -5512,7 +5512,7 @@ class VarMultiplo extends declaracao_1.Declaracao {
|
|
|
5512
5512
|
}
|
|
5513
5513
|
exports.VarMultiplo = VarMultiplo;
|
|
5514
5514
|
|
|
5515
|
-
},{"./declaracao":
|
|
5515
|
+
},{"./declaracao":67}],90:[function(require,module,exports){
|
|
5516
5516
|
"use strict";
|
|
5517
5517
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5518
5518
|
exports.Var = void 0;
|
|
@@ -5535,7 +5535,7 @@ class Var extends declaracao_1.Declaracao {
|
|
|
5535
5535
|
}
|
|
5536
5536
|
exports.Var = Var;
|
|
5537
5537
|
|
|
5538
|
-
},{"./declaracao":
|
|
5538
|
+
},{"./declaracao":67}],91:[function(require,module,exports){
|
|
5539
5539
|
"use strict";
|
|
5540
5540
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5541
5541
|
/**
|
|
@@ -5559,7 +5559,7 @@ function cyrb53(nomeArquivo, semente = 0) {
|
|
|
5559
5559
|
}
|
|
5560
5560
|
exports.default = cyrb53;
|
|
5561
5561
|
|
|
5562
|
-
},{}],
|
|
5562
|
+
},{}],92:[function(require,module,exports){
|
|
5563
5563
|
"use strict";
|
|
5564
5564
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5565
5565
|
if (k2 === undefined) k2 = k;
|
|
@@ -5584,11 +5584,11 @@ var cyrb53_1 = require("./cyrb53");
|
|
|
5584
5584
|
Object.defineProperty(exports, "cyrb53", { enumerable: true, get: function () { return __importDefault(cyrb53_1).default; } });
|
|
5585
5585
|
__exportStar(require("./ponto-parada"), exports);
|
|
5586
5586
|
|
|
5587
|
-
},{"./cyrb53":
|
|
5587
|
+
},{"./cyrb53":91,"./ponto-parada":93}],93:[function(require,module,exports){
|
|
5588
5588
|
"use strict";
|
|
5589
5589
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5590
5590
|
|
|
5591
|
-
},{}],
|
|
5591
|
+
},{}],94:[function(require,module,exports){
|
|
5592
5592
|
"use strict";
|
|
5593
5593
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5594
5594
|
exports.EspacoVariaveis = void 0;
|
|
@@ -5609,7 +5609,7 @@ class EspacoVariaveis {
|
|
|
5609
5609
|
}
|
|
5610
5610
|
exports.EspacoVariaveis = EspacoVariaveis;
|
|
5611
5611
|
|
|
5612
|
-
},{}],
|
|
5612
|
+
},{}],95:[function(require,module,exports){
|
|
5613
5613
|
"use strict";
|
|
5614
5614
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5615
5615
|
exports.Chamavel = void 0;
|
|
@@ -5623,7 +5623,7 @@ class Chamavel {
|
|
|
5623
5623
|
}
|
|
5624
5624
|
exports.Chamavel = Chamavel;
|
|
5625
5625
|
|
|
5626
|
-
},{}],
|
|
5626
|
+
},{}],96:[function(require,module,exports){
|
|
5627
5627
|
"use strict";
|
|
5628
5628
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5629
5629
|
exports.ClassePadrao = void 0;
|
|
@@ -5664,7 +5664,7 @@ class ClassePadrao extends chamavel_1.Chamavel {
|
|
|
5664
5664
|
}
|
|
5665
5665
|
exports.ClassePadrao = ClassePadrao;
|
|
5666
5666
|
|
|
5667
|
-
},{"./chamavel":
|
|
5667
|
+
},{"./chamavel":95}],97:[function(require,module,exports){
|
|
5668
5668
|
"use strict";
|
|
5669
5669
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5670
5670
|
exports.DeleguaClasse = void 0;
|
|
@@ -5743,7 +5743,7 @@ class DeleguaClasse extends chamavel_1.Chamavel {
|
|
|
5743
5743
|
}
|
|
5744
5744
|
exports.DeleguaClasse = DeleguaClasse;
|
|
5745
5745
|
|
|
5746
|
-
},{"../excecoes":
|
|
5746
|
+
},{"../excecoes":106,"./chamavel":95,"./objeto-delegua-classe":103}],98:[function(require,module,exports){
|
|
5747
5747
|
"use strict";
|
|
5748
5748
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5749
5749
|
exports.DeleguaFuncao = void 0;
|
|
@@ -5773,7 +5773,7 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
5773
5773
|
*/
|
|
5774
5774
|
paraTexto() {
|
|
5775
5775
|
var _a;
|
|
5776
|
-
if (this.nome
|
|
5776
|
+
if (!this.nome)
|
|
5777
5777
|
return '<função>';
|
|
5778
5778
|
let resultado = `<função ${this.nome}`;
|
|
5779
5779
|
let parametros = '';
|
|
@@ -5805,6 +5805,14 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
5805
5805
|
toString() {
|
|
5806
5806
|
return this.paraTexto();
|
|
5807
5807
|
}
|
|
5808
|
+
resolverParametrosEspalhados(argumentos, indiceArgumentoAtual) {
|
|
5809
|
+
const argumentosResolvidos = [];
|
|
5810
|
+
for (let i = indiceArgumentoAtual; i < argumentos.length; i++) {
|
|
5811
|
+
const argumentoAtual = argumentos[i];
|
|
5812
|
+
argumentosResolvidos.push(argumentoAtual && argumentoAtual.hasOwnProperty('valor') ? argumentoAtual.valor : argumentoAtual);
|
|
5813
|
+
}
|
|
5814
|
+
return argumentosResolvidos;
|
|
5815
|
+
}
|
|
5808
5816
|
async chamar(visitante, argumentos) {
|
|
5809
5817
|
const ambiente = new espaco_variaveis_1.EspacoVariaveis();
|
|
5810
5818
|
const parametros = this.declaracao.parametros || [];
|
|
@@ -5812,11 +5820,7 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
5812
5820
|
const parametro = parametros[i];
|
|
5813
5821
|
const nome = parametro['nome'].lexema;
|
|
5814
5822
|
if (parametro.abrangencia === 'multiplo') {
|
|
5815
|
-
const argumentosResolvidos =
|
|
5816
|
-
for (let indiceArgumentoAtual = i; indiceArgumentoAtual < argumentos.length; indiceArgumentoAtual++) {
|
|
5817
|
-
const argumentoAtual = argumentos[indiceArgumentoAtual];
|
|
5818
|
-
argumentosResolvidos.push(argumentoAtual && argumentoAtual.hasOwnProperty('valor') ? argumentoAtual.valor : argumentoAtual);
|
|
5819
|
-
}
|
|
5823
|
+
const argumentosResolvidos = this.resolverParametrosEspalhados(argumentos, i);
|
|
5820
5824
|
// TODO: Verificar se `imutavel` é `true` aqui mesmo.
|
|
5821
5825
|
ambiente.valores[nome] = { tipo: 'vetor', valor: argumentosResolvidos, imutavel: true };
|
|
5822
5826
|
}
|
|
@@ -5834,7 +5838,10 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
5834
5838
|
tipo: 'objeto',
|
|
5835
5839
|
imutavel: false,
|
|
5836
5840
|
};
|
|
5837
|
-
|
|
5841
|
+
// TODO: Apenass Potigol usa isso até então.
|
|
5842
|
+
// Estudar mover isso para o dialeto.
|
|
5843
|
+
if (this.instancia.classe.dialetoRequerExpansaoPropriedadesEspacoVariaveis &&
|
|
5844
|
+
this.nome !== 'construtor') {
|
|
5838
5845
|
for (let [nomeCampo, valorCampo] of Object.entries(this.instancia.propriedades)) {
|
|
5839
5846
|
ambiente.valores[nomeCampo] = {
|
|
5840
5847
|
valor: valorCampo,
|
|
@@ -5879,7 +5886,7 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
5879
5886
|
}
|
|
5880
5887
|
exports.DeleguaFuncao = DeleguaFuncao;
|
|
5881
5888
|
|
|
5882
|
-
},{"../declaracoes":
|
|
5889
|
+
},{"../declaracoes":77,"../espaco-variaveis":94,"../interpretador/inferenciador":134,"../quebras":153,"./chamavel":95}],99:[function(require,module,exports){
|
|
5883
5890
|
"use strict";
|
|
5884
5891
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5885
5892
|
exports.FuncaoPadrao = void 0;
|
|
@@ -5915,7 +5922,7 @@ class FuncaoPadrao extends chamavel_1.Chamavel {
|
|
|
5915
5922
|
}
|
|
5916
5923
|
exports.FuncaoPadrao = FuncaoPadrao;
|
|
5917
5924
|
|
|
5918
|
-
},{"./chamavel":
|
|
5925
|
+
},{"./chamavel":95}],100:[function(require,module,exports){
|
|
5919
5926
|
"use strict";
|
|
5920
5927
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5921
5928
|
if (k2 === undefined) k2 = k;
|
|
@@ -5942,7 +5949,7 @@ __exportStar(require("./modulo"), exports);
|
|
|
5942
5949
|
__exportStar(require("./objeto-delegua-classe"), exports);
|
|
5943
5950
|
__exportStar(require("./objeto-padrao"), exports);
|
|
5944
5951
|
|
|
5945
|
-
},{"./chamavel":
|
|
5952
|
+
},{"./chamavel":95,"./classe-padrao":96,"./delegua-classe":97,"./delegua-funcao":98,"./funcao-padrao":99,"./metodo-primitiva":101,"./modulo":102,"./objeto-delegua-classe":103,"./objeto-padrao":104}],101:[function(require,module,exports){
|
|
5946
5953
|
"use strict";
|
|
5947
5954
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5948
5955
|
exports.MetodoPrimitiva = void 0;
|
|
@@ -5984,7 +5991,7 @@ class MetodoPrimitiva extends chamavel_1.Chamavel {
|
|
|
5984
5991
|
}
|
|
5985
5992
|
exports.MetodoPrimitiva = MetodoPrimitiva;
|
|
5986
5993
|
|
|
5987
|
-
},{"./chamavel":
|
|
5994
|
+
},{"./chamavel":95}],102:[function(require,module,exports){
|
|
5988
5995
|
"use strict";
|
|
5989
5996
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5990
5997
|
exports.DeleguaModulo = void 0;
|
|
@@ -6010,7 +6017,7 @@ class DeleguaModulo {
|
|
|
6010
6017
|
}
|
|
6011
6018
|
exports.DeleguaModulo = DeleguaModulo;
|
|
6012
6019
|
|
|
6013
|
-
},{}],
|
|
6020
|
+
},{}],103:[function(require,module,exports){
|
|
6014
6021
|
"use strict";
|
|
6015
6022
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6016
6023
|
exports.ObjetoDeleguaClasse = void 0;
|
|
@@ -6065,7 +6072,7 @@ class ObjetoDeleguaClasse {
|
|
|
6065
6072
|
}
|
|
6066
6073
|
exports.ObjetoDeleguaClasse = ObjetoDeleguaClasse;
|
|
6067
6074
|
|
|
6068
|
-
},{"../excecoes":
|
|
6075
|
+
},{"../excecoes":106}],104:[function(require,module,exports){
|
|
6069
6076
|
"use strict";
|
|
6070
6077
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6071
6078
|
exports.ObjetoPadrao = void 0;
|
|
@@ -6099,7 +6106,7 @@ class ObjetoPadrao {
|
|
|
6099
6106
|
}
|
|
6100
6107
|
exports.ObjetoPadrao = ObjetoPadrao;
|
|
6101
6108
|
|
|
6102
|
-
},{}],
|
|
6109
|
+
},{}],105:[function(require,module,exports){
|
|
6103
6110
|
"use strict";
|
|
6104
6111
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6105
6112
|
exports.ErroEmTempoDeExecucao = void 0;
|
|
@@ -6114,7 +6121,7 @@ class ErroEmTempoDeExecucao extends Error {
|
|
|
6114
6121
|
}
|
|
6115
6122
|
exports.ErroEmTempoDeExecucao = ErroEmTempoDeExecucao;
|
|
6116
6123
|
|
|
6117
|
-
},{}],
|
|
6124
|
+
},{}],106:[function(require,module,exports){
|
|
6118
6125
|
"use strict";
|
|
6119
6126
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6120
6127
|
if (k2 === undefined) k2 = k;
|
|
@@ -6133,7 +6140,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
6133
6140
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6134
6141
|
__exportStar(require("./erro-em-tempo-de-execucao"), exports);
|
|
6135
6142
|
|
|
6136
|
-
},{"./erro-em-tempo-de-execucao":
|
|
6143
|
+
},{"./erro-em-tempo-de-execucao":105}],107:[function(require,module,exports){
|
|
6137
6144
|
"use strict";
|
|
6138
6145
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6139
6146
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -6811,7 +6818,7 @@ class FormatadorDelegua {
|
|
|
6811
6818
|
}
|
|
6812
6819
|
exports.FormatadorDelegua = FormatadorDelegua;
|
|
6813
6820
|
|
|
6814
|
-
},{"../construtos":
|
|
6821
|
+
},{"../construtos":39,"../tipos-de-simbolos/delegua":157}],108:[function(require,module,exports){
|
|
6815
6822
|
"use strict";
|
|
6816
6823
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6817
6824
|
if (k2 === undefined) k2 = k;
|
|
@@ -6830,7 +6837,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
6830
6837
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6831
6838
|
__exportStar(require("./formatador-delegua"), exports);
|
|
6832
6839
|
|
|
6833
|
-
},{"./formatador-delegua":
|
|
6840
|
+
},{"./formatador-delegua":107}],109:[function(require,module,exports){
|
|
6834
6841
|
"use strict";
|
|
6835
6842
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6836
6843
|
exports.uuidv4 = void 0;
|
|
@@ -6855,7 +6862,7 @@ function uuidv4() {
|
|
|
6855
6862
|
}
|
|
6856
6863
|
exports.uuidv4 = uuidv4;
|
|
6857
6864
|
|
|
6858
|
-
},{}],
|
|
6865
|
+
},{}],110:[function(require,module,exports){
|
|
6859
6866
|
"use strict";
|
|
6860
6867
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6861
6868
|
if (k2 === undefined) k2 = k;
|
|
@@ -6884,15 +6891,15 @@ __exportStar(require("./interpretador"), exports);
|
|
|
6884
6891
|
__exportStar(require("./lexador"), exports);
|
|
6885
6892
|
__exportStar(require("./tradutores"), exports);
|
|
6886
6893
|
|
|
6887
|
-
},{"./avaliador-sintatico":8,"./construtos":
|
|
6894
|
+
},{"./avaliador-sintatico":8,"./construtos":39,"./declaracoes":77,"./depuracao":92,"./formatadores":108,"./interfaces":116,"./interpretador":133,"./lexador":146,"./tradutores":163}],111:[function(require,module,exports){
|
|
6888
6895
|
"use strict";
|
|
6889
6896
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6890
6897
|
|
|
6891
|
-
},{}],
|
|
6898
|
+
},{}],112:[function(require,module,exports){
|
|
6892
6899
|
"use strict";
|
|
6893
6900
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6894
6901
|
|
|
6895
|
-
},{}],
|
|
6902
|
+
},{}],113:[function(require,module,exports){
|
|
6896
6903
|
"use strict";
|
|
6897
6904
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6898
6905
|
exports.DiagnosticoSeveridade = void 0;
|
|
@@ -6904,7 +6911,7 @@ var DiagnosticoSeveridade;
|
|
|
6904
6911
|
DiagnosticoSeveridade[DiagnosticoSeveridade["SUGESTAO"] = 3] = "SUGESTAO";
|
|
6905
6912
|
})(DiagnosticoSeveridade = exports.DiagnosticoSeveridade || (exports.DiagnosticoSeveridade = {}));
|
|
6906
6913
|
|
|
6907
|
-
},{}],
|
|
6914
|
+
},{}],114:[function(require,module,exports){
|
|
6908
6915
|
"use strict";
|
|
6909
6916
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6910
6917
|
if (k2 === undefined) k2 = k;
|
|
@@ -6923,7 +6930,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
6923
6930
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6924
6931
|
__exportStar(require("./diagnostico-analisador-semantico"), exports);
|
|
6925
6932
|
|
|
6926
|
-
},{"./diagnostico-analisador-semantico":
|
|
6933
|
+
},{"./diagnostico-analisador-semantico":113}],115:[function(require,module,exports){
|
|
6934
|
+
"use strict";
|
|
6935
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6936
|
+
|
|
6937
|
+
},{}],116:[function(require,module,exports){
|
|
6927
6938
|
"use strict";
|
|
6928
6939
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6929
6940
|
if (k2 === undefined) k2 = k;
|
|
@@ -6941,6 +6952,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
6941
6952
|
};
|
|
6942
6953
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6943
6954
|
__exportStar(require("./avaliador-sintatico-interface"), exports);
|
|
6955
|
+
__exportStar(require("./formatador-comum-interface"), exports);
|
|
6944
6956
|
__exportStar(require("./interpretador-com-depuracao-interface"), exports);
|
|
6945
6957
|
__exportStar(require("./interpretador-interface"), exports);
|
|
6946
6958
|
__exportStar(require("./lexador-interface"), exports);
|
|
@@ -6956,7 +6968,7 @@ __exportStar(require("./construtos"), exports);
|
|
|
6956
6968
|
__exportStar(require("./erros"), exports);
|
|
6957
6969
|
__exportStar(require("./retornos"), exports);
|
|
6958
6970
|
|
|
6959
|
-
},{"./avaliador-sintatico-interface":
|
|
6971
|
+
},{"./avaliador-sintatico-interface":111,"./construtos":112,"./erros":114,"./formatador-comum-interface":115,"./interpretador-com-depuracao-interface":117,"./interpretador-interface":118,"./lexador-interface":119,"./parametro-interface":120,"./pilha-interface":121,"./resolvedor-interface":122,"./retornos":123,"./retornos/retorno-execucao-interface":125,"./simbolo-interface":128,"./tradutor-interface":129,"./variavel-interface":130,"./visitante-comum-interface":131}],117:[function(require,module,exports){
|
|
6960
6972
|
"use strict";
|
|
6961
6973
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6962
6974
|
|
|
@@ -7088,7 +7100,7 @@ function carregarBibliotecasGlobais(pilhaEscoposExecucao) {
|
|
|
7088
7100
|
}
|
|
7089
7101
|
exports.carregarBibliotecasGlobais = carregarBibliotecasGlobais;
|
|
7090
7102
|
|
|
7091
|
-
},{"../bibliotecas/biblioteca-global":15,"../estruturas/funcao-padrao":
|
|
7103
|
+
},{"../bibliotecas/biblioteca-global":15,"../estruturas/funcao-padrao":99}],133:[function(require,module,exports){
|
|
7092
7104
|
"use strict";
|
|
7093
7105
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7094
7106
|
if (k2 === undefined) k2 = k;
|
|
@@ -7525,6 +7537,12 @@ class InterpretadorBase {
|
|
|
7525
7537
|
}
|
|
7526
7538
|
return resultado;
|
|
7527
7539
|
}
|
|
7540
|
+
/**
|
|
7541
|
+
* Lógica para verificação de valores iguais, para Delégua e alguns dialetos.
|
|
7542
|
+
* @param esquerda Uma variável.
|
|
7543
|
+
* @param direita Outra variável.
|
|
7544
|
+
* @returns Verdadeiro se são iguais. Falso em caso contrário.
|
|
7545
|
+
*/
|
|
7528
7546
|
eIgual(esquerda, direita) {
|
|
7529
7547
|
if (esquerda === null && direita === null)
|
|
7530
7548
|
return true;
|
|
@@ -7746,7 +7764,7 @@ class InterpretadorBase {
|
|
|
7746
7764
|
});
|
|
7747
7765
|
}
|
|
7748
7766
|
}
|
|
7749
|
-
// Por algum motivo misterioso, `entidadeChamada instanceof Chamavel` dá `false` em Liquido,
|
|
7767
|
+
// Por algum motivo misterioso, `entidadeChamada instanceof Chamavel` dá `false` em Liquido,
|
|
7750
7768
|
// mesmo que esteja tudo certo com `DeleguaFuncao`,
|
|
7751
7769
|
// então precisamos testar o nome do construtor também.
|
|
7752
7770
|
if (entidadeChamada instanceof estruturas_1.Chamavel || entidadeChamada.constructor.name === 'DeleguaFuncao') {
|
|
@@ -7781,7 +7799,11 @@ class InterpretadorBase {
|
|
|
7781
7799
|
async visitarExpressaoDeAtribuicao(expressao) {
|
|
7782
7800
|
const valor = await this.avaliar(expressao.valor);
|
|
7783
7801
|
const valorResolvido = valor !== undefined && valor.hasOwnProperty('valor') ? valor.valor : valor;
|
|
7784
|
-
|
|
7802
|
+
let indice = null;
|
|
7803
|
+
if (expressao.indice) {
|
|
7804
|
+
indice = await this.avaliar(expressao.indice);
|
|
7805
|
+
}
|
|
7806
|
+
this.pilhaEscoposExecucao.atribuirVariavel(expressao.simbolo, valorResolvido, indice);
|
|
7785
7807
|
return valorResolvido;
|
|
7786
7808
|
}
|
|
7787
7809
|
procurarVariavel(simbolo) {
|
|
@@ -8211,14 +8233,17 @@ class InterpretadorBase {
|
|
|
8211
8233
|
}
|
|
8212
8234
|
return objeto[valorIndice];
|
|
8213
8235
|
}
|
|
8214
|
-
|
|
8236
|
+
if (objeto instanceof construtos_1.Vetor) {
|
|
8237
|
+
return objeto.valores[valorIndice];
|
|
8238
|
+
}
|
|
8239
|
+
if (objeto.constructor === Object ||
|
|
8215
8240
|
objeto instanceof estruturas_1.ObjetoDeleguaClasse ||
|
|
8216
8241
|
objeto instanceof estruturas_1.DeleguaFuncao ||
|
|
8217
8242
|
objeto instanceof estruturas_1.DeleguaClasse ||
|
|
8218
8243
|
objeto instanceof estruturas_1.DeleguaModulo) {
|
|
8219
8244
|
return objeto[valorIndice] || null;
|
|
8220
8245
|
}
|
|
8221
|
-
|
|
8246
|
+
if (typeof objeto === primitivos_1.default.TEXTO) {
|
|
8222
8247
|
if (!Number.isInteger(valorIndice)) {
|
|
8223
8248
|
return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(expressao.simboloFechamento, 'Somente inteiros podem ser usados para indexar um vetor.', expressao.linha));
|
|
8224
8249
|
}
|
|
@@ -8232,9 +8257,7 @@ class InterpretadorBase {
|
|
|
8232
8257
|
}
|
|
8233
8258
|
return objeto.charAt(valorIndice);
|
|
8234
8259
|
}
|
|
8235
|
-
|
|
8236
|
-
return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(expressao.entidadeChamada.nome, 'Somente listas, dicionários, classes e objetos podem ter seus valores indexados.', expressao.linha));
|
|
8237
|
-
}
|
|
8260
|
+
return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(expressao.entidadeChamada.nome, 'Somente listas, dicionários, classes e objetos podem ter seus valores indexados.', expressao.linha));
|
|
8238
8261
|
}
|
|
8239
8262
|
async visitarExpressaoDefinirValor(expressao) {
|
|
8240
8263
|
const variavelObjeto = await this.avaliar(expressao.objeto);
|
|
@@ -8257,6 +8280,7 @@ class InterpretadorBase {
|
|
|
8257
8280
|
}
|
|
8258
8281
|
/**
|
|
8259
8282
|
* Executa uma declaração de classe.
|
|
8283
|
+
* Uma variável do tipo `DeleguaClasse` é adicionada à pilha de escopos de execução.
|
|
8260
8284
|
* @param declaracao A declaração de classe.
|
|
8261
8285
|
* @returns Sempre retorna nulo, por ser requerido pelo contrato de visita.
|
|
8262
8286
|
*/
|
|
@@ -8300,15 +8324,15 @@ class InterpretadorBase {
|
|
|
8300
8324
|
*/
|
|
8301
8325
|
async visitarExpressaoAcessoMetodo(expressao) {
|
|
8302
8326
|
let variavelObjeto = await this.avaliar(expressao.objeto);
|
|
8303
|
-
// Este caso acontece quando há encadeamento de métodos.
|
|
8327
|
+
// Este caso acontece quando há encadeamento de métodos.
|
|
8304
8328
|
// Por exemplo, `objeto1.metodo1().metodo2()`.
|
|
8305
|
-
// Como `RetornoQuebra` também possui `valor`, precisamos extrair o
|
|
8329
|
+
// Como `RetornoQuebra` também possui `valor`, precisamos extrair o
|
|
8306
8330
|
// valor dele primeiro.
|
|
8307
8331
|
if (variavelObjeto.constructor.name === 'RetornoQuebra') {
|
|
8308
8332
|
variavelObjeto = variavelObjeto.valor;
|
|
8309
8333
|
}
|
|
8310
8334
|
const objeto = variavelObjeto.hasOwnProperty('valor') ? variavelObjeto.valor : variavelObjeto;
|
|
8311
|
-
// Outro caso que `instanceof` simplesmente não funciona para casos em Liquido,
|
|
8335
|
+
// Outro caso que `instanceof` simplesmente não funciona para casos em Liquido,
|
|
8312
8336
|
// então testamos também o nome do construtor.
|
|
8313
8337
|
if (objeto instanceof estruturas_1.ObjetoDeleguaClasse || objeto.constructor.name === 'ObjetoDeleguaClasse') {
|
|
8314
8338
|
return objeto.obter(expressao.simbolo) || null;
|
|
@@ -8582,7 +8606,7 @@ class InterpretadorBase {
|
|
|
8582
8606
|
exports.InterpretadorBase = InterpretadorBase;
|
|
8583
8607
|
|
|
8584
8608
|
}).call(this)}).call(this,require('_process'))
|
|
8585
|
-
},{"../avaliador-sintatico":8,"../bibliotecas/primitivas-dicionario":16,"../bibliotecas/primitivas-numero":17,"../bibliotecas/primitivas-texto":18,"../bibliotecas/primitivas-vetor":19,"../construtos":
|
|
8609
|
+
},{"../avaliador-sintatico":8,"../bibliotecas/primitivas-dicionario":16,"../bibliotecas/primitivas-numero":17,"../bibliotecas/primitivas-texto":18,"../bibliotecas/primitivas-vetor":19,"../construtos":39,"../espaco-variaveis":94,"../estruturas":100,"../estruturas/metodo-primitiva":101,"../excecoes":106,"../lexador":146,"../quebras":153,"../tipos-de-dados/delegua":154,"../tipos-de-dados/primitivos":155,"../tipos-de-simbolos/delegua":157,"./comum":132,"./inferenciador":134,"./pilha-escopos-execucao":137,"_process":371,"browser-process-hrtime":332}],136:[function(require,module,exports){
|
|
8586
8610
|
"use strict";
|
|
8587
8611
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8588
8612
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -9152,7 +9176,7 @@ class InterpretadorComDepuracao extends interpretador_base_1.InterpretadorBase {
|
|
|
9152
9176
|
}
|
|
9153
9177
|
exports.InterpretadorComDepuracao = InterpretadorComDepuracao;
|
|
9154
9178
|
|
|
9155
|
-
},{"../declaracoes":
|
|
9179
|
+
},{"../declaracoes":77,"../espaco-variaveis":94,"../quebras":153,"./inferenciador":134,"./interpretador-base":135,"lodash":364}],137:[function(require,module,exports){
|
|
9156
9180
|
"use strict";
|
|
9157
9181
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9158
9182
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -9287,7 +9311,7 @@ class PilhaEscoposExecucao {
|
|
|
9287
9311
|
imutavel: false,
|
|
9288
9312
|
};
|
|
9289
9313
|
}
|
|
9290
|
-
atribuirVariavel(simbolo, valor) {
|
|
9314
|
+
atribuirVariavel(simbolo, valor, indice) {
|
|
9291
9315
|
for (let i = 1; i <= this.pilha.length; i++) {
|
|
9292
9316
|
const ambiente = this.pilha[this.pilha.length - i].ambiente;
|
|
9293
9317
|
if (ambiente.valores[simbolo.lexema] !== undefined) {
|
|
@@ -9297,11 +9321,21 @@ class PilhaEscoposExecucao {
|
|
|
9297
9321
|
}
|
|
9298
9322
|
const tipo = (variavel && variavel.hasOwnProperty('tipo') ? variavel.tipo : (0, inferenciador_1.inferirTipoVariavel)(valor)).toLowerCase();
|
|
9299
9323
|
const valorResolvido = this.converterValor(tipo, valor);
|
|
9300
|
-
|
|
9301
|
-
valor
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9324
|
+
if (indice !== undefined && indice !== null) {
|
|
9325
|
+
if (variavel.valor instanceof Array) {
|
|
9326
|
+
variavel.valor[indice] = valorResolvido;
|
|
9327
|
+
}
|
|
9328
|
+
else {
|
|
9329
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(simbolo, "Variável não é um vetor.");
|
|
9330
|
+
}
|
|
9331
|
+
}
|
|
9332
|
+
else {
|
|
9333
|
+
ambiente.valores[simbolo.lexema] = {
|
|
9334
|
+
valor: valorResolvido,
|
|
9335
|
+
tipo,
|
|
9336
|
+
imutavel: false,
|
|
9337
|
+
};
|
|
9338
|
+
}
|
|
9305
9339
|
return;
|
|
9306
9340
|
}
|
|
9307
9341
|
}
|
|
@@ -9387,7 +9421,7 @@ class PilhaEscoposExecucao {
|
|
|
9387
9421
|
}
|
|
9388
9422
|
exports.PilhaEscoposExecucao = PilhaEscoposExecucao;
|
|
9389
9423
|
|
|
9390
|
-
},{"../estruturas":
|
|
9424
|
+
},{"../estruturas":100,"../excecoes":106,"../lexador":146,"../tipos-de-dados/delegua":154,"./inferenciador":134}],138:[function(require,module,exports){
|
|
9391
9425
|
"use strict";
|
|
9392
9426
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9393
9427
|
if (k2 === undefined) k2 = k;
|
|
@@ -24993,7 +25027,7 @@ class TradutorAssemblyScript {
|
|
|
24993
25027
|
}
|
|
24994
25028
|
exports.TradutorAssemblyScript = TradutorAssemblyScript;
|
|
24995
25029
|
|
|
24996
|
-
},{"../construtos":
|
|
25030
|
+
},{"../construtos":39,"../declaracoes":77,"../tipos-de-simbolos/delegua":157}],167:[function(require,module,exports){
|
|
24997
25031
|
"use strict";
|
|
24998
25032
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24999
25033
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -25013,7 +25047,7 @@ class TradutorJavaScript {
|
|
|
25013
25047
|
this.indentacao = 0;
|
|
25014
25048
|
this.dicionarioConstrutos = {
|
|
25015
25049
|
AcessoIndiceVariavel: this.traduzirAcessoIndiceVariavel.bind(this),
|
|
25016
|
-
AcessoMetodoOuPropriedade: this.
|
|
25050
|
+
AcessoMetodoOuPropriedade: this.traduzirConstrutoAcessoMetodo.bind(this),
|
|
25017
25051
|
Agrupamento: this.traduzirConstrutoAgrupamento.bind(this),
|
|
25018
25052
|
AtribuicaoPorIndice: this.traduzirConstrutoAtribuicaoPorIndice.bind(this),
|
|
25019
25053
|
Atribuir: this.traduzirConstrutoAtribuir.bind(this),
|
|
@@ -25180,14 +25214,18 @@ class TradutorJavaScript {
|
|
|
25180
25214
|
else {
|
|
25181
25215
|
resultado += retorno;
|
|
25182
25216
|
}
|
|
25183
|
-
|
|
25217
|
+
if (!retorno.endsWith('length')) {
|
|
25218
|
+
resultado += '(';
|
|
25219
|
+
}
|
|
25184
25220
|
for (let parametro of chamada.argumentos) {
|
|
25185
25221
|
resultado += this.dicionarioConstrutos[parametro.constructor.name](parametro) + ', ';
|
|
25186
25222
|
}
|
|
25187
25223
|
if (chamada.argumentos.length > 0) {
|
|
25188
25224
|
resultado = resultado.slice(0, -2);
|
|
25189
25225
|
}
|
|
25190
|
-
|
|
25226
|
+
if (!retorno.endsWith('length')) {
|
|
25227
|
+
resultado += ')';
|
|
25228
|
+
}
|
|
25191
25229
|
return resultado;
|
|
25192
25230
|
}
|
|
25193
25231
|
traduzirConstrutoComentario(comentario) {
|
|
@@ -25469,7 +25507,7 @@ class TradutorJavaScript {
|
|
|
25469
25507
|
}
|
|
25470
25508
|
return resultado;
|
|
25471
25509
|
}
|
|
25472
|
-
|
|
25510
|
+
traduzirConstrutoAcessoMetodo(acessoMetodo) {
|
|
25473
25511
|
if (acessoMetodo.objeto instanceof construtos_1.Variavel) {
|
|
25474
25512
|
let objetoVariavel = acessoMetodo.objeto;
|
|
25475
25513
|
return `${objetoVariavel.simbolo.lexema}.${this.traduzirFuncoesNativas(acessoMetodo.simbolo.lexema)}`;
|
|
@@ -25568,7 +25606,7 @@ class TradutorJavaScript {
|
|
|
25568
25606
|
}
|
|
25569
25607
|
exports.TradutorJavaScript = TradutorJavaScript;
|
|
25570
25608
|
|
|
25571
|
-
},{"../construtos":
|
|
25609
|
+
},{"../construtos":39,"../declaracoes":77,"../tipos-de-simbolos/delegua":157}],168:[function(require,module,exports){
|
|
25572
25610
|
"use strict";
|
|
25573
25611
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25574
25612
|
exports.TradutorPortugolIpt = void 0;
|
|
@@ -26093,7 +26131,7 @@ class TradutorPython {
|
|
|
26093
26131
|
}
|
|
26094
26132
|
exports.TradutorPython = TradutorPython;
|
|
26095
26133
|
|
|
26096
|
-
},{"../construtos":
|
|
26134
|
+
},{"../construtos":39,"../declaracoes":77,"../tipos-de-simbolos/delegua":157}],170:[function(require,module,exports){
|
|
26097
26135
|
"use strict";
|
|
26098
26136
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26099
26137
|
exports.TradutorReversoJavaScript = void 0;
|
|
@@ -72095,5 +72133,5 @@ module.exports = function hasToStringTagShams() {
|
|
|
72095
72133
|
return hasSymbols() && !!Symbol.toStringTag;
|
|
72096
72134
|
};
|
|
72097
72135
|
|
|
72098
|
-
},{"has-symbols/shams":354}]},{},[
|
|
72136
|
+
},{"has-symbols/shams":354}]},{},[110])(110)
|
|
72099
72137
|
});
|