@designliquido/delegua 0.41.7 → 0.41.8

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.
Files changed (87) hide show
  1. package/analisador-semantico/analisador-semantico.d.ts.map +1 -1
  2. package/analisador-semantico/analisador-semantico.js +5 -4
  3. package/analisador-semantico/analisador-semantico.js.map +1 -1
  4. package/avaliador-sintatico/avaliador-sintatico.d.ts.map +1 -1
  5. package/avaliador-sintatico/avaliador-sintatico.js +21 -16
  6. package/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
  7. package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.d.ts.map +1 -1
  8. package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.js +4 -1
  9. package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.js.map +1 -1
  10. package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.d.ts.map +1 -1
  11. package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.js.map +1 -1
  12. package/avaliador-sintatico/informacao-escopo.d.ts +1 -1
  13. package/avaliador-sintatico/pilha-escopos.d.ts +3 -3
  14. package/avaliador-sintatico/pilha-escopos.d.ts.map +1 -1
  15. package/avaliador-sintatico/pilha-escopos.js.map +1 -1
  16. package/bibliotecas/biblioteca-global.d.ts +11 -4
  17. package/bibliotecas/biblioteca-global.d.ts.map +1 -1
  18. package/bibliotecas/biblioteca-global.js +31 -14
  19. package/bibliotecas/biblioteca-global.js.map +1 -1
  20. package/bibliotecas/dialetos/egua-classico/index.js +0 -1
  21. package/bibliotecas/dialetos/egua-classico/index.js.map +1 -1
  22. package/bibliotecas/primitivas-dicionario.d.ts.map +1 -1
  23. package/bibliotecas/primitivas-dicionario.js +2 -2
  24. package/bibliotecas/primitivas-dicionario.js.map +1 -1
  25. package/bibliotecas/primitivas-numero.d.ts.map +1 -1
  26. package/bibliotecas/primitivas-numero.js +2 -2
  27. package/bibliotecas/primitivas-numero.js.map +1 -1
  28. package/bibliotecas/primitivas-texto.d.ts.map +1 -1
  29. package/bibliotecas/primitivas-texto.js +14 -14
  30. package/bibliotecas/primitivas-texto.js.map +1 -1
  31. package/bibliotecas/primitivas-vetor.d.ts.map +1 -1
  32. package/bibliotecas/primitivas-vetor.js +16 -16
  33. package/bibliotecas/primitivas-vetor.js.map +1 -1
  34. package/bin/package.json +3 -1
  35. package/construtos/acesso-metodo-ou-propriedade.d.ts.map +1 -1
  36. package/construtos/acesso-metodo-ou-propriedade.js.map +1 -1
  37. package/construtos/acesso-metodo.d.ts +2 -2
  38. package/construtos/acesso-propriedade.d.ts +2 -2
  39. package/construtos/acesso-propriedade.d.ts.map +1 -1
  40. package/construtos/acesso-propriedade.js.map +1 -1
  41. package/construtos/argumento-referencia-funcao.d.ts +2 -2
  42. package/construtos/binario.d.ts.map +1 -1
  43. package/construtos/binario.js.map +1 -1
  44. package/construtos/componente-linguagem.d.ts +2 -2
  45. package/construtos/componente-linguagem.js +1 -1
  46. package/construtos/referencia-funcao.d.ts +2 -2
  47. package/construtos/super.d.ts.map +1 -1
  48. package/construtos/super.js.map +1 -1
  49. package/inferenciador.d.ts.map +1 -1
  50. package/inferenciador.js.map +1 -1
  51. package/interfaces/construtos/index.d.ts +2 -2
  52. package/interpretador/comum.d.ts.map +1 -1
  53. package/interpretador/comum.js +2 -0
  54. package/interpretador/comum.js.map +1 -1
  55. package/interpretador/dialetos/egua-classico/interpretador-egua-classico.js +1 -1
  56. package/interpretador/dialetos/egua-classico/interpretador-egua-classico.js.map +1 -1
  57. package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.js.map +1 -1
  58. package/interpretador/estruturas/delegua-funcao.d.ts.map +1 -1
  59. package/interpretador/estruturas/delegua-funcao.js +1 -1
  60. package/interpretador/estruturas/delegua-funcao.js.map +1 -1
  61. package/interpretador/interpretador-base.d.ts.map +1 -1
  62. package/interpretador/interpretador-base.js +6 -3
  63. package/interpretador/interpretador-base.js.map +1 -1
  64. package/interpretador/interpretador.d.ts +4 -4
  65. package/interpretador/interpretador.d.ts.map +1 -1
  66. package/interpretador/interpretador.js +2 -2
  67. package/interpretador/interpretador.js.map +1 -1
  68. package/interpretador/pilha-escopos-execucao.js +3 -3
  69. package/interpretador/pilha-escopos-execucao.js.map +1 -1
  70. package/package.json +3 -1
  71. package/tipos-de-simbolos/delegua.d.ts +1 -0
  72. package/tipos-de-simbolos/delegua.d.ts.map +1 -1
  73. package/tipos-de-simbolos/delegua.js +1 -0
  74. package/tipos-de-simbolos/delegua.js.map +1 -1
  75. package/tradutores/tradutor-assemblyscript.d.ts.map +1 -1
  76. package/tradutores/tradutor-assemblyscript.js +2 -1
  77. package/tradutores/tradutor-assemblyscript.js.map +1 -1
  78. package/tradutores/tradutor-javascript.d.ts.map +1 -1
  79. package/tradutores/tradutor-javascript.js +18 -13
  80. package/tradutores/tradutor-javascript.js.map +1 -1
  81. package/tradutores/tradutor-mermaidjs.d.ts.map +1 -1
  82. package/tradutores/tradutor-mermaidjs.js +8 -8
  83. package/tradutores/tradutor-mermaidjs.js.map +1 -1
  84. package/tradutores/tradutor-python.d.ts.map +1 -1
  85. package/tradutores/tradutor-python.js +6 -6
  86. package/tradutores/tradutor-python.js.map +1 -1
  87. package/umd/delegua.js +140 -103
package/umd/delegua.js CHANGED
@@ -288,6 +288,8 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
288
288
  this.primitivasConhecidas[nomePrimitivaVetor] = 'vetor';
289
289
  }
290
290
  this.primitivasConhecidas['inteiro'] = 'inteiro';
291
+ this.primitivasConhecidas['numero'] = 'número';
292
+ this.primitivasConhecidas['número'] = 'número';
291
293
  this.primitivasConhecidas['texto'] = 'texto';
292
294
  this.pilhaEscopos = new pilha_escopos_1.PilhaEscopos();
293
295
  }
@@ -397,6 +399,22 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
397
399
  }
398
400
  const tipoVetor = (0, inferenciador_1.inferirTipoVariavel)(valores);
399
401
  return new construtos_1.Vetor(this.hashArquivo, Number(simboloAtual.linha), valores, valores.length, tipoVetor);
402
+ case delegua_2.default.EXPRESSAO_REGULAR:
403
+ let valor = '';
404
+ let linhaAtual = this.simbolos[this.atual].linha;
405
+ let eParExpressaoRegular = this.simbolos.filter((l) => l.linha === linhaAtual && l.tipo === delegua_2.default.EXPRESSAO_REGULAR)
406
+ .length %
407
+ 2 ===
408
+ 0;
409
+ if (eParExpressaoRegular) {
410
+ this.avancarEDevolverAnterior();
411
+ while (!this.verificarTipoSimboloAtual(delegua_2.default.EXPRESSAO_REGULAR)) {
412
+ valor += this.simbolos[this.atual].lexema || '';
413
+ this.avancarEDevolverAnterior();
414
+ }
415
+ this.avancarEDevolverAnterior();
416
+ return new construtos_1.ExpressaoRegular(this.hashArquivo, simboloAtual, valor);
417
+ }
400
418
  case delegua_2.default.FALSO:
401
419
  this.avancarEDevolverAnterior();
402
420
  return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), false, 'lógico');
@@ -434,6 +452,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
434
452
  this.avancarEDevolverAnterior();
435
453
  return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), null, 'nulo');
436
454
  case delegua_2.default.NUMERO:
455
+ case delegua_2.default.NÚMERO:
437
456
  case delegua_2.default.TEXTO:
438
457
  const simboloNumeroTexto = this.avancarEDevolverAnterior();
439
458
  const tipoInferido = (0, inferenciador_1.inferirTipoVariavel)(simboloNumeroTexto.literal);
@@ -517,22 +536,6 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
517
536
  }
518
537
  }
519
538
  return new construtos_1.TipoDe(this.hashArquivo, simboloAtual, construto);
520
- case delegua_2.default.EXPRESSAO_REGULAR:
521
- let valor = '';
522
- let linhaAtual = this.simbolos[this.atual].linha;
523
- let eParExpressaoRegular = this.simbolos.filter((l) => l.linha === linhaAtual && l.tipo === delegua_2.default.EXPRESSAO_REGULAR)
524
- .length %
525
- 2 ===
526
- 0;
527
- if (eParExpressaoRegular) {
528
- this.avancarEDevolverAnterior();
529
- while (!this.verificarTipoSimboloAtual(delegua_2.default.EXPRESSAO_REGULAR)) {
530
- valor += this.simbolos[this.atual].lexema || '';
531
- this.avancarEDevolverAnterior();
532
- }
533
- this.avancarEDevolverAnterior();
534
- return new construtos_1.ExpressaoRegular(this.hashArquivo, simboloAtual, valor);
535
- }
536
539
  }
537
540
  throw this.erro(this.simbolos[this.atual], 'Esperado expressão.');
538
541
  }
@@ -1651,6 +1654,8 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
1651
1654
  this.pilhaEscopos.definirTipoVariavel('filtrarPor', 'qualquer[]');
1652
1655
  this.pilhaEscopos.definirTipoVariavel('inteiro', 'inteiro');
1653
1656
  this.pilhaEscopos.definirTipoVariavel('mapear', 'qualquer[]');
1657
+ this.pilhaEscopos.definirTipoVariavel('numero', 'número');
1658
+ this.pilhaEscopos.definirTipoVariavel('número', 'número');
1654
1659
  this.pilhaEscopos.definirTipoVariavel('paraCada', 'qualquer[]');
1655
1660
  this.pilhaEscopos.definirTipoVariavel('primeiroEmCondicao', 'qualquer');
1656
1661
  this.pilhaEscopos.definirTipoVariavel('real', 'número');
@@ -2425,7 +2430,10 @@ class AvaliadorSintaticoPitugues {
2425
2430
  // Se tipo ainda não foi definido, infere.
2426
2431
  // tipo = this.logicaComumInferenciaTiposVariaveisEConstantes(inicializadores[indice], tipo);
2427
2432
  // this.pilhaEscopos.definirTipoVariavel(identificador.lexema, tipo);
2428
- retorno.push(new declaracoes_1.Const(identificador, inicializadores[indice], tipo));
2433
+ retorno.push(new declaracoes_1.Const(identificador, inicializadores[indice], tipo
2434
+ // TODO: Discutir decoradores com comunidade.
2435
+ // Array.from(this.pilhaDecoradores)
2436
+ ));
2429
2437
  }
2430
2438
  // this.pilhaDecoradores = [];
2431
2439
  return retorno;
@@ -3808,6 +3816,7 @@ exports.filtrarPor = filtrarPor;
3808
3816
  exports.incluido = incluido;
3809
3817
  exports.inteiro = inteiro;
3810
3818
  exports.mapear = mapear;
3819
+ exports.numero = numero;
3811
3820
  exports.ordenar = ordenar;
3812
3821
  exports.paraCada = paraCada;
3813
3822
  exports.primeiroEmCondicao = primeiroEmCondicao;
@@ -3838,7 +3847,6 @@ async function aleatorio(interpretador) {
3838
3847
  * @returns {Promise<number>} Um número real entre os valores máximo e mínimo especificados.
3839
3848
  */
3840
3849
  async function aleatorioEntre(interpretador, minimo, maximo) {
3841
- // eslint-disable-next-line prefer-rest-params
3842
3850
  if (arguments.length <= 0) {
3843
3851
  return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(this.simbolo, 'A função recebe ao menos um parâmetro.'));
3844
3852
  }
@@ -4023,23 +4031,27 @@ async function incluido(interpretador, vetor, valor) {
4023
4031
  }
4024
4032
  return false;
4025
4033
  }
4026
- /**
4027
- *
4028
- * @param {InterpretadorInterface} interpretador A instância do interpretador.
4029
- * @param numero
4030
- * @returns
4031
- */
4032
- async function inteiro(interpretador, numero) {
4033
- if (numero === null || numero === undefined)
4034
- return Promise.resolve(0);
4035
- const valor = numero.hasOwnProperty('valor') ? numero.valor : numero;
4036
- if (isNaN(valor)) {
4034
+ function validacaoComumNumeros(valorParaConverter) {
4035
+ if (isNaN(valorParaConverter)) {
4037
4036
  return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(this.simbolo, 'Valor não parece ser um número. Somente números ou textos com números podem ser convertidos para inteiro.'));
4038
4037
  }
4039
- if (!/^(-)?\d+(\.\d+)?$/.test(valor)) {
4038
+ if (!/^(-)?\d+(\.\d+)?$/.test(valorParaConverter)) {
4040
4039
  return Promise.reject(new excecoes_1.ErroEmTempoDeExecucao(this.simbolo, 'Valor não parece estar estruturado como um número (texto vazio, falso ou não definido). Somente números ou textos com números podem ser convertidos para inteiro.'));
4041
4040
  }
4042
- return Promise.resolve(parseInt(valor));
4041
+ return null;
4042
+ }
4043
+ /**
4044
+ * Converte um valor em um número inteiro.
4045
+ * @param {InterpretadorInterface} interpretador A instância do interpretador.
4046
+ * @param {VariavelInterface | any} valorParaConverter O valor a ser convertido.
4047
+ * @returns {Promise<any>} Uma Promise com o resultado da conversão.
4048
+ */
4049
+ async function inteiro(interpretador, valorParaConverter) {
4050
+ if (valorParaConverter === null || valorParaConverter === undefined)
4051
+ return Promise.resolve(0);
4052
+ const valor = valorParaConverter.hasOwnProperty('valor') ? valorParaConverter.valor : valorParaConverter;
4053
+ const resultadoValidacao = validacaoComumNumeros(valor);
4054
+ return resultadoValidacao || Promise.resolve(parseInt(valor));
4043
4055
  }
4044
4056
  /**
4045
4057
  *
@@ -4065,6 +4077,19 @@ async function mapear(interpretador, vetor, funcaoMapeamento) {
4065
4077
  }
4066
4078
  return resultados;
4067
4079
  }
4080
+ /**
4081
+ * Converte um valor em um número, com parte decimal ou não.
4082
+ * @param {InterpretadorInterface} interpretador A instância do interpretador.
4083
+ * @param {VariavelInterface | any} valorParaConverter O valor a ser convertido.
4084
+ * @returns {Promise<any>} Uma Promise com o resultado da conversão.
4085
+ */
4086
+ async function numero(interpretador, valorParaConverter) {
4087
+ if (valorParaConverter === null || valorParaConverter === undefined)
4088
+ return Promise.resolve(0);
4089
+ const valor = valorParaConverter.hasOwnProperty('valor') ? valorParaConverter.valor : valorParaConverter;
4090
+ const resultadoValidacao = validacaoComumNumeros(valor);
4091
+ return resultadoValidacao || Promise.resolve(Number(valor));
4092
+ }
4068
4093
  /**
4069
4094
  *
4070
4095
  * @param vetor
@@ -4294,13 +4319,13 @@ exports.default = {
4294
4319
  tipoRetorno: 'texto[]',
4295
4320
  implementacao: (interpretador, valor) => {
4296
4321
  return Promise.resolve(Object.keys(valor));
4297
- }
4322
+ },
4298
4323
  },
4299
4324
  valores: {
4300
4325
  tipoRetorno: 'qualquer[]',
4301
4326
  implementacao: (interpretador, valor) => {
4302
4327
  return Promise.resolve(Object.values(valor));
4303
- }
4328
+ },
4304
4329
  },
4305
4330
  };
4306
4331
 
@@ -4312,13 +4337,13 @@ exports.default = {
4312
4337
  tipoRetorno: 'número',
4313
4338
  implementacao: (interpretador, valor) => {
4314
4339
  return Promise.resolve(Math.floor(valor));
4315
- }
4340
+ },
4316
4341
  },
4317
4342
  arredondarParaCima: {
4318
4343
  tipoRetorno: 'número',
4319
4344
  implementacao: (interpretador, valor) => {
4320
4345
  return Promise.resolve(Math.ceil(valor));
4321
- }
4346
+ },
4322
4347
  },
4323
4348
  };
4324
4349
 
@@ -4328,19 +4353,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
4328
4353
  exports.default = {
4329
4354
  aparar: {
4330
4355
  tipoRetorno: 'texto',
4331
- implementacao: (interpretador, texto) => Promise.resolve(texto.trim())
4356
+ implementacao: (interpretador, texto) => Promise.resolve(texto.trim()),
4332
4357
  },
4333
4358
  apararFim: {
4334
4359
  tipoRetorno: 'texto',
4335
- implementacao: (interpretador, texto) => Promise.resolve(texto.trimEnd())
4360
+ implementacao: (interpretador, texto) => Promise.resolve(texto.trimEnd()),
4336
4361
  },
4337
4362
  apararInicio: {
4338
4363
  tipoRetorno: 'texto',
4339
- implementacao: (interpretador, texto) => Promise.resolve(texto.trimStart())
4364
+ implementacao: (interpretador, texto) => Promise.resolve(texto.trimStart()),
4340
4365
  },
4341
4366
  concatenar: {
4342
4367
  tipoRetorno: 'texto',
4343
- implementacao: (interpretador, ...texto) => Promise.resolve(''.concat(...texto))
4368
+ implementacao: (interpretador, ...texto) => Promise.resolve(''.concat(...texto)),
4344
4369
  },
4345
4370
  dividir: {
4346
4371
  tipoRetorno: 'texto[]',
@@ -4349,40 +4374,40 @@ exports.default = {
4349
4374
  return Promise.resolve(texto.split(divisor, limite));
4350
4375
  }
4351
4376
  return Promise.resolve(texto.split(divisor));
4352
- }
4377
+ },
4353
4378
  },
4354
4379
  fatiar: {
4355
4380
  tipoRetorno: 'texto',
4356
- implementacao: (interpretador, texto, inicio, fim) => Promise.resolve(texto.slice(inicio, fim))
4381
+ implementacao: (interpretador, texto, inicio, fim) => Promise.resolve(texto.slice(inicio, fim)),
4357
4382
  },
4358
4383
  inclui: {
4359
4384
  tipoRetorno: 'texto',
4360
- implementacao: (interpretador, texto, elemento) => Promise.resolve(texto.includes(elemento))
4385
+ implementacao: (interpretador, texto, elemento) => Promise.resolve(texto.includes(elemento)),
4361
4386
  },
4362
4387
  inverter: {
4363
4388
  tipoRetorno: 'texto',
4364
- implementacao: (interpretador, texto) => Promise.resolve(texto.split('').reduce((texto, caracter) => (texto = caracter + texto), ''))
4389
+ implementacao: (interpretador, texto) => Promise.resolve(texto.split('').reduce((texto, caracter) => (texto = caracter + texto), '')),
4365
4390
  },
4366
4391
  maiusculo: {
4367
4392
  tipoRetorno: 'texto',
4368
- implementacao: (interpretador, texto) => Promise.resolve(texto.toUpperCase())
4393
+ implementacao: (interpretador, texto) => Promise.resolve(texto.toUpperCase()),
4369
4394
  },
4370
4395
  minusculo: {
4371
4396
  tipoRetorno: 'texto',
4372
- implementacao: (interpretador, texto) => Promise.resolve(texto.toLowerCase())
4397
+ implementacao: (interpretador, texto) => Promise.resolve(texto.toLowerCase()),
4373
4398
  },
4374
4399
  substituir: {
4375
4400
  tipoRetorno: 'texto',
4376
- implementacao: (interpretador, texto, elemento, substituto) => Promise.resolve(texto.replace(elemento, substituto))
4401
+ implementacao: (interpretador, texto, elemento, substituto) => Promise.resolve(texto.replace(elemento, substituto)),
4377
4402
  },
4378
4403
  subtexto: {
4379
4404
  tipoRetorno: 'texto',
4380
- implementacao: (interpretador, texto, inicio, fim) => Promise.resolve(texto.slice(inicio, fim))
4405
+ implementacao: (interpretador, texto, inicio, fim) => Promise.resolve(texto.slice(inicio, fim)),
4381
4406
  },
4382
4407
  tamanho: {
4383
4408
  tipoRetorno: 'número',
4384
- implementacao: (interpretador, texto) => Promise.resolve(texto.length)
4385
- }
4409
+ implementacao: (interpretador, texto) => Promise.resolve(texto.length),
4410
+ },
4386
4411
  };
4387
4412
 
4388
4413
  },{}],19:[function(require,module,exports){
@@ -4394,20 +4419,20 @@ exports.default = {
4394
4419
  implementacao: (interpretador, vetor, elemento) => {
4395
4420
  vetor.push(elemento);
4396
4421
  return Promise.resolve(vetor);
4397
- }
4422
+ },
4398
4423
  },
4399
4424
  concatenar: {
4400
4425
  tipoRetorno: 'qualquer[]',
4401
4426
  implementacao: (interpretador, vetor, outroVetor) => {
4402
4427
  return Promise.resolve(vetor.concat(outroVetor));
4403
- }
4428
+ },
4404
4429
  },
4405
4430
  empilhar: {
4406
4431
  tipoRetorno: 'qualquer[]',
4407
4432
  implementacao: (interpretador, vetor, elemento) => {
4408
4433
  vetor.push(elemento);
4409
4434
  return Promise.resolve(vetor);
4410
- }
4435
+ },
4411
4436
  },
4412
4437
  encaixar: {
4413
4438
  tipoRetorno: 'qualquer[]',
@@ -4422,7 +4447,7 @@ exports.default = {
4422
4447
  elementos = !items.length ? vetor.splice(inicio) : vetor.splice(inicio, ...items);
4423
4448
  }
4424
4449
  return Promise.resolve(elementos);
4425
- }
4450
+ },
4426
4451
  },
4427
4452
  fatiar: {
4428
4453
  tipoRetorno: 'qualquer[]',
@@ -4441,19 +4466,19 @@ exports.default = {
4441
4466
  }
4442
4467
  }
4443
4468
  return retorno;
4444
- }
4469
+ },
4445
4470
  },
4446
4471
  inclui: {
4447
4472
  tipoRetorno: 'lógico',
4448
- implementacao: (interpretador, vetor, elemento) => Promise.resolve(vetor.includes(elemento))
4473
+ implementacao: (interpretador, vetor, elemento) => Promise.resolve(vetor.includes(elemento)),
4449
4474
  },
4450
4475
  inverter: {
4451
4476
  tipoRetorno: 'qualquer[]',
4452
- implementacao: (interpretador, vetor) => Promise.resolve(vetor.reverse())
4477
+ implementacao: (interpretador, vetor) => Promise.resolve(vetor.reverse()),
4453
4478
  },
4454
4479
  juntar: {
4455
4480
  tipoRetorno: 'texto',
4456
- implementacao: (interpretador, vetor, separador) => Promise.resolve(vetor.join(separador))
4481
+ implementacao: (interpretador, vetor, separador) => Promise.resolve(vetor.join(separador)),
4457
4482
  },
4458
4483
  mapear: {
4459
4484
  tipoRetorno: 'qualquer[]',
@@ -4467,7 +4492,7 @@ exports.default = {
4467
4492
  retorno.push(resultado);
4468
4493
  }
4469
4494
  return retorno;
4470
- }
4495
+ },
4471
4496
  },
4472
4497
  ordenar: {
4473
4498
  tipoRetorno: 'qualquer[]',
@@ -4488,7 +4513,7 @@ exports.default = {
4488
4513
  return vetor.sort();
4489
4514
  }
4490
4515
  return vetor.sort((a, b) => a - b);
4491
- }
4516
+ },
4492
4517
  },
4493
4518
  remover: {
4494
4519
  tipoRetorno: 'qualquer[]',
@@ -4497,32 +4522,32 @@ exports.default = {
4497
4522
  if (index !== -1)
4498
4523
  vetor.splice(index, 1);
4499
4524
  return Promise.resolve(vetor);
4500
- }
4525
+ },
4501
4526
  },
4502
4527
  removerPrimeiro: {
4503
4528
  tipoRetorno: 'qualquer',
4504
4529
  implementacao: (interpretador, vetor) => {
4505
4530
  let elemento = vetor.shift();
4506
4531
  return Promise.resolve(elemento);
4507
- }
4532
+ },
4508
4533
  },
4509
4534
  removerUltimo: {
4510
4535
  tipoRetorno: 'qualquer',
4511
4536
  implementacao: (interpretador, vetor) => {
4512
4537
  let elemento = vetor.pop();
4513
4538
  return Promise.resolve(elemento);
4514
- }
4539
+ },
4515
4540
  },
4516
4541
  somar: {
4517
4542
  tipoRetorno: 'qualquer',
4518
4543
  implementacao: (interpretador, vetor) => {
4519
4544
  return Promise.resolve(vetor.reduce((acc, item) => acc + (typeof item === 'number' ? item : item.valor), 0));
4520
- }
4545
+ },
4521
4546
  },
4522
4547
  tamanho: {
4523
4548
  tipoRetorno: 'número',
4524
- implementacao: (interpretador, vetor) => Promise.resolve(vetor.length)
4525
- }
4549
+ implementacao: (interpretador, vetor) => Promise.resolve(vetor.length),
4550
+ },
4526
4551
  };
4527
4552
 
4528
4553
  },{}],20:[function(require,module,exports){
@@ -4830,7 +4855,7 @@ class ComponenteLinguagem {
4830
4855
  this.valor = simbolo.lexema;
4831
4856
  }
4832
4857
  aceitar(visitante) {
4833
- throw new Error("Um componente de linguagem não tem método de visita.");
4858
+ throw new Error('Um componente de linguagem não tem método de visita.');
4834
4859
  }
4835
4860
  }
4836
4861
  exports.ComponenteLinguagem = ComponenteLinguagem;
@@ -7530,6 +7555,8 @@ function carregarBibliotecasGlobais(pilhaEscoposExecucao) {
7530
7555
  pilhaEscoposExecucao.definirVariavel('incluido', new funcao_padrao_1.FuncaoPadrao(2, bibliotecaGlobal.incluido));
7531
7556
  pilhaEscoposExecucao.definirVariavel('inteiro', new funcao_padrao_1.FuncaoPadrao(1, bibliotecaGlobal.inteiro));
7532
7557
  pilhaEscoposExecucao.definirVariavel('mapear', new funcao_padrao_1.FuncaoPadrao(2, bibliotecaGlobal.mapear));
7558
+ pilhaEscoposExecucao.definirVariavel('numero', new funcao_padrao_1.FuncaoPadrao(1, bibliotecaGlobal.numero));
7559
+ pilhaEscoposExecucao.definirVariavel('número', new funcao_padrao_1.FuncaoPadrao(1, bibliotecaGlobal.numero));
7533
7560
  pilhaEscoposExecucao.definirVariavel('ordenar', new funcao_padrao_1.FuncaoPadrao(1, bibliotecaGlobal.ordenar));
7534
7561
  pilhaEscoposExecucao.definirVariavel('paraCada', new funcao_padrao_1.FuncaoPadrao(2, bibliotecaGlobal.paraCada));
7535
7562
  pilhaEscoposExecucao.definirVariavel('primeiroEmCondicao', new funcao_padrao_1.FuncaoPadrao(2, bibliotecaGlobal.primeiroEmCondicao));
@@ -7684,7 +7711,7 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
7684
7711
  argumentos[i].valor = parametro['padrao'] ? parametro['padrao'].valor : null;
7685
7712
  }
7686
7713
  ambiente.valores[nome] = argumento && argumento.hasOwnProperty('valor') ? argumento.valor : argumento;
7687
- // Se o argumento é `DeleguaFuncao`, para habilitar o recurso de _currying_,
7714
+ // Se o argumento é `DeleguaFuncao`, para habilitar o recurso de _currying_,
7688
7715
  // copiamos seu valor para o escopo atual. Nem sempre podemos contar com a tipagem explícita aqui.
7689
7716
  if (argumento.valor && ['funcao', 'função'].includes(argumento.valor.tipo)) {
7690
7717
  parametro.referencia = true;
@@ -8578,7 +8605,7 @@ class InterpretadorBase {
8578
8605
  for (let i = 0; i < diferenca; i++) {
8579
8606
  argumentos.push({
8580
8607
  nome: null,
8581
- valor: null
8608
+ valor: null,
8582
8609
  });
8583
8610
  }
8584
8611
  }
@@ -8891,7 +8918,9 @@ class InterpretadorBase {
8891
8918
  }
8892
8919
  else {
8893
8920
  const literalErro = new construtos_1.Literal(declaracao.hashArquivo, Number(declaracao.linha), erro.mensagem);
8894
- const chamadaPegue = new construtos_1.Chamada(declaracao.caminhoPegue.hashArquivo, declaracao.caminhoPegue, [literalErro]);
8921
+ const chamadaPegue = new construtos_1.Chamada(declaracao.caminhoPegue.hashArquivo, declaracao.caminhoPegue, [
8922
+ literalErro,
8923
+ ]);
8895
8924
  valorRetorno = await chamadaPegue.aceitar(this);
8896
8925
  }
8897
8926
  }
@@ -9418,7 +9447,8 @@ class InterpretadorBase {
9418
9447
  this.erros.push(retornoOuErro);
9419
9448
  }
9420
9449
  }
9421
- catch (erro) { // TODO: Estudar remoção do `catch`.
9450
+ catch (erro) {
9451
+ // TODO: Estudar remoção do `catch`.
9422
9452
  throw new Error(`Não deveria estar caindo aqui. Há erros no interpretador que não estão tratados corretamente. Erro atual: ${JSON.stringify(erro)}.`);
9423
9453
  }
9424
9454
  finally {
@@ -10267,9 +10297,9 @@ class Interpretador extends interpretador_base_1.InterpretadorBase {
10267
10297
  const acessoPropriedade = valorTipoDe;
10268
10298
  return acessoPropriedade.tipoRetornoPropriedade;
10269
10299
  case 'AcessoMetodoOuPropriedade':
10270
- // TODO: Deve ser removido mais futuramente.
10300
+ // TODO: Deve ser removido mais futuramente.
10271
10301
  // Apenas `AcessoMetodo` e `AcessoPropriedade` devem funcionar aqui.
10272
- throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simbolo, "Não deveria cair aqui.");
10302
+ throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simbolo, 'Não deveria cair aqui.');
10273
10303
  case 'Escreva':
10274
10304
  return 'função<vazio>';
10275
10305
  case 'Leia':
@@ -10437,9 +10467,9 @@ class PilhaEscoposExecucao {
10437
10467
  if (variavel.imutavel) {
10438
10468
  throw new excecoes_1.ErroEmTempoDeExecucao(simbolo, `Constante '${simbolo.lexema}' não pode receber novos valores.`);
10439
10469
  }
10440
- const tipoInferido = variavel && variavel.hasOwnProperty('tipo') && variavel.tipo ?
10441
- variavel.tipo :
10442
- (0, inferenciador_1.inferirTipoVariavel)(valor);
10470
+ const tipoInferido = variavel && variavel.hasOwnProperty('tipo') && variavel.tipo
10471
+ ? variavel.tipo
10472
+ : (0, inferenciador_1.inferirTipoVariavel)(valor);
10443
10473
  const tipo = tipoInferido.toLowerCase();
10444
10474
  const valorResolvido = this.converterValor(tipo, valor);
10445
10475
  if (indice !== undefined && indice !== null) {
@@ -12820,6 +12850,7 @@ exports.default = {
12820
12850
  NEGACAO: 'NEGACAO',
12821
12851
  NULO: 'NULO',
12822
12852
  NUMERO: 'NUMERO',
12853
+ NÚMERO: 'NÚMERO',
12823
12854
  OU: 'OU',
12824
12855
  PADRAO: 'PADRAO',
12825
12856
  PADRÃO: 'PADRÃO',
@@ -26026,7 +26057,8 @@ class TradutorAssemblyScript {
26026
26057
  case 'Retorna':
26027
26058
  const declaracaoRetorna = declaracao;
26028
26059
  resultado +=
26029
- 'return ' + this.dicionarioConstrutos[declaracaoRetorna.valor.constructor.name](declaracaoRetorna.valor);
26060
+ 'return ' +
26061
+ this.dicionarioConstrutos[declaracaoRetorna.valor.constructor.name](declaracaoRetorna.valor);
26030
26062
  break;
26031
26063
  default:
26032
26064
  resultado += this.dicionarioDeclaracoes[declaracao.constructor.name](declaracao) + '\n';
@@ -26341,7 +26373,7 @@ class TradutorJavaScript {
26341
26373
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
26342
26374
  argumentosResolvidos.push(argumentoResolvido);
26343
26375
  }
26344
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
26376
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
26345
26377
  textoArgumentos = textoArgumentos.slice(0, -2);
26346
26378
  switch (nomeMetodo) {
26347
26379
  case 'adicionar':
@@ -26441,7 +26473,7 @@ class TradutorJavaScript {
26441
26473
  let resultado = '{';
26442
26474
  for (let i = 0; i < dicionario.chaves.length; i++) {
26443
26475
  resultado += this.dicionarioConstrutos[dicionario.chaves[i].constructor.name](dicionario.chaves[i]);
26444
- resultado += ":";
26476
+ resultado += ':';
26445
26477
  resultado += this.dicionarioConstrutos[dicionario.valores[i].constructor.name](dicionario.valores[i]) + ',';
26446
26478
  }
26447
26479
  resultado += '}';
@@ -26452,10 +26484,14 @@ class TradutorJavaScript {
26452
26484
  const possuiInterpolacao = /\$\{(verdadeiro|falso|nulo)\}/.test(literal.valor);
26453
26485
  const valor = literal.valor.replace(/\$\{(verdadeiro|falso|nulo)\}/g, (_, match) => {
26454
26486
  switch (match) {
26455
- case 'verdadeiro': return '${true}';
26456
- case 'falso': return '${false}';
26457
- case 'nulo': return '${null}';
26458
- default: return match;
26487
+ case 'verdadeiro':
26488
+ return '${true}';
26489
+ case 'falso':
26490
+ return '${false}';
26491
+ case 'nulo':
26492
+ return '${null}';
26493
+ default:
26494
+ return match;
26459
26495
  }
26460
26496
  });
26461
26497
  return possuiInterpolacao ? `\`${valor}\`` : `'${literal.valor}'`;
@@ -26469,13 +26505,13 @@ class TradutorJavaScript {
26469
26505
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
26470
26506
  argumentosResolvidos.push(argumentoResolvido);
26471
26507
  }
26472
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
26508
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
26473
26509
  textoArgumentos = textoArgumentos.slice(0, -2);
26474
26510
  switch (variavel.simbolo.lexema) {
26475
26511
  case 'texto':
26476
26512
  return `String(${textoArgumentos})`;
26477
26513
  default:
26478
- const buscaClasseCorrespondente = this.declaracoesDeClasses.filter(d => d.simbolo.lexema === variavel.simbolo.lexema);
26514
+ const buscaClasseCorrespondente = this.declaracoesDeClasses.filter((d) => d.simbolo.lexema === variavel.simbolo.lexema);
26479
26515
  if (buscaClasseCorrespondente.length === 0 && argumentosValidados.length === 0) {
26480
26516
  return `${variavel.simbolo.lexema}`;
26481
26517
  }
@@ -26563,7 +26599,8 @@ class TradutorJavaScript {
26563
26599
  case 'Retorna':
26564
26600
  const declaracaoRetorna = declaracao;
26565
26601
  resultado +=
26566
- 'return ' + this.dicionarioConstrutos[declaracaoRetorna.valor.constructor.name](declaracaoRetorna.valor);
26602
+ 'return ' +
26603
+ this.dicionarioConstrutos[declaracaoRetorna.valor.constructor.name](declaracaoRetorna.valor);
26567
26604
  break;
26568
26605
  default:
26569
26606
  resultado += this.dicionarioDeclaracoes[declaracao.constructor.name](declaracao) + '\n';
@@ -26758,7 +26795,7 @@ class TradutorJavaScript {
26758
26795
  }
26759
26796
  // TODO: Talvez terminar (ou remover, sei lá).
26760
26797
  traduzirFuncaoAnonimaParaLambda(argumento) {
26761
- return "";
26798
+ return '';
26762
26799
  }
26763
26800
  traduzirAcessoMetodoVetor(objeto, nomeMetodo, argumentos) {
26764
26801
  const objetoResolvido = this.dicionarioConstrutos[objeto.constructor.name](objeto);
@@ -26770,7 +26807,7 @@ class TradutorJavaScript {
26770
26807
  switch (nomeMetodo) {
26771
26808
  case 'adicionar':
26772
26809
  case 'empilhar':
26773
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
26810
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
26774
26811
  textoArgumentos = textoArgumentos.slice(0, -2);
26775
26812
  return `${objetoResolvido}.push(${textoArgumentos})`;
26776
26813
  case 'fatiar':
@@ -26871,7 +26908,7 @@ class TradutorJavaScript {
26871
26908
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
26872
26909
  argumentosResolvidos.push(argumentoResolvido);
26873
26910
  }
26874
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
26911
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
26875
26912
  textoArgumentos = textoArgumentos.slice(0, -2);
26876
26913
  return `${argumentoReferenciaFuncao.simboloFuncao.lexema}(${textoArgumentos})`;
26877
26914
  }
@@ -26881,7 +26918,7 @@ class TradutorJavaScript {
26881
26918
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
26882
26919
  argumentosResolvidos.push(argumentoResolvido);
26883
26920
  }
26884
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
26921
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
26885
26922
  textoArgumentos = textoArgumentos.slice(0, -2);
26886
26923
  return `${referenciaFuncao.simboloFuncao.lexema}(${textoArgumentos})`;
26887
26924
  }
@@ -27003,7 +27040,7 @@ class TradutorMermaidJs {
27003
27040
  Literal: this.traduzirConstrutoLiteral.bind(this),
27004
27041
  Unario: this.traduzirConstrutoUnario.bind(this),
27005
27042
  Variavel: this.traduzirConstrutoVariavel.bind(this),
27006
- Vetor: this.traduzirConstrutoVetor.bind(this)
27043
+ Vetor: this.traduzirConstrutoVetor.bind(this),
27007
27044
  };
27008
27045
  this.dicionarioDeclaracoes = {
27009
27046
  Bloco: this.traduzirDeclaracaoBloco.bind(this),
@@ -27016,7 +27053,7 @@ class TradutorMermaidJs {
27016
27053
  Para: this.traduzirDeclaracaoPara.bind(this),
27017
27054
  ParaCada: this.traduzirDeclaracaoParaCada.bind(this),
27018
27055
  Se: this.traduzirDeclaracaoSe.bind(this),
27019
- Var: this.traduzirDeclaracaoVar.bind(this)
27056
+ Var: this.traduzirDeclaracaoVar.bind(this),
27020
27057
  };
27021
27058
  }
27022
27059
  traduzirConstrutoAcessoIndiceVariavel(acessoIndiceVariavel) {
@@ -27049,7 +27086,7 @@ class TradutorMermaidJs {
27049
27086
  case delegua_1.default.MENOR:
27050
27087
  return `${operandoEsquerdo} for menor que ${operandoDireito}`;
27051
27088
  }
27052
- return "";
27089
+ return '';
27053
27090
  }
27054
27091
  traduzirConstrutoChamada(chamada) {
27055
27092
  const textoEntidadeChamada = this.dicionarioConstrutos[chamada.entidadeChamada.constructor.name](chamada.entidadeChamada);
@@ -27089,7 +27126,7 @@ class TradutorMermaidJs {
27089
27126
  return `função`;
27090
27127
  }
27091
27128
  traduzirConstrutoLeia(leia) {
27092
- let texto = "leia da entrada";
27129
+ let texto = 'leia da entrada';
27093
27130
  if (leia.argumentos && leia.argumentos.length > 0) {
27094
27131
  const textoArgumento = this.dicionarioConstrutos[leia.argumentos[0].constructor.name](leia.argumentos[0]);
27095
27132
  texto += `, imprimindo antes: \\'${textoArgumento}\\'`;
@@ -27108,7 +27145,7 @@ class TradutorMermaidJs {
27108
27145
  }
27109
27146
  traduzirConstrutoUnario(unario) {
27110
27147
  const textoOperando = this.dicionarioConstrutos[unario.operando.constructor.name](unario.operando);
27111
- let textoOperador = "";
27148
+ let textoOperador = '';
27112
27149
  switch (unario.operador.tipo) {
27113
27150
  case delegua_1.default.INCREMENTAR:
27114
27151
  textoOperador = `incrementar ${textoOperando} em 1`;
@@ -27118,9 +27155,9 @@ class TradutorMermaidJs {
27118
27155
  break;
27119
27156
  }
27120
27157
  switch (unario.incidenciaOperador) {
27121
- case "ANTES":
27158
+ case 'ANTES':
27122
27159
  return `${textoOperador}, devolver valor de ${textoOperando}`;
27123
- case "DEPOIS":
27160
+ case 'DEPOIS':
27124
27161
  return `devolver valor de ${textoOperando}, ${textoOperador}`;
27125
27162
  }
27126
27163
  }
@@ -27208,7 +27245,7 @@ class TradutorMermaidJs {
27208
27245
  this.anteriores.pop();
27209
27246
  return {
27210
27247
  caminho: arestaCondicaoCaminho,
27211
- declaracoesCaminho: verticesResolvidos
27248
+ declaracoesCaminho: verticesResolvidos,
27212
27249
  };
27213
27250
  }
27214
27251
  traduzirDeclaracaoEscolha(declaracaoEscolha) {
@@ -27562,7 +27599,7 @@ class TradutorPython {
27562
27599
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
27563
27600
  argumentosResolvidos.push(argumentoResolvido);
27564
27601
  }
27565
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
27602
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
27566
27603
  textoArgumentos = textoArgumentos.slice(0, -2);
27567
27604
  switch (nomeMetodo) {
27568
27605
  case 'adicionar':
@@ -27624,7 +27661,7 @@ class TradutorPython {
27624
27661
  }
27625
27662
  // TODO: Talvez terminar (ou remover, sei lá).
27626
27663
  traduzirFuncaoAnonimaParaLambda(argumento) {
27627
- return "";
27664
+ return '';
27628
27665
  }
27629
27666
  traduzirAcessoMetodoVetor(objeto, nomeMetodo, argumentos) {
27630
27667
  const objetoResolvido = this.dicionarioConstrutos[objeto.constructor.name](objeto);
@@ -27636,7 +27673,7 @@ class TradutorPython {
27636
27673
  switch (nomeMetodo) {
27637
27674
  case 'adicionar':
27638
27675
  case 'empilhar':
27639
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
27676
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
27640
27677
  textoArgumentos = textoArgumentos.slice(0, -2);
27641
27678
  return `${objetoResolvido}.append(${textoArgumentos})`;
27642
27679
  case 'fatiar':
@@ -27701,7 +27738,7 @@ class TradutorPython {
27701
27738
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
27702
27739
  argumentosResolvidos.push(argumentoResolvido);
27703
27740
  }
27704
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
27741
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
27705
27742
  textoArgumentos = textoArgumentos.slice(0, -2);
27706
27743
  return `${argumentoReferenciaFuncao.simboloFuncao.lexema}(${textoArgumentos})`;
27707
27744
  }
@@ -27806,7 +27843,7 @@ class TradutorPython {
27806
27843
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
27807
27844
  argumentosResolvidos.push(argumentoResolvido);
27808
27845
  }
27809
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
27846
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
27810
27847
  textoArgumentos = textoArgumentos.slice(0, -2);
27811
27848
  return `${referenciaFuncao.simboloFuncao.lexema}(${textoArgumentos})`;
27812
27849
  }
@@ -27827,7 +27864,7 @@ class TradutorPython {
27827
27864
  const argumentoResolvido = this.dicionarioConstrutos[argumento.constructor.name](argumento);
27828
27865
  argumentosResolvidos.push(argumentoResolvido);
27829
27866
  }
27830
- let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => atual += proximo + ', ', "");
27867
+ let textoArgumentos = argumentosResolvidos.reduce((atual, proximo) => (atual += proximo + ', '), '');
27831
27868
  textoArgumentos = textoArgumentos.slice(0, -2);
27832
27869
  switch (variavel.simbolo.lexema) {
27833
27870
  case 'texto':