@designliquido/delegua 1.16.2 → 1.17.0
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.d.ts +14 -0
- package/analisador-semantico/analisador-semantico.d.ts.map +1 -1
- package/analisador-semantico/analisador-semantico.js +15 -11
- package/analisador-semantico/analisador-semantico.js.map +1 -1
- package/analisador-semantico/dialetos/analisador-semantico-pitugues.d.ts +2 -1
- package/analisador-semantico/dialetos/analisador-semantico-pitugues.d.ts.map +1 -1
- package/analisador-semantico/dialetos/analisador-semantico-pitugues.js +87 -12
- package/analisador-semantico/dialetos/analisador-semantico-pitugues.js.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico-base.d.ts +1 -1
- package/avaliador-sintatico/avaliador-sintatico-base.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.d.ts +4 -4
- package/avaliador-sintatico/avaliador-sintatico.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.js +30 -20
- package/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/bin/package.json +1 -1
- package/construtos/ajuda-como-construto.d.ts +2 -2
- package/construtos/ajuda-como-construto.d.ts.map +1 -1
- package/construtos/ajuda-como-construto.js.map +1 -1
- package/declaracoes/se.d.ts +4 -7
- package/declaracoes/se.d.ts.map +1 -1
- package/declaracoes/se.js.map +1 -1
- package/declaracoes/var.d.ts +2 -2
- package/declaracoes/var.d.ts.map +1 -1
- package/declaracoes/var.js.map +1 -1
- package/interfaces/declaracoes/caminho-se-senao-interface.d.ts +7 -0
- package/interfaces/declaracoes/caminho-se-senao-interface.d.ts.map +1 -0
- package/interfaces/declaracoes/caminho-se-senao-interface.js +3 -0
- package/interfaces/declaracoes/caminho-se-senao-interface.js.map +1 -0
- package/interfaces/declaracoes/index.d.ts +2 -0
- package/interfaces/declaracoes/index.d.ts.map +1 -0
- package/interfaces/declaracoes/index.js +18 -0
- package/interfaces/declaracoes/index.js.map +1 -0
- package/interfaces/interpretador-interface.d.ts +1 -1
- package/interfaces/interpretador-interface.d.ts.map +1 -1
- package/interpretador/argumento-interface.d.ts +1 -1
- package/interpretador/argumento-interface.d.ts.map +1 -1
- package/interpretador/dialetos/pitugues/interpretador-pitugues.js +3 -3
- package/interpretador/dialetos/pitugues/interpretador-pitugues.js.map +1 -1
- package/interpretador/estruturas/chamavel.d.ts +1 -1
- package/interpretador/estruturas/chamavel.d.ts.map +1 -1
- package/interpretador/estruturas/chamavel.js +3 -0
- package/interpretador/estruturas/chamavel.js.map +1 -1
- package/interpretador/estruturas/delegua-funcao.d.ts +2 -2
- package/interpretador/estruturas/delegua-funcao.d.ts.map +1 -1
- package/interpretador/estruturas/delegua-funcao.js +2 -2
- package/interpretador/estruturas/delegua-funcao.js.map +1 -1
- package/interpretador/estruturas/funcao-padrao.d.ts +2 -2
- package/interpretador/estruturas/funcao-padrao.d.ts.map +1 -1
- package/interpretador/estruturas/funcao-padrao.js +4 -2
- package/interpretador/estruturas/funcao-padrao.js.map +1 -1
- package/interpretador/estruturas/metodo-polimorfico.d.ts +1 -1
- package/interpretador/estruturas/metodo-polimorfico.d.ts.map +1 -1
- package/interpretador/estruturas/metodo-polimorfico.js +2 -2
- package/interpretador/estruturas/metodo-polimorfico.js.map +1 -1
- package/interpretador/interpretador-base.d.ts +18 -11
- package/interpretador/interpretador-base.d.ts.map +1 -1
- package/interpretador/interpretador-base.js +101 -230
- package/interpretador/interpretador-base.js.map +1 -1
- package/interpretador/interpretador.d.ts +2 -6
- package/interpretador/interpretador.d.ts.map +1 -1
- package/interpretador/interpretador.js +126 -11
- package/interpretador/interpretador.js.map +1 -1
- package/lexador/lexador.d.ts.map +1 -1
- package/lexador/lexador.js +20 -1
- package/lexador/lexador.js.map +1 -1
- package/lexador/palavras-reservadas.d.ts +2 -86
- package/lexador/palavras-reservadas.d.ts.map +1 -1
- package/lexador/palavras-reservadas.js.map +1 -1
- package/package.json +1 -1
- package/tipos-de-simbolos/delegua.d.ts +1 -0
- package/tipos-de-simbolos/delegua.d.ts.map +1 -1
- package/tipos-de-simbolos/delegua.js +1 -0
- package/tipos-de-simbolos/delegua.js.map +1 -1
- package/tradutores/index.d.ts +1 -1
- package/tradutores/index.d.ts.map +1 -1
- package/tradutores/index.js +1 -1
- package/tradutores/index.js.map +1 -1
- package/tradutores/tradutor-assemblyscript.js +1 -1
- package/tradutores/tradutor-assemblyscript.js.map +1 -1
- package/tradutores/tradutor-javascript.js +1 -1
- package/tradutores/tradutor-javascript.js.map +1 -1
- package/tradutores/tradutor-reverso-calango.d.ts +45 -0
- package/tradutores/tradutor-reverso-calango.d.ts.map +1 -0
- package/tradutores/tradutor-reverso-calango.js +351 -0
- package/tradutores/tradutor-reverso-calango.js.map +1 -0
- package/tradutores/tradutor-reverso-python.d.ts +58 -26
- package/tradutores/tradutor-reverso-python.d.ts.map +1 -1
- package/tradutores/tradutor-reverso-python.js +609 -52
- package/tradutores/tradutor-reverso-python.js.map +1 -1
- package/umd/delegua.js +1426 -588
- package/tradutores/tradutor-calango.d.ts +0 -23
- package/tradutores/tradutor-calango.d.ts.map +0 -1
- package/tradutores/tradutor-calango.js +0 -54
- package/tradutores/tradutor-calango.js.map +0 -1
package/umd/delegua.js
CHANGED
|
@@ -557,6 +557,13 @@ class AnalisadorSemantico extends analisador_semantico_base_1.AnalisadorSemantic
|
|
|
557
557
|
visitarExpressaoTipoDe(expressao) {
|
|
558
558
|
return this.verificarTipoDe(expressao.valor);
|
|
559
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Método recursivo para verificar o tipo de um construto, usado principalmente para validar
|
|
562
|
+
* o uso de `tipoDe` e `falhar()`.
|
|
563
|
+
* @param {Construto} valor O construto a ser avaliado.
|
|
564
|
+
* @returns {Promise<any>} O tipo do construto, ou `Promise.resolve()` se o tipo não puder ser
|
|
565
|
+
* determinado neste estágio da análise.
|
|
566
|
+
*/
|
|
560
567
|
verificarTipoDe(valor) {
|
|
561
568
|
switch (valor.constructor) {
|
|
562
569
|
case construtos_1.Agrupamento:
|
|
@@ -576,6 +583,13 @@ class AnalisadorSemantico extends analisador_semantico_base_1.AnalisadorSemantic
|
|
|
576
583
|
visitarExpressaoFalhar(expressao) {
|
|
577
584
|
return this.verificarFalhar(expressao.explicacao);
|
|
578
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Método recursivo para verificar se um construto passado para `falhar()` é válido, ou seja, se é
|
|
588
|
+
* do tipo texto ou pode ser avaliado como texto.
|
|
589
|
+
* @param {Construto} valor O construto a ser avaliado.
|
|
590
|
+
* @returns {Promise<any>} O tipo do construto, ou `Promise.resolve()` se o tipo não puder ser
|
|
591
|
+
* determinado neste estágio da análise.
|
|
592
|
+
*/
|
|
579
593
|
verificarFalhar(valor) {
|
|
580
594
|
if (valor instanceof construtos_1.Binario) {
|
|
581
595
|
this.verificarFalhar(valor.direita);
|
|
@@ -612,9 +626,7 @@ class AnalisadorSemantico extends analisador_semantico_base_1.AnalisadorSemantic
|
|
|
612
626
|
}
|
|
613
627
|
}
|
|
614
628
|
visitarChamadaPorArgumentoReferenciaFuncao(argumentoReferenciaFuncao, argumentos) {
|
|
615
|
-
const variavelCorrespondente =
|
|
616
|
-
// this.variaveis[argumentoReferenciaFuncao.simboloFuncao.lexema].valor;
|
|
617
|
-
this.gerenciadorEscopos.buscar(argumentoReferenciaFuncao.simboloFuncao.lexema)?.valor;
|
|
629
|
+
const variavelCorrespondente = this.gerenciadorEscopos.buscar(argumentoReferenciaFuncao.simboloFuncao.lexema)?.valor;
|
|
618
630
|
if (!variavelCorrespondente) {
|
|
619
631
|
return;
|
|
620
632
|
}
|
|
@@ -761,14 +773,6 @@ class AnalisadorSemantico extends analisador_semantico_base_1.AnalisadorSemantic
|
|
|
761
773
|
}
|
|
762
774
|
}
|
|
763
775
|
}
|
|
764
|
-
/* if (valor.imutavel) {
|
|
765
|
-
this.erro(simboloAlvo, `Constante ${simboloAlvo.lexema} não pode ser modificada.`);
|
|
766
|
-
return Promise.resolve();
|
|
767
|
-
} else {
|
|
768
|
-
if (this.variaveis[simboloAlvo.lexema]) {
|
|
769
|
-
this.variaveis[simboloAlvo.lexema].valor = expressao.valor;
|
|
770
|
-
}
|
|
771
|
-
} */
|
|
772
776
|
return Promise.resolve();
|
|
773
777
|
}
|
|
774
778
|
async visitarDeclaracaoDeExpressao(declaracao) {
|
|
@@ -2097,6 +2101,14 @@ const primitivas_vetor_1 = __importDefault(require("../bibliotecas/primitivas-ve
|
|
|
2097
2101
|
class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBase {
|
|
2098
2102
|
constructor(performance = false) {
|
|
2099
2103
|
super();
|
|
2104
|
+
this.pilhaDecoradores = [];
|
|
2105
|
+
this.simbolos = [];
|
|
2106
|
+
this.erros = [];
|
|
2107
|
+
this.tiposDefinidosEmCodigo = {};
|
|
2108
|
+
this.interfacesDeclaradas = {};
|
|
2109
|
+
this.tiposDefinidosPorBibliotecas = {};
|
|
2110
|
+
this.tiposDeFerramentasExternas = {};
|
|
2111
|
+
this.primitivasConhecidas = {};
|
|
2100
2112
|
this.hashArquivo = 0;
|
|
2101
2113
|
this.atual = 0;
|
|
2102
2114
|
this.blocos = 0;
|
|
@@ -2347,7 +2359,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
2347
2359
|
return new construtos_1.ListaCompreensao(Number(this.simbolos[this.atual]), this.hashArquivo, retornoExpressao, vetor, new construtos_1.ParaCadaComoConstruto(retornoExpressao.hashArquivo, retornoExpressao.linha, variavelIteracao, vetor, new declaracoes_1.Bloco(retornoExpressao.hashArquivo, retornoExpressao.linha, [
|
|
2348
2360
|
new declaracoes_1.Se(condicao, new declaracoes_1.Bloco(retornoExpressao.hashArquivo, retornoExpressao.linha, [
|
|
2349
2361
|
new declaracoes_1.Retorna(simboloVariavelIteracao, retornoExpressao),
|
|
2350
|
-
]), [],
|
|
2362
|
+
]), [], undefined),
|
|
2351
2363
|
])), retornoExpressao.tipo ? `${retornoExpressao.tipo}[]` : 'qualquer[]');
|
|
2352
2364
|
}
|
|
2353
2365
|
async primario() {
|
|
@@ -2570,7 +2582,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
2570
2582
|
construto = new construtos_1.AcessoMetodo(construtoTipado.hashArquivo, construtoTipado.objeto, construtoTipado.simbolo.lexema, primitivaVetorSelecionada.tipoRetorno);
|
|
2571
2583
|
break;
|
|
2572
2584
|
default:
|
|
2573
|
-
if (construtoTipado.tipo in this.tiposDefinidosEmCodigo) {
|
|
2585
|
+
if (construtoTipado.tipo && construtoTipado.tipo in this.tiposDefinidosEmCodigo) {
|
|
2574
2586
|
const tipoCorrespondente = this.tiposDefinidosEmCodigo[construtoTipado.tipo];
|
|
2575
2587
|
const possivelMetodo = tipoCorrespondente.metodos.filter((m) => m.simbolo.lexema === construtoTipado.simbolo.lexema);
|
|
2576
2588
|
if (possivelMetodo.length > 0) {
|
|
@@ -3210,7 +3222,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3210
3222
|
if (Array.isArray(retornoDeclaracao)) {
|
|
3211
3223
|
declaracoes = declaracoes.concat(retornoDeclaracao);
|
|
3212
3224
|
}
|
|
3213
|
-
else if (retornoDeclaracao
|
|
3225
|
+
else if (retornoDeclaracao != null) {
|
|
3214
3226
|
declaracoes.push(retornoDeclaracao);
|
|
3215
3227
|
}
|
|
3216
3228
|
}
|
|
@@ -3271,7 +3283,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3271
3283
|
const caminhoCondicoes = [await this.expressao()];
|
|
3272
3284
|
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' após o 'caso'.");
|
|
3273
3285
|
while (this.verificarTipoSimboloAtual(delegua_2.default.CASO)) {
|
|
3274
|
-
this.
|
|
3286
|
+
this.avancarEDevolverAnterior();
|
|
3275
3287
|
caminhoCondicoes.push(await this.expressao());
|
|
3276
3288
|
this.consumir(delegua_2.default.DOIS_PONTOS, "Esperado ':' após declaração do 'caso'.");
|
|
3277
3289
|
}
|
|
@@ -3400,6 +3412,8 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3400
3412
|
const identificadorModulo = this.avancarEDevolverAnterior();
|
|
3401
3413
|
construtoCaminhoModulo = new construtos_1.Literal(identificadorModulo.hashArquivo, Number(identificadorModulo.linha), identificadorModulo.lexema);
|
|
3402
3414
|
break;
|
|
3415
|
+
default:
|
|
3416
|
+
throw this.erro(this.simbolos[this.atual], "Esperado caminho do módulo como texto ou identificador em declaração de importação.");
|
|
3403
3417
|
}
|
|
3404
3418
|
const importar = new declaracoes_1.Importar(construtoCaminhoModulo);
|
|
3405
3419
|
if (identificadorDeTudo !== null) {
|
|
@@ -3570,7 +3584,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3570
3584
|
async declaracaoSe() {
|
|
3571
3585
|
const condicao = await this.expressao();
|
|
3572
3586
|
const caminhoEntao = (await this.resolverDeclaracao());
|
|
3573
|
-
let caminhoSenao =
|
|
3587
|
+
let caminhoSenao = undefined;
|
|
3574
3588
|
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.SENAO, delegua_2.default.SENÃO)) {
|
|
3575
3589
|
caminhoSenao = await this.resolverDeclaracao();
|
|
3576
3590
|
}
|
|
@@ -3687,7 +3701,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3687
3701
|
const inicializador = await this.expressao();
|
|
3688
3702
|
const retornos = [];
|
|
3689
3703
|
for (let identificador of identificadores) {
|
|
3690
|
-
this.pilhaEscopos.definirInformacoesVariavel(identificador.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(identificador.lexema, this.logicaComumInferenciaTiposVariaveisEConstantes(inicializador, 'qualquer')));
|
|
3704
|
+
this.pilhaEscopos.definirInformacoesVariavel(identificador.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(identificador.lexema, this.logicaComumInferenciaTiposVariaveisEConstantes(inicializador, 'qualquer') ?? 'qualquer'));
|
|
3691
3705
|
const declaracaoVar = new declaracoes_1.Var(identificador, new construtos_1.AcessoMetodoOuPropriedade(this.hashArquivo, inicializador, identificador));
|
|
3692
3706
|
declaracaoVar.decoradores = Array.from(this.pilhaDecoradores);
|
|
3693
3707
|
retornos.push(declaracaoVar);
|
|
@@ -3738,8 +3752,9 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3738
3752
|
if (entidadeChamadaAcessoIndiceVariavel.constructor === construtos_1.AcessoIndiceVariavel) {
|
|
3739
3753
|
return this.logicaComumInferenciaTiposVariaveisEConstantes(entidadeChamadaAcessoIndiceVariavel, tipo);
|
|
3740
3754
|
}
|
|
3741
|
-
|
|
3742
|
-
|
|
3755
|
+
const tipoEntidadeChamadaAcessoIndiceVariavel = entidadeChamadaAcessoIndiceVariavel.tipo;
|
|
3756
|
+
if (tipoEntidadeChamadaAcessoIndiceVariavel.endsWith('[]')) {
|
|
3757
|
+
return tipoEntidadeChamadaAcessoIndiceVariavel.slice(0, -2);
|
|
3743
3758
|
}
|
|
3744
3759
|
// Normalmente, `entidadeChamadaAcessoIndiceVariavel.tipo` aqui será 'vetor'.
|
|
3745
3760
|
return 'qualquer';
|
|
@@ -3842,7 +3857,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3842
3857
|
// Inicialização de variáveis sem valor.
|
|
3843
3858
|
for (let identificador of identificadores.values()) {
|
|
3844
3859
|
this.pilhaEscopos.definirInformacoesVariavel(identificador.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(identificador.lexema, tipo));
|
|
3845
|
-
retorno.push(new declaracoes_1.Var(identificador,
|
|
3860
|
+
retorno.push(new declaracoes_1.Var(identificador, undefined, tipo, tipoExplicito, Array.from(this.pilhaDecoradores)));
|
|
3846
3861
|
}
|
|
3847
3862
|
this.verificarSeSimboloAtualEIgualA(delegua_2.default.PONTO_E_VIRGULA);
|
|
3848
3863
|
this.pilhaDecoradores = [];
|
|
@@ -3857,7 +3872,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3857
3872
|
}
|
|
3858
3873
|
for (let [indice, identificador] of identificadores.entries()) {
|
|
3859
3874
|
const tipoOriginal = tipo; // Preserva o tipo antes da inferência
|
|
3860
|
-
tipo = this.logicaComumInferenciaTiposVariaveisEConstantes(inicializadores[indice], tipo);
|
|
3875
|
+
tipo = this.logicaComumInferenciaTiposVariaveisEConstantes(inicializadores[indice], tipo) ?? tipo;
|
|
3861
3876
|
if (tipo !== 'dicionário') {
|
|
3862
3877
|
this.pilhaEscopos.definirInformacoesVariavel(identificador.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(identificador.lexema, tipo));
|
|
3863
3878
|
}
|
|
@@ -3925,7 +3940,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3925
3940
|
let retorno = [];
|
|
3926
3941
|
for (let [indice, identificador] of identificadores.entries()) {
|
|
3927
3942
|
// Se tipo ainda não foi definido, infere.
|
|
3928
|
-
tipo = this.logicaComumInferenciaTiposVariaveisEConstantes(inicializadores[indice], tipo);
|
|
3943
|
+
tipo = this.logicaComumInferenciaTiposVariaveisEConstantes(inicializadores[indice], tipo) ?? tipo;
|
|
3929
3944
|
if (tipo !== 'dicionário') {
|
|
3930
3945
|
this.pilhaEscopos.definirInformacoesVariavel(identificador.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(identificador.lexema, tipo));
|
|
3931
3946
|
}
|
|
@@ -3965,8 +3980,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
3965
3980
|
const parametros = [];
|
|
3966
3981
|
do {
|
|
3967
3982
|
const parametro = {};
|
|
3968
|
-
if (this.
|
|
3969
|
-
this.consumir(delegua_2.default.MULTIPLICACAO, null);
|
|
3983
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_2.default.RETICENCIAS)) {
|
|
3970
3984
|
parametro.abrangencia = 'multiplo';
|
|
3971
3985
|
}
|
|
3972
3986
|
else {
|
|
@@ -4163,7 +4177,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4163
4177
|
continue;
|
|
4164
4178
|
}
|
|
4165
4179
|
// Documentário (/** ... */)
|
|
4166
|
-
let docAtual =
|
|
4180
|
+
let docAtual = undefined;
|
|
4167
4181
|
if (this.simbolos[this.atual].tipo === delegua_2.default.DOCUMENTARIO) {
|
|
4168
4182
|
const simboloDoc = this.avancarEDevolverAnterior();
|
|
4169
4183
|
docAtual = new construtos_1.ComentarioComoConstruto(simboloDoc);
|
|
@@ -4566,10 +4580,10 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4566
4580
|
await this.resolverDecoradores();
|
|
4567
4581
|
}
|
|
4568
4582
|
// Documentário (/** ... */) antes de uma declaração de função.
|
|
4569
|
-
let
|
|
4583
|
+
let documentacaoTopo = undefined;
|
|
4570
4584
|
if (this.verificarTipoSimboloAtual(delegua_2.default.DOCUMENTARIO)) {
|
|
4571
4585
|
const simboloDoc = this.avancarEDevolverAnterior();
|
|
4572
|
-
|
|
4586
|
+
documentacaoTopo = new construtos_1.ComentarioComoConstruto(simboloDoc);
|
|
4573
4587
|
}
|
|
4574
4588
|
// Decoradores podem aparecer após um documentário.
|
|
4575
4589
|
while (this.verificarTipoSimboloAtual(delegua_2.default.ARROBA)) {
|
|
@@ -4586,13 +4600,13 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4586
4600
|
}
|
|
4587
4601
|
const declaracaoFuncao = (await this.funcao('funcao'));
|
|
4588
4602
|
declaracaoFuncao.eFuncaoDeDecorador = true;
|
|
4589
|
-
declaracaoFuncao.documentacao =
|
|
4603
|
+
declaracaoFuncao.documentacao = documentacaoTopo;
|
|
4590
4604
|
return declaracaoFuncao;
|
|
4591
4605
|
}
|
|
4592
4606
|
if (this.verificarTipoProximoSimbolo(delegua_2.default.IDENTIFICADOR)) {
|
|
4593
4607
|
this.avancarEDevolverAnterior();
|
|
4594
4608
|
const declaracaoFuncao = (await this.funcao('funcao'));
|
|
4595
|
-
declaracaoFuncao.documentacao =
|
|
4609
|
+
declaracaoFuncao.documentacao = documentacaoTopo;
|
|
4596
4610
|
return declaracaoFuncao;
|
|
4597
4611
|
}
|
|
4598
4612
|
}
|
|
@@ -4610,7 +4624,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4610
4624
|
catch (erro) {
|
|
4611
4625
|
this.sincronizar();
|
|
4612
4626
|
this.erros.push(erro);
|
|
4613
|
-
return
|
|
4627
|
+
return undefined;
|
|
4614
4628
|
}
|
|
4615
4629
|
}
|
|
4616
4630
|
/**
|
|
@@ -4925,7 +4939,7 @@ class AvaliadorSintatico extends avaliador_sintatico_base_1.AvaliadorSintaticoBa
|
|
|
4925
4939
|
if (Array.isArray(retornoDeclaracao)) {
|
|
4926
4940
|
declaracoes = declaracoes.concat(retornoDeclaracao);
|
|
4927
4941
|
}
|
|
4928
|
-
else if (retornoDeclaracao
|
|
4942
|
+
else if (retornoDeclaracao != null) {
|
|
4929
4943
|
declaracoes.push(retornoDeclaracao);
|
|
4930
4944
|
}
|
|
4931
4945
|
}
|
|
@@ -18505,6 +18519,9 @@ exports.EspacoMemoria = EspacoMemoria;
|
|
|
18505
18519
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18506
18520
|
exports.Chamavel = void 0;
|
|
18507
18521
|
class Chamavel {
|
|
18522
|
+
constructor() {
|
|
18523
|
+
this.valorAridade = 0;
|
|
18524
|
+
}
|
|
18508
18525
|
aridade() {
|
|
18509
18526
|
return this.valorAridade;
|
|
18510
18527
|
}
|
|
@@ -18642,7 +18659,7 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
18642
18659
|
this.eInicializador = eInicializador;
|
|
18643
18660
|
}
|
|
18644
18661
|
aridade() {
|
|
18645
|
-
return this.declaracao?.parametros?.length || 0;
|
|
18662
|
+
return this.declaracao?.parametros?.filter(p => p.abrangencia !== 'multiplo').length || 0;
|
|
18646
18663
|
}
|
|
18647
18664
|
/**
|
|
18648
18665
|
* Método utilizado por Delégua para representar esta função quando impressa.
|
|
@@ -18709,7 +18726,7 @@ class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
|
18709
18726
|
else {
|
|
18710
18727
|
let argumento = argumentos[i];
|
|
18711
18728
|
if (argumento.valor === null) {
|
|
18712
|
-
argumentos[i].valor = parametro
|
|
18729
|
+
argumentos[i].valor = parametro.valorPadrao ? parametro.valorPadrao : null;
|
|
18713
18730
|
}
|
|
18714
18731
|
ambiente.valores[nome] =
|
|
18715
18732
|
argumento && argumento.hasOwnProperty('valor') ? argumento.valor : argumento;
|
|
@@ -19142,7 +19159,9 @@ class FuncaoPadrao extends chamavel_1.Chamavel {
|
|
|
19142
19159
|
this.funcao = funcao;
|
|
19143
19160
|
}
|
|
19144
19161
|
async chamar(visitante, argumentos, simbolo) {
|
|
19145
|
-
|
|
19162
|
+
if (simbolo) {
|
|
19163
|
+
this.simbolo = simbolo;
|
|
19164
|
+
}
|
|
19146
19165
|
return await this.funcao.apply(this, [visitante, ...argumentos]);
|
|
19147
19166
|
}
|
|
19148
19167
|
/**
|
|
@@ -19150,7 +19169,7 @@ class FuncaoPadrao extends chamavel_1.Chamavel {
|
|
|
19150
19169
|
* @returns {string} A representação da função como texto.
|
|
19151
19170
|
*/
|
|
19152
19171
|
paraTexto() {
|
|
19153
|
-
return `<função-padrão nome=${this.simbolo
|
|
19172
|
+
return `<função-padrão nome=${this.simbolo?.lexema || '(função anônima)'} />`;
|
|
19154
19173
|
}
|
|
19155
19174
|
/**
|
|
19156
19175
|
* Método utilizado pelo VSCode para representar esta função quando impressa.
|
|
@@ -19267,7 +19286,7 @@ class MetodoPolimorfico extends chamavel_1.Chamavel {
|
|
|
19267
19286
|
resolverSobrecarga(argumentos) {
|
|
19268
19287
|
const numArgs = argumentos.length;
|
|
19269
19288
|
let melhorPontuacao = -1;
|
|
19270
|
-
let melhorSobrecarga =
|
|
19289
|
+
let melhorSobrecarga = undefined;
|
|
19271
19290
|
for (const sobrecarga of this.sobrecargas) {
|
|
19272
19291
|
const parametros = sobrecarga.declaracao?.parametros || [];
|
|
19273
19292
|
const aridade = sobrecarga.aridade();
|
|
@@ -19332,7 +19351,7 @@ class MetodoPolimorfico extends chamavel_1.Chamavel {
|
|
|
19332
19351
|
const tipos = params.map((p) => p.tipoDado || 'qualquer');
|
|
19333
19352
|
return `${this.nome}(${tipos.join(', ')})`;
|
|
19334
19353
|
});
|
|
19335
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
19354
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(this.instancia?.classe.simboloOriginal, `Nenhuma sobrecarga do método "${this.nome}" corresponde aos argumentos fornecidos (${tiposArgs.join(', ')}). ` +
|
|
19336
19355
|
`Sobrecargas disponíveis: ${assinaturas.join('; ')}.`);
|
|
19337
19356
|
}
|
|
19338
19357
|
return melhorSobrecarga;
|
|
@@ -19815,7 +19834,6 @@ __exportStar(require("./interpretador"), exports);
|
|
|
19815
19834
|
__exportStar(require("./interpretador-base"), exports);
|
|
19816
19835
|
|
|
19817
19836
|
},{"./estruturas":180,"./interpretador":191,"./interpretador-base":190}],190:[function(require,module,exports){
|
|
19818
|
-
(function (process,setImmediate){(function (){
|
|
19819
19837
|
"use strict";
|
|
19820
19838
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19821
19839
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -19848,14 +19866,16 @@ const primitivas_vetor_1 = __importDefault(require("../bibliotecas/primitivas-ve
|
|
|
19848
19866
|
* recomendado para uso em execuções que ocorrem no navegador de internet.
|
|
19849
19867
|
*/
|
|
19850
19868
|
class InterpretadorBase {
|
|
19851
|
-
constructor(diretorioBase, performance = false, funcaoDeRetorno =
|
|
19869
|
+
constructor(diretorioBase, performance = false, funcaoDeRetorno = undefined, funcaoDeRetornoMesmaLinha = undefined) {
|
|
19852
19870
|
this.resultadoInterpretador = [];
|
|
19871
|
+
this.linhaDeclaracaoAtual = -1;
|
|
19872
|
+
this.hashArquivoDeclaracaoAtual = -1;
|
|
19853
19873
|
this.classeAtualEmExecucao = null;
|
|
19854
|
-
this.funcaoDeRetorno =
|
|
19855
|
-
this.funcaoDeRetornoMesmaLinha =
|
|
19856
|
-
this.interfaceDeEntrada =
|
|
19857
|
-
this.interfaceEntradaSaida =
|
|
19858
|
-
this.funcaoVerificarIteracao =
|
|
19874
|
+
this.funcaoDeRetorno = undefined;
|
|
19875
|
+
this.funcaoDeRetornoMesmaLinha = undefined;
|
|
19876
|
+
this.interfaceDeEntrada = undefined; // Originalmente é `readline.Interface`
|
|
19877
|
+
this.interfaceEntradaSaida = undefined;
|
|
19878
|
+
this.funcaoVerificarIteracao = undefined;
|
|
19859
19879
|
this.emDeclaracaoTente = false;
|
|
19860
19880
|
// typeName → methodName → DeleguaFuncao
|
|
19861
19881
|
this.extensoesGlobais = new Map();
|
|
@@ -19878,8 +19898,12 @@ class InterpretadorBase {
|
|
|
19878
19898
|
this.diretorioBase = diretorioBase;
|
|
19879
19899
|
this.performance = performance;
|
|
19880
19900
|
this.funcaoDeRetorno = funcaoDeRetorno || console.log;
|
|
19901
|
+
const _process = globalThis.process;
|
|
19881
19902
|
this.funcaoDeRetornoMesmaLinha =
|
|
19882
|
-
funcaoDeRetornoMesmaLinha ||
|
|
19903
|
+
funcaoDeRetornoMesmaLinha ||
|
|
19904
|
+
(_process?.stdout?.write
|
|
19905
|
+
? _process.stdout.write.bind(_process.stdout)
|
|
19906
|
+
: (texto) => console.log(texto));
|
|
19883
19907
|
this.erros = [];
|
|
19884
19908
|
this.declaracoes = [];
|
|
19885
19909
|
this.resultadoInterpretador = [];
|
|
@@ -19910,8 +19934,9 @@ class InterpretadorBase {
|
|
|
19910
19934
|
async cederControle(iteracoes) {
|
|
19911
19935
|
if (iteracoes % this.iteracoesParaCederControle === 0) {
|
|
19912
19936
|
await new Promise((resolve) => {
|
|
19913
|
-
|
|
19914
|
-
|
|
19937
|
+
const _setImmediate = globalThis.setImmediate;
|
|
19938
|
+
if (_setImmediate) {
|
|
19939
|
+
_setImmediate(resolve);
|
|
19915
19940
|
}
|
|
19916
19941
|
else {
|
|
19917
19942
|
setTimeout(resolve, 0);
|
|
@@ -19950,6 +19975,7 @@ class InterpretadorBase {
|
|
|
19950
19975
|
case construtos_1.AcessoMetodoOuPropriedade:
|
|
19951
19976
|
case construtos_1.AcessoIndiceVariavel:
|
|
19952
19977
|
case construtos_1.Dicionario:
|
|
19978
|
+
case construtos_1.Leia:
|
|
19953
19979
|
case construtos_1.Literal:
|
|
19954
19980
|
case construtos_1.Vetor:
|
|
19955
19981
|
return '';
|
|
@@ -20065,10 +20091,10 @@ class InterpretadorBase {
|
|
|
20065
20091
|
const elementosComoConstrutos = elementos.map((valor) => new construtos_1.Literal(expressao.hashArquivo, expressao.linha, valor));
|
|
20066
20092
|
return new construtos_1.TuplaN(expressao.hashArquivo, expressao.linha, elementosComoConstrutos);
|
|
20067
20093
|
}
|
|
20068
|
-
async visitarExpressaoAtribuicaoPorIndicesMatriz(
|
|
20094
|
+
async visitarExpressaoAtribuicaoPorIndicesMatriz(_) {
|
|
20069
20095
|
throw new Error('Método não implementado.');
|
|
20070
20096
|
}
|
|
20071
|
-
async visitarExpressaoAcessoElementoMatriz(
|
|
20097
|
+
async visitarExpressaoAcessoElementoMatriz(_) {
|
|
20072
20098
|
throw new Error('Método não implementado.');
|
|
20073
20099
|
}
|
|
20074
20100
|
textoParaRegex(texto) {
|
|
@@ -20083,14 +20109,14 @@ class InterpretadorBase {
|
|
|
20083
20109
|
visitarExpressaoExpressaoRegular(expressao) {
|
|
20084
20110
|
return Promise.resolve(this.textoParaRegex(expressao.valor));
|
|
20085
20111
|
}
|
|
20086
|
-
visitarExpressaoTipoDe(
|
|
20112
|
+
visitarExpressaoTipoDe(_) {
|
|
20087
20113
|
throw new Error('Método não implementado.');
|
|
20088
20114
|
}
|
|
20089
20115
|
async visitarExpressaoFalhar(expressao) {
|
|
20090
20116
|
const textoFalha = expressao.explicacao.valor ?? (await this.avaliar(expressao.explicacao)).valor;
|
|
20091
20117
|
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simbolo, textoFalha, expressao.linha);
|
|
20092
20118
|
}
|
|
20093
|
-
async visitarExpressaoFimPara(
|
|
20119
|
+
async visitarExpressaoFimPara(_) {
|
|
20094
20120
|
throw new Error('Método não implementado.');
|
|
20095
20121
|
}
|
|
20096
20122
|
async visitarExpressaoReferenciaFuncao(expressao) {
|
|
@@ -20159,6 +20185,9 @@ class InterpretadorBase {
|
|
|
20159
20185
|
*/
|
|
20160
20186
|
async resolverInterpolacoes(textoOriginal, linha) {
|
|
20161
20187
|
const variaveis = textoOriginal.match(this.regexInterpolacao);
|
|
20188
|
+
if (!variaveis) {
|
|
20189
|
+
return [];
|
|
20190
|
+
}
|
|
20162
20191
|
return await Promise.all(variaveis.map(async (s) => {
|
|
20163
20192
|
const expressaoInterpolacao = s.replace(/[\$\{\}]*/gm, '');
|
|
20164
20193
|
const microLexador = this.microLexador.mapear(expressaoInterpolacao);
|
|
@@ -20373,6 +20402,9 @@ class InterpretadorBase {
|
|
|
20373
20402
|
}
|
|
20374
20403
|
throw new excecoes_1.ErroEmTempoDeExecucao(operador, 'Operadores precisam ser números.', operador.linha);
|
|
20375
20404
|
}
|
|
20405
|
+
converterParaBigInt(valor) {
|
|
20406
|
+
return typeof valor === 'bigint' ? valor : BigInt(Math.floor(Number(valor)));
|
|
20407
|
+
}
|
|
20376
20408
|
async visitarExpressaoBinaria(expressao) {
|
|
20377
20409
|
const esquerda = await this.avaliar(expressao.esquerda);
|
|
20378
20410
|
const direita = await this.avaliar(expressao.direita);
|
|
@@ -20384,7 +20416,7 @@ class InterpretadorBase {
|
|
|
20384
20416
|
const nomeOperador = 'operador' + expressao.operador.lexema;
|
|
20385
20417
|
const metodoOperador = valorEsquerdo.classe.encontrarMetodo(nomeOperador);
|
|
20386
20418
|
if (metodoOperador) {
|
|
20387
|
-
const
|
|
20419
|
+
const metodoASerChamado = metodoOperador.funcaoPorMetodoDeClasse(valorEsquerdo);
|
|
20388
20420
|
const argumentoOperador = direita && Object.prototype.hasOwnProperty.call(direita, 'tipo')
|
|
20389
20421
|
? direita
|
|
20390
20422
|
: {
|
|
@@ -20392,7 +20424,7 @@ class InterpretadorBase {
|
|
|
20392
20424
|
valor: valorDireito,
|
|
20393
20425
|
imutavel: false,
|
|
20394
20426
|
};
|
|
20395
|
-
return await
|
|
20427
|
+
return await metodoASerChamado.chamar(this, [{ nome: null, valor: argumentoOperador }]);
|
|
20396
20428
|
}
|
|
20397
20429
|
}
|
|
20398
20430
|
const tipoEsquerdo = esquerda?.hasOwnProperty('tipo')
|
|
@@ -20406,13 +20438,7 @@ class InterpretadorBase {
|
|
|
20406
20438
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20407
20439
|
// Auto-promove para BigInt se qualquer operando for BigInt
|
|
20408
20440
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20409
|
-
|
|
20410
|
-
? valorEsquerdo
|
|
20411
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20412
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20413
|
-
? valorDireito
|
|
20414
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20415
|
-
return esq ** dir;
|
|
20441
|
+
return this.converterParaBigInt(valorEsquerdo) ** this.converterParaBigInt(valorDireito);
|
|
20416
20442
|
}
|
|
20417
20443
|
const resultadoExponenciacao = Math.pow(valorEsquerdo, valorDireito);
|
|
20418
20444
|
return resultadoExponenciacao;
|
|
@@ -20439,13 +20465,7 @@ class InterpretadorBase {
|
|
|
20439
20465
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20440
20466
|
// Auto-promove para BigInt se qualquer operando for BigInt
|
|
20441
20467
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20442
|
-
|
|
20443
|
-
? valorEsquerdo
|
|
20444
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20445
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20446
|
-
? valorDireito
|
|
20447
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20448
|
-
return esq - dir;
|
|
20468
|
+
return this.converterParaBigInt(valorEsquerdo) - this.converterParaBigInt(valorDireito);
|
|
20449
20469
|
}
|
|
20450
20470
|
return Number(valorEsquerdo) - Number(valorDireito);
|
|
20451
20471
|
case delegua_1.default.ADICAO:
|
|
@@ -20456,13 +20476,13 @@ class InterpretadorBase {
|
|
|
20456
20476
|
}
|
|
20457
20477
|
// Auto-promove para BigInt se qualquer operando for BigInt
|
|
20458
20478
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20459
|
-
const
|
|
20479
|
+
const valorResolvidoEsquerdo = typeof valorEsquerdo === 'bigint'
|
|
20460
20480
|
? valorEsquerdo
|
|
20461
20481
|
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20462
|
-
const
|
|
20482
|
+
const valorResolvidoDireito = typeof valorDireito === 'bigint'
|
|
20463
20483
|
? valorDireito
|
|
20464
20484
|
: BigInt(Math.floor(Number(valorDireito)));
|
|
20465
|
-
return
|
|
20485
|
+
return valorResolvidoEsquerdo + valorResolvidoDireito;
|
|
20466
20486
|
}
|
|
20467
20487
|
if (this.tiposNumericos.includes(tipoEsquerdo) &&
|
|
20468
20488
|
this.tiposNumericos.includes(tipoDireito)) {
|
|
@@ -20492,13 +20512,13 @@ class InterpretadorBase {
|
|
|
20492
20512
|
}
|
|
20493
20513
|
// Retorna BigInt se qualquer operando for BigInt
|
|
20494
20514
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20495
|
-
const
|
|
20515
|
+
const valorResolvidoEsquerdo = typeof valorEsquerdo === 'bigint'
|
|
20496
20516
|
? valorEsquerdo
|
|
20497
20517
|
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20498
|
-
const
|
|
20518
|
+
const valorResolvidoDireito = typeof valorDireito === 'bigint'
|
|
20499
20519
|
? valorDireito
|
|
20500
20520
|
: BigInt(Math.floor(Number(valorDireito)));
|
|
20501
|
-
return
|
|
20521
|
+
return valorResolvidoEsquerdo / valorResolvidoDireito; // Trunca automaticamente
|
|
20502
20522
|
}
|
|
20503
20523
|
return Math.floor(Number(valorEsquerdo) / Number(valorDireito));
|
|
20504
20524
|
case delegua_1.default.MULTIPLICACAO:
|
|
@@ -20507,13 +20527,13 @@ class InterpretadorBase {
|
|
|
20507
20527
|
if ((typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') &&
|
|
20508
20528
|
tipoEsquerdo !== delegua_2.default.TEXTO &&
|
|
20509
20529
|
tipoDireito !== delegua_2.default.TEXTO) {
|
|
20510
|
-
const
|
|
20530
|
+
const valorResolvidoEsquerdo = typeof valorEsquerdo === 'bigint'
|
|
20511
20531
|
? valorEsquerdo
|
|
20512
20532
|
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20513
|
-
const
|
|
20533
|
+
const valorResolvidoDireito = typeof valorDireito === 'bigint'
|
|
20514
20534
|
? valorDireito
|
|
20515
20535
|
: BigInt(Math.floor(Number(valorDireito)));
|
|
20516
|
-
return
|
|
20536
|
+
return valorResolvidoEsquerdo * valorResolvidoDireito;
|
|
20517
20537
|
}
|
|
20518
20538
|
if (tipoEsquerdo === delegua_2.default.TEXTO ||
|
|
20519
20539
|
tipoDireito === delegua_2.default.TEXTO) {
|
|
@@ -20560,13 +20580,7 @@ class InterpretadorBase {
|
|
|
20560
20580
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20561
20581
|
// Auto-promove para BigInt se qualquer operando for BigInt
|
|
20562
20582
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20563
|
-
|
|
20564
|
-
? valorEsquerdo
|
|
20565
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20566
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20567
|
-
? valorDireito
|
|
20568
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20569
|
-
return esq & dir;
|
|
20583
|
+
return this.converterParaBigInt(valorEsquerdo) & this.converterParaBigInt(valorDireito);
|
|
20570
20584
|
}
|
|
20571
20585
|
return Number(valorEsquerdo) & Number(valorDireito);
|
|
20572
20586
|
case delegua_1.default.CIRCUMFLEXO:
|
|
@@ -20576,13 +20590,7 @@ class InterpretadorBase {
|
|
|
20576
20590
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20577
20591
|
// Auto-promove para BigInt se qualquer operando for BigInt
|
|
20578
20592
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20579
|
-
|
|
20580
|
-
? valorEsquerdo
|
|
20581
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20582
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20583
|
-
? valorDireito
|
|
20584
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20585
|
-
return esq ^ dir;
|
|
20593
|
+
return this.converterParaBigInt(valorEsquerdo) ^ this.converterParaBigInt(valorDireito);
|
|
20586
20594
|
}
|
|
20587
20595
|
return Number(valorEsquerdo) ^ Number(valorDireito);
|
|
20588
20596
|
case delegua_1.default.BIT_OR:
|
|
@@ -20592,45 +20600,21 @@ class InterpretadorBase {
|
|
|
20592
20600
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20593
20601
|
// Auto-promove para BigInt se qualquer operando for BigInt
|
|
20594
20602
|
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint') {
|
|
20595
|
-
|
|
20596
|
-
? valorEsquerdo
|
|
20597
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20598
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20599
|
-
? valorDireito
|
|
20600
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20601
|
-
return esq | dir;
|
|
20603
|
+
return this.converterParaBigInt(valorEsquerdo) | this.converterParaBigInt(valorDireito);
|
|
20602
20604
|
}
|
|
20603
20605
|
return Number(valorEsquerdo) | Number(valorDireito);
|
|
20604
20606
|
case delegua_1.default.MENOR_MENOR:
|
|
20605
20607
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20606
20608
|
// Auto-promove para BigInt (interno para longo) se qualquer operando for BigInt ou se deslocamento >= 32
|
|
20607
|
-
|
|
20608
|
-
|
|
20609
|
-
typeof valorDireito === 'bigint' ||
|
|
20610
|
-
tamanhoDeslocamentoEsquerda >= 32) {
|
|
20611
|
-
const esq = typeof valorEsquerdo === 'bigint'
|
|
20612
|
-
? valorEsquerdo
|
|
20613
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20614
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20615
|
-
? valorDireito
|
|
20616
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20617
|
-
return esq << dir;
|
|
20609
|
+
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint' || Number(valorDireito) >= 32) {
|
|
20610
|
+
return this.converterParaBigInt(valorEsquerdo) << this.converterParaBigInt(valorDireito);
|
|
20618
20611
|
}
|
|
20619
20612
|
return Number(valorEsquerdo) << Number(valorDireito);
|
|
20620
20613
|
case delegua_1.default.MAIOR_MAIOR:
|
|
20621
20614
|
this.verificarOperandosNumeros(expressao.operador, esquerda, direita);
|
|
20622
20615
|
// Auto-promove para BigInt (interno para longo) se qualquer operando for BigInt ou se deslocamento >= 32
|
|
20623
|
-
|
|
20624
|
-
|
|
20625
|
-
typeof valorDireito === 'bigint' ||
|
|
20626
|
-
tamanhoDeslocamentoDireita >= 32) {
|
|
20627
|
-
const esq = typeof valorEsquerdo === 'bigint'
|
|
20628
|
-
? valorEsquerdo
|
|
20629
|
-
: BigInt(Math.floor(Number(valorEsquerdo)));
|
|
20630
|
-
const dir = typeof valorDireito === 'bigint'
|
|
20631
|
-
? valorDireito
|
|
20632
|
-
: BigInt(Math.floor(Number(valorDireito)));
|
|
20633
|
-
return esq >> dir;
|
|
20616
|
+
if (typeof valorEsquerdo === 'bigint' || typeof valorDireito === 'bigint' || Number(valorDireito) >= 32) {
|
|
20617
|
+
return this.converterParaBigInt(valorEsquerdo) >> this.converterParaBigInt(valorDireito);
|
|
20634
20618
|
}
|
|
20635
20619
|
return Number(valorEsquerdo) >> Number(valorDireito);
|
|
20636
20620
|
case delegua_1.default.DIFERENTE:
|
|
@@ -20663,7 +20647,7 @@ class InterpretadorBase {
|
|
|
20663
20647
|
: undefined;
|
|
20664
20648
|
let valor = await this.avaliar(variavelArgumento);
|
|
20665
20649
|
argumentos.push({
|
|
20666
|
-
nome: nomeArgumento,
|
|
20650
|
+
nome: nomeArgumento ?? null,
|
|
20667
20651
|
valor,
|
|
20668
20652
|
});
|
|
20669
20653
|
}
|
|
@@ -20732,8 +20716,8 @@ class InterpretadorBase {
|
|
|
20732
20716
|
// mesmo que esteja tudo certo com `DeleguaFuncao`,
|
|
20733
20717
|
// então precisamos testar o nome do construtor também.
|
|
20734
20718
|
if (entidadeChamada instanceof estruturas_1.Chamavel ||
|
|
20735
|
-
entidadeChamada.constructor
|
|
20736
|
-
entidadeChamada.constructor
|
|
20719
|
+
entidadeChamada.constructor === estruturas_1.DeleguaFuncao ||
|
|
20720
|
+
entidadeChamada.constructor === estruturas_1.MetodoPolimorfico) {
|
|
20737
20721
|
const retornoEntidadeChamada = await entidadeChamada.chamar(this, argumentos);
|
|
20738
20722
|
return retornoEntidadeChamada;
|
|
20739
20723
|
}
|
|
@@ -20779,10 +20763,6 @@ class InterpretadorBase {
|
|
|
20779
20763
|
indice = this.resolverValor(await this.avaliar(expressao.indice));
|
|
20780
20764
|
}
|
|
20781
20765
|
switch (expressao.alvo.constructor) {
|
|
20782
|
-
case construtos_1.Variavel:
|
|
20783
|
-
const alvoVariavel = expressao.alvo;
|
|
20784
|
-
this.pilhaEscoposExecucao.atribuirVariavel(alvoVariavel.simbolo, valorResolvido, indice);
|
|
20785
|
-
break;
|
|
20786
20766
|
case construtos_1.AcessoMetodoOuPropriedade:
|
|
20787
20767
|
// Nunca será método aqui: apenas propriedade.
|
|
20788
20768
|
const alvoPropriedade = expressao.alvo;
|
|
@@ -20794,8 +20774,12 @@ class InterpretadorBase {
|
|
|
20794
20774
|
await objetoDeleguaClasse.definir(alvoPropriedade.simbolo, valor, this);
|
|
20795
20775
|
}
|
|
20796
20776
|
break;
|
|
20777
|
+
case construtos_1.Variavel:
|
|
20778
|
+
const alvoVariavel = expressao.alvo;
|
|
20779
|
+
this.pilhaEscoposExecucao.atribuirVariavel(alvoVariavel.simbolo, valorResolvido, indice);
|
|
20780
|
+
break;
|
|
20797
20781
|
default:
|
|
20798
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
20782
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simboloOperador, `Atribuição com caso faltante: ${JSON.stringify(expressao)}.`);
|
|
20799
20783
|
}
|
|
20800
20784
|
return valorResolvido;
|
|
20801
20785
|
}
|
|
@@ -20887,10 +20871,10 @@ class InterpretadorBase {
|
|
|
20887
20871
|
const declaracaoInicializador = Array.isArray(declaracao.inicializador)
|
|
20888
20872
|
? declaracao.inicializador[0]
|
|
20889
20873
|
: declaracao.inicializador;
|
|
20890
|
-
if (declaracaoInicializador !== null) {
|
|
20874
|
+
if (declaracaoInicializador !== null && declaracaoInicializador !== undefined) {
|
|
20891
20875
|
await this.avaliar(declaracaoInicializador);
|
|
20892
20876
|
}
|
|
20893
|
-
let retornoExecucao;
|
|
20877
|
+
let retornoExecucao = undefined;
|
|
20894
20878
|
let iteracoes = 0;
|
|
20895
20879
|
while (!(retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.Quebra)) {
|
|
20896
20880
|
if (declaracao.condicao !== null &&
|
|
@@ -20904,7 +20888,7 @@ class InterpretadorBase {
|
|
|
20904
20888
|
return null;
|
|
20905
20889
|
}
|
|
20906
20890
|
if (retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.ContinuarQuebra) {
|
|
20907
|
-
retornoExecucao =
|
|
20891
|
+
retornoExecucao = undefined;
|
|
20908
20892
|
}
|
|
20909
20893
|
}
|
|
20910
20894
|
catch (erro) {
|
|
@@ -20915,15 +20899,19 @@ class InterpretadorBase {
|
|
|
20915
20899
|
});
|
|
20916
20900
|
return Promise.reject(erro);
|
|
20917
20901
|
}
|
|
20918
|
-
if (declaracao.incrementar
|
|
20902
|
+
if (declaracao.incrementar) {
|
|
20919
20903
|
await this.avaliar(declaracao.incrementar);
|
|
20920
20904
|
}
|
|
20921
20905
|
}
|
|
20922
20906
|
return retornoExecucao;
|
|
20923
20907
|
}
|
|
20924
|
-
|
|
20908
|
+
/**
|
|
20909
|
+
* Lógica de `para cada`, usada por Delégua, Pituguês, e Tenda.
|
|
20910
|
+
* @param {ParaCada} declaracao A declaração de `para cada` a ser executada.
|
|
20911
|
+
* @returns {Promise<any>} O resultado da execução da declaração.
|
|
20912
|
+
*/
|
|
20925
20913
|
async visitarDeclaracaoParaCada(declaracao) {
|
|
20926
|
-
let retornoExecucao;
|
|
20914
|
+
let retornoExecucao = undefined;
|
|
20927
20915
|
// Posição atual precisa ser reiniciada, pois pode estar dentro de outro
|
|
20928
20916
|
// laço de repetição.
|
|
20929
20917
|
declaracao.posicaoAtual = 0;
|
|
@@ -20961,7 +20949,7 @@ class InterpretadorBase {
|
|
|
20961
20949
|
return null;
|
|
20962
20950
|
}
|
|
20963
20951
|
if (retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.ContinuarQuebra) {
|
|
20964
|
-
retornoExecucao =
|
|
20952
|
+
retornoExecucao = undefined;
|
|
20965
20953
|
}
|
|
20966
20954
|
declaracao.posicaoAtual++;
|
|
20967
20955
|
}
|
|
@@ -20987,19 +20975,20 @@ class InterpretadorBase {
|
|
|
20987
20975
|
if (this.eVerdadeiro(avaliacaoCondicaoSe)) {
|
|
20988
20976
|
return await this.executar(declaracao.caminhoEntao);
|
|
20989
20977
|
}
|
|
20990
|
-
|
|
20991
|
-
|
|
20978
|
+
const declaracaoCaminhosSeSenao = declaracao.caminhosSeSenao || [];
|
|
20979
|
+
for (let i = 0; i < declaracaoCaminhosSeSenao.length; i++) {
|
|
20980
|
+
const atual = declaracaoCaminhosSeSenao[i];
|
|
20992
20981
|
if (this.eVerdadeiro(await this.avaliar(atual.condicao))) {
|
|
20993
20982
|
return await this.executar(atual.caminho);
|
|
20994
20983
|
}
|
|
20995
20984
|
}
|
|
20996
|
-
if (declaracao.caminhoSenao
|
|
20985
|
+
if (declaracao.caminhoSenao) {
|
|
20997
20986
|
return await this.executar(declaracao.caminhoSenao);
|
|
20998
20987
|
}
|
|
20999
20988
|
return null;
|
|
21000
20989
|
}
|
|
21001
20990
|
async visitarDeclaracaoEnquanto(declaracao) {
|
|
21002
|
-
let retornoExecucao;
|
|
20991
|
+
let retornoExecucao = undefined;
|
|
21003
20992
|
let iteracoes = 0;
|
|
21004
20993
|
while (!(retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.Quebra) &&
|
|
21005
20994
|
this.eVerdadeiro(await this.avaliar(declaracao.condicao))) {
|
|
@@ -21010,7 +20999,7 @@ class InterpretadorBase {
|
|
|
21010
20999
|
return null;
|
|
21011
21000
|
}
|
|
21012
21001
|
if (retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.ContinuarQuebra) {
|
|
21013
|
-
retornoExecucao =
|
|
21002
|
+
retornoExecucao = undefined;
|
|
21014
21003
|
}
|
|
21015
21004
|
}
|
|
21016
21005
|
catch (erro) {
|
|
@@ -21065,17 +21054,17 @@ class InterpretadorBase {
|
|
|
21065
21054
|
}
|
|
21066
21055
|
}
|
|
21067
21056
|
async visitarDeclaracaoFazer(declaracao) {
|
|
21068
|
-
let retornoExecucao;
|
|
21057
|
+
let retornoExecucao = undefined;
|
|
21069
21058
|
let iteracoes = 0;
|
|
21070
21059
|
do {
|
|
21071
21060
|
try {
|
|
21072
21061
|
await this.cederControle(++iteracoes);
|
|
21073
21062
|
retornoExecucao = await this.executar(declaracao.caminhoFazer);
|
|
21074
21063
|
if (retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.SustarQuebra) {
|
|
21075
|
-
return
|
|
21064
|
+
return undefined;
|
|
21076
21065
|
}
|
|
21077
21066
|
if (retornoExecucao && retornoExecucao.valorRetornado instanceof quebras_1.ContinuarQuebra) {
|
|
21078
|
-
retornoExecucao =
|
|
21067
|
+
retornoExecucao = undefined;
|
|
21079
21068
|
}
|
|
21080
21069
|
}
|
|
21081
21070
|
catch (erro) {
|
|
@@ -21117,7 +21106,7 @@ class InterpretadorBase {
|
|
|
21117
21106
|
}
|
|
21118
21107
|
}
|
|
21119
21108
|
finally {
|
|
21120
|
-
if (declaracao.caminhoFinalmente
|
|
21109
|
+
if (declaracao.caminhoFinalmente)
|
|
21121
21110
|
valorRetorno = await this.executarBloco(declaracao.caminhoFinalmente);
|
|
21122
21111
|
this.emDeclaracaoTente = false;
|
|
21123
21112
|
}
|
|
@@ -21149,7 +21138,7 @@ class InterpretadorBase {
|
|
|
21149
21138
|
async visitarDeclaracaoEscrevaMesmaLinha(declaracao) {
|
|
21150
21139
|
try {
|
|
21151
21140
|
const formatoTexto = await this.avaliarArgumentosEscreva(declaracao.argumentos);
|
|
21152
|
-
this.funcaoDeRetornoMesmaLinha(formatoTexto);
|
|
21141
|
+
this.funcaoDeRetornoMesmaLinha?.(formatoTexto);
|
|
21153
21142
|
return {
|
|
21154
21143
|
tipo: 'vazio',
|
|
21155
21144
|
tipoExplicito: false,
|
|
@@ -21172,7 +21161,7 @@ class InterpretadorBase {
|
|
|
21172
21161
|
async visitarDeclaracaoEscreva(declaracao) {
|
|
21173
21162
|
try {
|
|
21174
21163
|
const formatoTexto = await this.avaliarArgumentosEscreva(declaracao.argumentos);
|
|
21175
|
-
this.funcaoDeRetorno(formatoTexto);
|
|
21164
|
+
this.funcaoDeRetorno?.(formatoTexto);
|
|
21176
21165
|
return {
|
|
21177
21166
|
tipo: 'vazio',
|
|
21178
21167
|
tipoExplicito: false,
|
|
@@ -21216,7 +21205,7 @@ class InterpretadorBase {
|
|
|
21216
21205
|
}
|
|
21217
21206
|
async avaliacaoDeclaracaoVarOuConst(declaracao) {
|
|
21218
21207
|
let valorOuOutraVariavel = null;
|
|
21219
|
-
if (declaracao.inicializador
|
|
21208
|
+
if (declaracao.inicializador != null) {
|
|
21220
21209
|
valorOuOutraVariavel = await this.avaliar(declaracao.inicializador);
|
|
21221
21210
|
}
|
|
21222
21211
|
let valorFinal = null;
|
|
@@ -21245,16 +21234,16 @@ class InterpretadorBase {
|
|
|
21245
21234
|
*/
|
|
21246
21235
|
async visitarDeclaracaoConstMultiplo(declaracao) {
|
|
21247
21236
|
const valoresFinais = await this.avaliacaoDeclaracaoVarOuConst(declaracao);
|
|
21248
|
-
const tipoIndividual = declaracao.tipo.replace('[]', '');
|
|
21237
|
+
const tipoIndividual = (declaracao.tipo || '').replace('[]', '');
|
|
21249
21238
|
for (let [indice, valor] of valoresFinais.entries()) {
|
|
21250
21239
|
this.pilhaEscoposExecucao.definirConstante(declaracao.simbolos[indice].lexema, valor, tipoIndividual);
|
|
21251
21240
|
}
|
|
21252
21241
|
return null;
|
|
21253
21242
|
}
|
|
21254
|
-
visitarExpressaoContinua(
|
|
21243
|
+
visitarExpressaoContinua(_) {
|
|
21255
21244
|
return new quebras_1.ContinuarQuebra();
|
|
21256
21245
|
}
|
|
21257
|
-
visitarExpressaoSustar(
|
|
21246
|
+
visitarExpressaoSustar(_) {
|
|
21258
21247
|
return new quebras_1.SustarQuebra();
|
|
21259
21248
|
}
|
|
21260
21249
|
async visitarExpressaoRetornar(declaracao) {
|
|
@@ -21434,133 +21423,29 @@ class InterpretadorBase {
|
|
|
21434
21423
|
if (superClassesResolvidas.length > 0) {
|
|
21435
21424
|
this.pilhaEscoposExecucao.definirVariavel('super', superClassesResolvidas[0]);
|
|
21436
21425
|
}
|
|
21426
|
+
const descritorTipoClasse = this.resolverMetodoDeClasse(declaracao, superClassesResolvidas, mesclaResolvidas);
|
|
21427
|
+
// TODO: Até então, a única exceção a isso é Égua Clássico.
|
|
21428
|
+
// Por enquanto, tudo bem deixar isso aqui.
|
|
21429
|
+
descritorTipoClasse.dialetoRequerDeclaracaoPropriedades = this.requerDeclaracaoPropriedades;
|
|
21430
|
+
this.pilhaEscoposExecucao.atribuirVariavel(declaracao.simbolo, descritorTipoClasse);
|
|
21431
|
+
return descritorTipoClasse;
|
|
21432
|
+
}
|
|
21433
|
+
resolverMetodoDeClasse(declaracao, superClassesResolvidas, _mesclaResolvidas) {
|
|
21437
21434
|
const metodos = {};
|
|
21438
|
-
const
|
|
21439
|
-
const obtenedores = {};
|
|
21440
|
-
const definidores = {};
|
|
21441
|
-
const obtenedoresEstaticos = {};
|
|
21442
|
-
const definidoresEstaticos = {};
|
|
21443
|
-
const metodosAbstratos = [];
|
|
21444
|
-
const acessoMetodos = {};
|
|
21445
|
-
const acessoPropriedades = {};
|
|
21446
|
-
const definirMetodos = declaracao.metodos;
|
|
21447
|
-
for (let i = 0; i < declaracao.metodos.length; i++) {
|
|
21448
|
-
const metodoAtual = definirMetodos[i];
|
|
21435
|
+
for (const metodoAtual of declaracao.metodos) {
|
|
21449
21436
|
const nomeMetodo = metodoAtual.simbolo.lexema;
|
|
21450
|
-
// Registrar nível de acesso do método.
|
|
21451
|
-
if (metodoAtual.acesso && metodoAtual.acesso !== 'publico') {
|
|
21452
|
-
acessoMetodos[nomeMetodo] = metodoAtual.acesso;
|
|
21453
|
-
}
|
|
21454
|
-
// Métodos abstratos: registrar apenas o nome, não criar função executável.
|
|
21455
|
-
if (metodoAtual.abstrato) {
|
|
21456
|
-
metodosAbstratos.push(nomeMetodo);
|
|
21457
|
-
continue;
|
|
21458
|
-
}
|
|
21459
21437
|
const eInicializador = nomeMetodo === 'construtor';
|
|
21460
21438
|
const funcao = new estruturas_1.DeleguaFuncao(nomeMetodo, metodoAtual.funcao, undefined, eInicializador);
|
|
21461
21439
|
funcao.documentacao = metodoAtual.documentacao;
|
|
21462
|
-
|
|
21463
|
-
const ehEstatico = declaracao.classeEstatica ? !eInicializador : metodoAtual.estatico;
|
|
21464
|
-
if (metodoAtual.eObtenedor) {
|
|
21465
|
-
if (ehEstatico) {
|
|
21466
|
-
obtenedoresEstaticos[nomeMetodo] = funcao;
|
|
21467
|
-
}
|
|
21468
|
-
else {
|
|
21469
|
-
obtenedores[nomeMetodo] = funcao;
|
|
21470
|
-
}
|
|
21471
|
-
continue;
|
|
21472
|
-
}
|
|
21473
|
-
if (metodoAtual.eDefinidor) {
|
|
21474
|
-
if (ehEstatico) {
|
|
21475
|
-
definidoresEstaticos[nomeMetodo] = funcao;
|
|
21476
|
-
}
|
|
21477
|
-
else {
|
|
21478
|
-
definidores[nomeMetodo] = funcao;
|
|
21479
|
-
}
|
|
21480
|
-
continue;
|
|
21481
|
-
}
|
|
21482
|
-
const destino = ehEstatico && !eInicializador ? metodosEstaticos : metodos;
|
|
21483
|
-
if (destino[nomeMetodo]) {
|
|
21484
|
-
if (!Array.isArray(destino[nomeMetodo])) {
|
|
21485
|
-
destino[nomeMetodo] = [destino[nomeMetodo]];
|
|
21486
|
-
}
|
|
21487
|
-
destino[nomeMetodo].push(funcao);
|
|
21488
|
-
}
|
|
21489
|
-
else {
|
|
21490
|
-
destino[nomeMetodo] = funcao;
|
|
21491
|
-
}
|
|
21492
|
-
}
|
|
21493
|
-
// Registrar propriedades estáticas no mapa de membros estáticos e níveis de acesso.
|
|
21494
|
-
// Numa classe estática, todas as propriedades são tratadas como estáticas.
|
|
21495
|
-
const membrosEstaticos = {};
|
|
21496
|
-
for (const prop of declaracao.propriedades) {
|
|
21497
|
-
if (prop.estatico || declaracao.classeEstatica) {
|
|
21498
|
-
membrosEstaticos[prop.nome.lexema] = undefined;
|
|
21499
|
-
}
|
|
21500
|
-
if (prop.acesso && prop.acesso !== 'publico') {
|
|
21501
|
-
acessoPropriedades[prop.nome.lexema] = prop.acesso;
|
|
21502
|
-
}
|
|
21440
|
+
metodos[nomeMetodo] = funcao;
|
|
21503
21441
|
}
|
|
21504
21442
|
const descritorTipoClasse = new estruturas_1.DescritorTipoClasse(declaracao.simbolo, superClassesResolvidas, metodos, declaracao.propriedades);
|
|
21505
|
-
descritorTipoClasse.metodosEstaticos = metodosEstaticos;
|
|
21506
|
-
descritorTipoClasse.membrosEstaticos = membrosEstaticos;
|
|
21507
|
-
descritorTipoClasse.obtenedores = obtenedores;
|
|
21508
|
-
descritorTipoClasse.definidores = definidores;
|
|
21509
|
-
descritorTipoClasse.obtenedoresEstaticos = obtenedoresEstaticos;
|
|
21510
|
-
descritorTipoClasse.definidoresEstaticos = definidoresEstaticos;
|
|
21511
|
-
descritorTipoClasse.abstrata = declaracao.abstrata;
|
|
21512
|
-
descritorTipoClasse.estrangeira = declaracao.estrangeira;
|
|
21513
|
-
descritorTipoClasse.classeEstatica = declaracao.classeEstatica;
|
|
21514
|
-
descritorTipoClasse.metodosAbstratos = metodosAbstratos;
|
|
21515
|
-
descritorTipoClasse.acessoMetodos = acessoMetodos;
|
|
21516
|
-
descritorTipoClasse.acessoPropriedades = acessoPropriedades;
|
|
21517
|
-
// Toda classe sem superclasse explícita herda implicitamente de `Objeto`.
|
|
21518
|
-
// Isso só deve acontecer quando OBJETO_BASE já estiver inicializado e a classe
|
|
21519
|
-
// atual não for o próprio OBJETO_BASE, para evitar cadeias de herança recursivas.
|
|
21520
21443
|
if (descritorTipoClasse.superClasses.length === 0 &&
|
|
21521
21444
|
estruturas_1.OBJETO_BASE &&
|
|
21522
21445
|
descritorTipoClasse !== estruturas_1.OBJETO_BASE) {
|
|
21523
21446
|
descritorTipoClasse.superClasses = [estruturas_1.OBJETO_BASE];
|
|
21524
21447
|
}
|
|
21525
|
-
// Calcular o OReM (linearização C3) após os pais estarem definidos.
|
|
21526
21448
|
descritorTipoClasse.orem = estruturas_1.DescritorTipoClasse.computarOReM(descritorTipoClasse);
|
|
21527
|
-
// Mesclar métodos e propriedades dos misturávels (primeiro misturável ganha se não definido na classe).
|
|
21528
|
-
for (const misturável of mesclaResolvidas) {
|
|
21529
|
-
for (const [nome, funcao] of Object.entries(misturável.metodos)) {
|
|
21530
|
-
if (!descritorTipoClasse.metodos.hasOwnProperty(nome)) {
|
|
21531
|
-
descritorTipoClasse.metodos[nome] = funcao;
|
|
21532
|
-
}
|
|
21533
|
-
}
|
|
21534
|
-
for (const [nome, funcao] of Object.entries(misturável.obtenedores)) {
|
|
21535
|
-
if (!descritorTipoClasse.obtenedores.hasOwnProperty(nome)) {
|
|
21536
|
-
descritorTipoClasse.obtenedores[nome] = funcao;
|
|
21537
|
-
}
|
|
21538
|
-
}
|
|
21539
|
-
for (const [nome, funcao] of Object.entries(misturável.definidores)) {
|
|
21540
|
-
if (!descritorTipoClasse.definidores.hasOwnProperty(nome)) {
|
|
21541
|
-
descritorTipoClasse.definidores[nome] = funcao;
|
|
21542
|
-
}
|
|
21543
|
-
}
|
|
21544
|
-
for (const prop of misturável.propriedades) {
|
|
21545
|
-
const jaDeclarada = descritorTipoClasse.propriedades.some((p) => p.nome.lexema === prop.nome.lexema);
|
|
21546
|
-
if (!jaDeclarada) {
|
|
21547
|
-
descritorTipoClasse.propriedades.push(prop);
|
|
21548
|
-
}
|
|
21549
|
-
}
|
|
21550
|
-
}
|
|
21551
|
-
// Verifica se a subclasse concreta implementa todos os métodos abstratos
|
|
21552
|
-
// da(s) superclasse(s) abstrata(s).
|
|
21553
|
-
if (!declaracao.abstrata && !declaracao.estrangeira) {
|
|
21554
|
-
for (const superClasse of superClassesResolvidas) {
|
|
21555
|
-
if (superClasse.abstrata || superClasse.estrangeira) {
|
|
21556
|
-
superClasse.verificarImplementacaoAbstrata(descritorTipoClasse);
|
|
21557
|
-
}
|
|
21558
|
-
}
|
|
21559
|
-
}
|
|
21560
|
-
// TODO: Até então, a única exceção a isso é Égua Clássico.
|
|
21561
|
-
// Por enquanto, tudo bem deixar isso aqui.
|
|
21562
|
-
descritorTipoClasse.dialetoRequerDeclaracaoPropriedades = this.requerDeclaracaoPropriedades;
|
|
21563
|
-
this.pilhaEscoposExecucao.atribuirVariavel(declaracao.simbolo, descritorTipoClasse);
|
|
21564
21449
|
return descritorTipoClasse;
|
|
21565
21450
|
}
|
|
21566
21451
|
/**
|
|
@@ -21607,7 +21492,8 @@ class InterpretadorBase {
|
|
|
21607
21492
|
if (!this.extensoesGlobais.has(tipoNome)) {
|
|
21608
21493
|
this.extensoesGlobais.set(tipoNome, new Map());
|
|
21609
21494
|
}
|
|
21610
|
-
this.extensoesGlobais.get(tipoNome)
|
|
21495
|
+
const extensaoGlobal = this.extensoesGlobais.get(tipoNome);
|
|
21496
|
+
extensaoGlobal?.set(nomeMetodo, funcao);
|
|
21611
21497
|
}
|
|
21612
21498
|
else {
|
|
21613
21499
|
const hash = declaracao.hashArquivo;
|
|
@@ -21615,10 +21501,13 @@ class InterpretadorBase {
|
|
|
21615
21501
|
this.extensoesModulo.set(hash, new Map());
|
|
21616
21502
|
}
|
|
21617
21503
|
const mapa = this.extensoesModulo.get(hash);
|
|
21504
|
+
if (!mapa) {
|
|
21505
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(declaracao.simboloTipo, 'Erro interno: mapa de extensões do módulo não encontrado.', declaracao.linha);
|
|
21506
|
+
}
|
|
21618
21507
|
if (!mapa.has(tipoNome)) {
|
|
21619
|
-
mapa
|
|
21508
|
+
mapa?.set(tipoNome, new Map());
|
|
21620
21509
|
}
|
|
21621
|
-
mapa.get(tipoNome)
|
|
21510
|
+
mapa.get(tipoNome)?.set(nomeMetodo, funcao);
|
|
21622
21511
|
}
|
|
21623
21512
|
}
|
|
21624
21513
|
}
|
|
@@ -21721,7 +21610,7 @@ class InterpretadorBase {
|
|
|
21721
21610
|
dicionario[chaveLogico] = this.resolverValor(promises[1]);
|
|
21722
21611
|
continue;
|
|
21723
21612
|
}
|
|
21724
|
-
dicionario[promises[0]] = this.resolverValor(promises[1]);
|
|
21613
|
+
dicionario[promises[0].toString()] = this.resolverValor(promises[1]);
|
|
21725
21614
|
}
|
|
21726
21615
|
}
|
|
21727
21616
|
return dicionario;
|
|
@@ -21764,7 +21653,7 @@ class InterpretadorBase {
|
|
|
21764
21653
|
*/
|
|
21765
21654
|
async visitarDeclaracaoVarMultiplo(declaracao) {
|
|
21766
21655
|
const valoresFinais = await this.avaliacaoDeclaracaoVarOuConst(declaracao);
|
|
21767
|
-
const tipoIndividual = declaracao.tipo.replace('[]', '');
|
|
21656
|
+
const tipoIndividual = (declaracao.tipo || '').replace('[]', '');
|
|
21768
21657
|
for (let [indice, valor] of valoresFinais.entries()) {
|
|
21769
21658
|
this.pilhaEscoposExecucao.definirVariavel(declaracao.simbolos[indice].lexema, valor, tipoIndividual);
|
|
21770
21659
|
}
|
|
@@ -22122,8 +22011,7 @@ class InterpretadorBase {
|
|
|
22122
22011
|
}
|
|
22123
22012
|
exports.InterpretadorBase = InterpretadorBase;
|
|
22124
22013
|
|
|
22125
|
-
}
|
|
22126
|
-
},{"../avaliador-sintatico":21,"../bibliotecas/primitivas-dicionario":29,"../bibliotecas/primitivas-vetor":32,"../construtos":62,"../excecoes":132,"../inferenciador":138,"../lexador":209,"../quebras":218,"../tipos-de-dados/delegua":219,"../tipos-de-dados/primitivos":221,"../tipos-de-simbolos/delegua":224,"./espaco-memoria":172,"./estruturas":180,"./estruturas/metodo-primitiva":182,"./pilha-escopos-execucao":193,"_process":471,"browser-process-hrtime":417,"timers":474}],191:[function(require,module,exports){
|
|
22014
|
+
},{"../avaliador-sintatico":21,"../bibliotecas/primitivas-dicionario":29,"../bibliotecas/primitivas-vetor":32,"../construtos":62,"../excecoes":132,"../inferenciador":138,"../lexador":209,"../quebras":218,"../tipos-de-dados/delegua":219,"../tipos-de-dados/primitivos":221,"../tipos-de-simbolos/delegua":224,"./espaco-memoria":172,"./estruturas":180,"./estruturas/metodo-primitiva":182,"./pilha-escopos-execucao":193,"browser-process-hrtime":417}],191:[function(require,module,exports){
|
|
22127
22015
|
"use strict";
|
|
22128
22016
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22129
22017
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -22320,7 +22208,7 @@ class Interpretador extends interpretador_base_1.InterpretadorBase {
|
|
|
22320
22208
|
}
|
|
22321
22209
|
async avaliacaoDeclaracaoVarOuConst(declaracao) {
|
|
22322
22210
|
let valorOuOutraVariavel = null;
|
|
22323
|
-
if (declaracao.inicializador
|
|
22211
|
+
if (declaracao.inicializador != null) {
|
|
22324
22212
|
valorOuOutraVariavel = await this.avaliar(declaracao.inicializador);
|
|
22325
22213
|
}
|
|
22326
22214
|
let valorFinal = null;
|
|
@@ -22684,22 +22572,137 @@ class Interpretador extends interpretador_base_1.InterpretadorBase {
|
|
|
22684
22572
|
linha: this.linhaDeclaracaoAtual,
|
|
22685
22573
|
}, 'Somente listas, dicionários, classes e objetos podem ter seus valores indexados.', expressao.linha));
|
|
22686
22574
|
}
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
const
|
|
22694
|
-
|
|
22575
|
+
logicaPropriedadesEMetodosDeClasse(declaracao, superClassesResolvidas, mesclaResolvidas) {
|
|
22576
|
+
const metodos = {};
|
|
22577
|
+
const metodosEstaticos = {};
|
|
22578
|
+
const obtenedores = {};
|
|
22579
|
+
const definidores = {};
|
|
22580
|
+
const obtenedoresEstaticos = {};
|
|
22581
|
+
const definidoresEstaticos = {};
|
|
22582
|
+
const metodosAbstratos = [];
|
|
22583
|
+
const acessoMetodos = {};
|
|
22584
|
+
const acessoPropriedades = {};
|
|
22585
|
+
for (const metodoAtual of declaracao.metodos) {
|
|
22586
|
+
const nomeMetodo = metodoAtual.simbolo.lexema;
|
|
22587
|
+
if (metodoAtual.acesso && metodoAtual.acesso !== 'publico') {
|
|
22588
|
+
acessoMetodos[nomeMetodo] = metodoAtual.acesso;
|
|
22589
|
+
}
|
|
22590
|
+
if (metodoAtual.abstrato) {
|
|
22591
|
+
metodosAbstratos.push(nomeMetodo);
|
|
22592
|
+
continue;
|
|
22593
|
+
}
|
|
22594
|
+
const eInicializador = nomeMetodo === 'construtor';
|
|
22595
|
+
const funcao = new estruturas_1.DeleguaFuncao(nomeMetodo, metodoAtual.funcao, undefined, eInicializador);
|
|
22596
|
+
funcao.documentacao = metodoAtual.documentacao;
|
|
22597
|
+
// Numa classe estática, todos os métodos (exceto construtor) são estáticos.
|
|
22598
|
+
const ehEstatico = declaracao.classeEstatica ? !eInicializador : metodoAtual.estatico;
|
|
22599
|
+
if (metodoAtual.eObtenedor) {
|
|
22600
|
+
if (ehEstatico) {
|
|
22601
|
+
obtenedoresEstaticos[nomeMetodo] = funcao;
|
|
22602
|
+
}
|
|
22603
|
+
else {
|
|
22604
|
+
obtenedores[nomeMetodo] = funcao;
|
|
22605
|
+
}
|
|
22606
|
+
continue;
|
|
22607
|
+
}
|
|
22608
|
+
if (metodoAtual.eDefinidor) {
|
|
22609
|
+
if (ehEstatico) {
|
|
22610
|
+
definidoresEstaticos[nomeMetodo] = funcao;
|
|
22611
|
+
}
|
|
22612
|
+
else {
|
|
22613
|
+
definidores[nomeMetodo] = funcao;
|
|
22614
|
+
}
|
|
22615
|
+
continue;
|
|
22616
|
+
}
|
|
22617
|
+
const destino = ehEstatico && !eInicializador ? metodosEstaticos : metodos;
|
|
22618
|
+
if (destino[nomeMetodo]) {
|
|
22619
|
+
if (!Array.isArray(destino[nomeMetodo])) {
|
|
22620
|
+
destino[nomeMetodo] = [destino[nomeMetodo]];
|
|
22621
|
+
}
|
|
22622
|
+
destino[nomeMetodo].push(funcao);
|
|
22623
|
+
}
|
|
22624
|
+
else {
|
|
22625
|
+
destino[nomeMetodo] = funcao;
|
|
22626
|
+
}
|
|
22627
|
+
}
|
|
22628
|
+
// Registrar propriedades estáticas no mapa de membros estáticos e níveis de acesso.
|
|
22629
|
+
// Numa classe estática, todas as propriedades são tratadas como estáticas.
|
|
22630
|
+
const membrosEstaticos = {};
|
|
22631
|
+
for (const prop of declaracao.propriedades) {
|
|
22632
|
+
if (prop.estatico || declaracao.classeEstatica) {
|
|
22633
|
+
membrosEstaticos[prop.nome.lexema] = undefined;
|
|
22634
|
+
}
|
|
22635
|
+
if (prop.acesso && prop.acesso !== 'publico') {
|
|
22636
|
+
acessoPropriedades[prop.nome.lexema] = prop.acesso;
|
|
22637
|
+
}
|
|
22638
|
+
}
|
|
22639
|
+
const descritorTipoClasse = new estruturas_1.DescritorTipoClasse(declaracao.simbolo, superClassesResolvidas, metodos, declaracao.propriedades);
|
|
22640
|
+
descritorTipoClasse.metodosEstaticos = metodosEstaticos;
|
|
22641
|
+
descritorTipoClasse.membrosEstaticos = membrosEstaticos;
|
|
22642
|
+
descritorTipoClasse.obtenedores = obtenedores;
|
|
22643
|
+
descritorTipoClasse.definidores = definidores;
|
|
22644
|
+
descritorTipoClasse.obtenedoresEstaticos = obtenedoresEstaticos;
|
|
22645
|
+
descritorTipoClasse.definidoresEstaticos = definidoresEstaticos;
|
|
22646
|
+
descritorTipoClasse.abstrata = declaracao.abstrata;
|
|
22647
|
+
descritorTipoClasse.estrangeira = declaracao.estrangeira;
|
|
22648
|
+
descritorTipoClasse.classeEstatica = declaracao.classeEstatica;
|
|
22649
|
+
descritorTipoClasse.metodosAbstratos = metodosAbstratos;
|
|
22650
|
+
descritorTipoClasse.acessoMetodos = acessoMetodos;
|
|
22651
|
+
descritorTipoClasse.acessoPropriedades = acessoPropriedades;
|
|
22652
|
+
// Toda classe sem superclasse explícita herda implicitamente de `Objeto`.
|
|
22653
|
+
if (descritorTipoClasse.superClasses.length === 0 &&
|
|
22654
|
+
estruturas_1.OBJETO_BASE &&
|
|
22655
|
+
descritorTipoClasse !== estruturas_1.OBJETO_BASE) {
|
|
22656
|
+
descritorTipoClasse.superClasses = [estruturas_1.OBJETO_BASE];
|
|
22657
|
+
}
|
|
22658
|
+
// Calcular o OReM (linearização C3) após os pais estarem definidos.
|
|
22659
|
+
descritorTipoClasse.orem = estruturas_1.DescritorTipoClasse.computarOReM(descritorTipoClasse);
|
|
22660
|
+
// Mesclar métodos e propriedades dos misturávels (primeiro misturável ganha se não definido na classe).
|
|
22661
|
+
for (const misturável of mesclaResolvidas) {
|
|
22662
|
+
for (const [nome, funcao] of Object.entries(misturável.metodos)) {
|
|
22663
|
+
if (!descritorTipoClasse.metodos.hasOwnProperty(nome)) {
|
|
22664
|
+
descritorTipoClasse.metodos[nome] = funcao;
|
|
22665
|
+
}
|
|
22666
|
+
}
|
|
22667
|
+
for (const [nome, funcao] of Object.entries(misturável.obtenedores)) {
|
|
22668
|
+
if (!descritorTipoClasse.obtenedores.hasOwnProperty(nome)) {
|
|
22669
|
+
descritorTipoClasse.obtenedores[nome] = funcao;
|
|
22670
|
+
}
|
|
22671
|
+
}
|
|
22672
|
+
for (const [nome, funcao] of Object.entries(misturável.definidores)) {
|
|
22673
|
+
if (!descritorTipoClasse.definidores.hasOwnProperty(nome)) {
|
|
22674
|
+
descritorTipoClasse.definidores[nome] = funcao;
|
|
22675
|
+
}
|
|
22676
|
+
}
|
|
22677
|
+
for (const prop of misturável.propriedades) {
|
|
22678
|
+
const jaDeclarada = descritorTipoClasse.propriedades.some((p) => p.nome.lexema === prop.nome.lexema);
|
|
22679
|
+
if (!jaDeclarada) {
|
|
22680
|
+
descritorTipoClasse.propriedades.push(prop);
|
|
22681
|
+
}
|
|
22682
|
+
}
|
|
22683
|
+
}
|
|
22684
|
+
// Verifica se a subclasse concreta implementa todos os métodos abstratos
|
|
22685
|
+
// da(s) superclasse(s) abstrata(s).
|
|
22686
|
+
if (!declaracao.abstrata && !declaracao.estrangeira) {
|
|
22687
|
+
for (const superClasse of superClassesResolvidas) {
|
|
22688
|
+
if (superClasse.abstrata || superClasse.estrangeira) {
|
|
22689
|
+
superClasse.verificarImplementacaoAbstrata(descritorTipoClasse);
|
|
22690
|
+
}
|
|
22691
|
+
}
|
|
22692
|
+
}
|
|
22693
|
+
// Marcar classeDefinidora em todos os métodos para que `super()` funcione.
|
|
22694
|
+
for (const funcaoOuSobrecargas of Object.values(descritorTipoClasse.metodos)) {
|
|
22695
22695
|
const lista = Array.isArray(funcaoOuSobrecargas)
|
|
22696
22696
|
? funcaoOuSobrecargas
|
|
22697
22697
|
: [funcaoOuSobrecargas];
|
|
22698
22698
|
for (const funcao of lista) {
|
|
22699
|
-
funcao.classeDefinidora =
|
|
22699
|
+
funcao.classeDefinidora = descritorTipoClasse;
|
|
22700
22700
|
}
|
|
22701
22701
|
}
|
|
22702
|
-
return
|
|
22702
|
+
return descritorTipoClasse;
|
|
22703
|
+
}
|
|
22704
|
+
resolverMetodoDeClasse(declaracao, superClassesResolvidas, mesclaResolvidas) {
|
|
22705
|
+
return this.logicaPropriedadesEMetodosDeClasse(declaracao, superClassesResolvidas, mesclaResolvidas);
|
|
22703
22706
|
}
|
|
22704
22707
|
/**
|
|
22705
22708
|
* Retorna um `SuperProxy` que aponta para a próxima classe no OReM após a classe
|
|
@@ -26780,6 +26783,7 @@ const delegua_1 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
|
26780
26783
|
*/
|
|
26781
26784
|
class Lexador {
|
|
26782
26785
|
constructor(performance = false) {
|
|
26786
|
+
this.codigo = [];
|
|
26783
26787
|
this.performance = performance;
|
|
26784
26788
|
this.simbolos = [];
|
|
26785
26789
|
this.erros = [];
|
|
@@ -27161,8 +27165,26 @@ class Lexador {
|
|
|
27161
27165
|
this.avancar();
|
|
27162
27166
|
break;
|
|
27163
27167
|
case '.':
|
|
27164
|
-
this.
|
|
27168
|
+
this.inicioSimbolo = this.atual;
|
|
27165
27169
|
this.avancar();
|
|
27170
|
+
if (this.simboloAtual() === '.') {
|
|
27171
|
+
this.avancar();
|
|
27172
|
+
if (this.simboloAtual() !== '.') {
|
|
27173
|
+
this.erros.push({
|
|
27174
|
+
linha: this.linha + 1,
|
|
27175
|
+
caractere: this.simboloAtual(),
|
|
27176
|
+
mensagem: 'Esperado ou apenas um ponto, ou três pontos em sequência.',
|
|
27177
|
+
});
|
|
27178
|
+
this.adicionarSimbolo(delegua_1.default.PONTO, '.');
|
|
27179
|
+
}
|
|
27180
|
+
else {
|
|
27181
|
+
this.avancar();
|
|
27182
|
+
this.adicionarSimbolo(delegua_1.default.RETICENCIAS, '...');
|
|
27183
|
+
}
|
|
27184
|
+
}
|
|
27185
|
+
else {
|
|
27186
|
+
this.adicionarSimbolo(delegua_1.default.PONTO, '.');
|
|
27187
|
+
}
|
|
27166
27188
|
break;
|
|
27167
27189
|
case '-':
|
|
27168
27190
|
this.inicioSimbolo = this.atual;
|
|
@@ -28478,6 +28500,7 @@ exports.default = {
|
|
|
28478
28500
|
PONTO_E_VIRGULA: 'PONTO_E_VIRGULA',
|
|
28479
28501
|
QUEBRAR: 'QUEBRAR',
|
|
28480
28502
|
RETORNA: 'RETORNA',
|
|
28503
|
+
RETICENCIAS: 'RETICENCIAS',
|
|
28481
28504
|
SUBTRACAO: 'SUBTRACAO',
|
|
28482
28505
|
SE: 'SE',
|
|
28483
28506
|
SENAO: 'SENAO',
|
|
@@ -28976,7 +28999,7 @@ __exportStar(require("./tradutor-assembly-risc-v"), exports);
|
|
|
28976
28999
|
__exportStar(require("./tradutor-webassembly"), exports);
|
|
28977
29000
|
__exportStar(require("./tradutor-assembly-x64"), exports);
|
|
28978
29001
|
__exportStar(require("./tradutor-assemblyscript"), exports);
|
|
28979
|
-
__exportStar(require("./tradutor-calango"), exports);
|
|
29002
|
+
__exportStar(require("./tradutor-reverso-calango"), exports);
|
|
28980
29003
|
__exportStar(require("./tradutor-elixir"), exports);
|
|
28981
29004
|
__exportStar(require("./tradutor-javascript"), exports);
|
|
28982
29005
|
__exportStar(require("./tradutor-mermaidjs"), exports);
|
|
@@ -28987,7 +29010,7 @@ __exportStar(require("./tradutor-reverso-python"), exports);
|
|
|
28987
29010
|
__exportStar(require("./tradutor-reverso-tenda"), exports);
|
|
28988
29011
|
__exportStar(require("./tradutor-ruby"), exports);
|
|
28989
29012
|
|
|
28990
|
-
},{"./tradutor-assembly-arm":241,"./tradutor-assembly-risc-v":242,"./tradutor-assembly-x64":243,"./tradutor-assemblyscript":244,"./tradutor-
|
|
29013
|
+
},{"./tradutor-assembly-arm":241,"./tradutor-assembly-risc-v":242,"./tradutor-assembly-x64":243,"./tradutor-assemblyscript":244,"./tradutor-elixir":245,"./tradutor-javascript":246,"./tradutor-mermaidjs":247,"./tradutor-portugol-ipt":248,"./tradutor-python":249,"./tradutor-reverso-calango":250,"./tradutor-reverso-javascript":251,"./tradutor-reverso-python":252,"./tradutor-reverso-tenda":253,"./tradutor-ruby":254,"./tradutor-webassembly":255}],233:[function(require,module,exports){
|
|
28991
29014
|
"use strict";
|
|
28992
29015
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28993
29016
|
exports.ArestaFluxograma = void 0;
|
|
@@ -44347,7 +44370,7 @@ class TradutorAssemblyScript {
|
|
|
44347
44370
|
resultado += condicao;
|
|
44348
44371
|
resultado += ')';
|
|
44349
44372
|
resultado += this.dicionarioDeclaracoes[declaracaoSe.caminhoEntao.constructor.name](declaracaoSe.caminhoEntao);
|
|
44350
|
-
if (declaracaoSe.caminhoSenao
|
|
44373
|
+
if (declaracaoSe.caminhoSenao != null) {
|
|
44351
44374
|
resultado += ' '.repeat(this.indentacao);
|
|
44352
44375
|
resultado += 'else ';
|
|
44353
44376
|
const se = declaracaoSe?.caminhoSenao;
|
|
@@ -44975,61 +44998,6 @@ exports.TradutorAssemblyScript = TradutorAssemblyScript;
|
|
|
44975
44998
|
|
|
44976
44999
|
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224}],245:[function(require,module,exports){
|
|
44977
45000
|
"use strict";
|
|
44978
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44979
|
-
exports.TradutorCalango = void 0;
|
|
44980
|
-
class TradutorCalango {
|
|
44981
|
-
constructor() {
|
|
44982
|
-
this.indentacao = 0;
|
|
44983
|
-
this.dicionarioConstrutos = {
|
|
44984
|
-
FormatacaoEscrita: this.traduzirConstrutoFormatacaoEscrita.bind(this),
|
|
44985
|
-
Literal: this.traduzirConstrutoLiteral.bind(this),
|
|
44986
|
-
};
|
|
44987
|
-
this.dicionarioDeclaracoes = {
|
|
44988
|
-
Escreva: this.traduzirDeclaracaoEscreva.bind(this),
|
|
44989
|
-
EscrevaMesmaLinha: this.traduzirDeclaracaoEscrevaMesmaLinha.bind(this),
|
|
44990
|
-
};
|
|
44991
|
-
}
|
|
44992
|
-
traduzirConstrutoFormatacaoEscrita(formatacaoEscrita) {
|
|
44993
|
-
const avaliacaoExpressao = this.dicionarioConstrutos[formatacaoEscrita.expressao.constructor.name](formatacaoEscrita.expressao);
|
|
44994
|
-
return `${avaliacaoExpressao}`;
|
|
44995
|
-
}
|
|
44996
|
-
traduzirConstrutoLiteral(literal) {
|
|
44997
|
-
if (typeof literal.valor === 'string')
|
|
44998
|
-
return `'${literal.valor}'`;
|
|
44999
|
-
return String(literal.valor);
|
|
45000
|
-
}
|
|
45001
|
-
traduzirDeclaracaoEscreva(declaracaoEscreva) {
|
|
45002
|
-
let resultado = 'escreva(';
|
|
45003
|
-
for (const argumento of declaracaoEscreva.argumentos) {
|
|
45004
|
-
const valor = this.dicionarioConstrutos[argumento.constructor.name](argumento);
|
|
45005
|
-
resultado += valor + ', ';
|
|
45006
|
-
}
|
|
45007
|
-
resultado = resultado.slice(0, -2);
|
|
45008
|
-
resultado += ')';
|
|
45009
|
-
return resultado;
|
|
45010
|
-
}
|
|
45011
|
-
traduzirDeclaracaoEscrevaMesmaLinha(declaracaoEscreva) {
|
|
45012
|
-
let resultado = 'escreva(';
|
|
45013
|
-
for (const argumento of declaracaoEscreva.argumentos) {
|
|
45014
|
-
const valor = this.dicionarioConstrutos[argumento.constructor.name](argumento);
|
|
45015
|
-
resultado += valor + ', ';
|
|
45016
|
-
}
|
|
45017
|
-
resultado = resultado.slice(0, -2);
|
|
45018
|
-
resultado += ')';
|
|
45019
|
-
return resultado;
|
|
45020
|
-
}
|
|
45021
|
-
traduzir(declaracoes) {
|
|
45022
|
-
let resultado = '';
|
|
45023
|
-
for (const declaracao of declaracoes) {
|
|
45024
|
-
resultado += `${this.dicionarioDeclaracoes[declaracao.constructor.name](declaracao)} \n`;
|
|
45025
|
-
}
|
|
45026
|
-
return resultado;
|
|
45027
|
-
}
|
|
45028
|
-
}
|
|
45029
|
-
exports.TradutorCalango = TradutorCalango;
|
|
45030
|
-
|
|
45031
|
-
},{}],246:[function(require,module,exports){
|
|
45032
|
-
"use strict";
|
|
45033
45001
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45034
45002
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45035
45003
|
};
|
|
@@ -45979,7 +45947,7 @@ class TradutorElixir {
|
|
|
45979
45947
|
}
|
|
45980
45948
|
exports.TradutorElixir = TradutorElixir;
|
|
45981
45949
|
|
|
45982
|
-
},{"../tipos-de-simbolos/delegua":224}],
|
|
45950
|
+
},{"../tipos-de-simbolos/delegua":224}],246:[function(require,module,exports){
|
|
45983
45951
|
"use strict";
|
|
45984
45952
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45985
45953
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -46459,7 +46427,7 @@ class TradutorJavaScript {
|
|
|
46459
46427
|
resultado += condicao;
|
|
46460
46428
|
resultado += ')';
|
|
46461
46429
|
resultado += this.dicionarioDeclaracoes[declaracaoSe.caminhoEntao.constructor.name](declaracaoSe.caminhoEntao);
|
|
46462
|
-
if (declaracaoSe.caminhoSenao
|
|
46430
|
+
if (declaracaoSe.caminhoSenao != null) {
|
|
46463
46431
|
resultado += ' '.repeat(this.indentacao);
|
|
46464
46432
|
resultado += 'else ';
|
|
46465
46433
|
const se = declaracaoSe?.caminhoSenao;
|
|
@@ -46771,7 +46739,7 @@ class TradutorJavaScript {
|
|
|
46771
46739
|
}
|
|
46772
46740
|
exports.TradutorJavaScript = TradutorJavaScript;
|
|
46773
46741
|
|
|
46774
|
-
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224}],
|
|
46742
|
+
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224}],247:[function(require,module,exports){
|
|
46775
46743
|
"use strict";
|
|
46776
46744
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46777
46745
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -47595,7 +47563,7 @@ class TradutorMermaidJs {
|
|
|
47595
47563
|
}
|
|
47596
47564
|
exports.TradutorMermaidJs = TradutorMermaidJs;
|
|
47597
47565
|
|
|
47598
|
-
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224,"./mermaid":234}],
|
|
47566
|
+
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224,"./mermaid":234}],248:[function(require,module,exports){
|
|
47599
47567
|
"use strict";
|
|
47600
47568
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47601
47569
|
exports.TradutorPortugolIpt = void 0;
|
|
@@ -47657,7 +47625,7 @@ class TradutorPortugolIpt {
|
|
|
47657
47625
|
}
|
|
47658
47626
|
exports.TradutorPortugolIpt = TradutorPortugolIpt;
|
|
47659
47627
|
|
|
47660
|
-
},{"../avaliador-sintatico/dialetos":17,"../lexador/dialetos":194}],
|
|
47628
|
+
},{"../avaliador-sintatico/dialetos":17,"../lexador/dialetos":194}],249:[function(require,module,exports){
|
|
47661
47629
|
"use strict";
|
|
47662
47630
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47663
47631
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -48342,7 +48310,359 @@ class TradutorPython {
|
|
|
48342
48310
|
}
|
|
48343
48311
|
exports.TradutorPython = TradutorPython;
|
|
48344
48312
|
|
|
48345
|
-
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224}],
|
|
48313
|
+
},{"../construtos":62,"../declaracoes":110,"../tipos-de-simbolos/delegua":224}],250:[function(require,module,exports){
|
|
48314
|
+
"use strict";
|
|
48315
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48316
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48317
|
+
};
|
|
48318
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48319
|
+
exports.TradutorReversoCalango = void 0;
|
|
48320
|
+
const calango_1 = __importDefault(require("../tipos-de-simbolos/calango"));
|
|
48321
|
+
class TradutorReversoCalango {
|
|
48322
|
+
constructor() {
|
|
48323
|
+
this.indentacao = 0;
|
|
48324
|
+
this.dicionarioConstrutos = {
|
|
48325
|
+
AcessoIndiceVariavel: this.traduzirConstrutoAcessoIndiceVariavel.bind(this),
|
|
48326
|
+
Agrupamento: this.traduzirConstrutoAgrupamento.bind(this),
|
|
48327
|
+
AtribuicaoPorIndice: this.traduzirConstrutoAtribuicaoPorIndice.bind(this),
|
|
48328
|
+
Atribuir: this.traduzirConstrutoAtribuir.bind(this),
|
|
48329
|
+
Binario: this.traduzirConstrutoBinario.bind(this),
|
|
48330
|
+
Chamada: this.traduzirConstrutoChamada.bind(this),
|
|
48331
|
+
FormatacaoEscrita: this.traduzirConstrutoFormatacaoEscrita.bind(this),
|
|
48332
|
+
FuncaoConstruto: this.traduzirConstrutoFuncao.bind(this),
|
|
48333
|
+
Leia: this.traduzirConstrutoLeia.bind(this),
|
|
48334
|
+
Literal: this.traduzirConstrutoLiteral.bind(this),
|
|
48335
|
+
Logico: this.traduzirConstrutoLogico.bind(this),
|
|
48336
|
+
Unario: this.traduzirConstrutoUnario.bind(this),
|
|
48337
|
+
Variavel: this.traduzirConstrutoVariavel.bind(this),
|
|
48338
|
+
Vetor: this.traduzirConstrutoVetor.bind(this),
|
|
48339
|
+
};
|
|
48340
|
+
this.dicionarioDeclaracoes = {
|
|
48341
|
+
Bloco: this.traduzirDeclaracaoBloco.bind(this),
|
|
48342
|
+
Enquanto: this.traduzirDeclaracaoEnquanto.bind(this),
|
|
48343
|
+
Escolha: this.traduzirDeclaracaoEscolha.bind(this),
|
|
48344
|
+
Escreva: this.traduzirDeclaracaoEscreva.bind(this),
|
|
48345
|
+
EscrevaMesmaLinha: this.traduzirDeclaracaoEscrevaMesmaLinha.bind(this),
|
|
48346
|
+
Expressao: this.traduzirDeclaracaoExpressao.bind(this),
|
|
48347
|
+
Fazer: this.traduzirDeclaracaoFazer.bind(this),
|
|
48348
|
+
FuncaoDeclaracao: this.traduzirDeclaracaoFuncao.bind(this),
|
|
48349
|
+
Para: this.traduzirDeclaracaoPara.bind(this),
|
|
48350
|
+
Retorna: this.traduzirDeclaracaoRetorna.bind(this),
|
|
48351
|
+
Se: this.traduzirDeclaracaoSe.bind(this),
|
|
48352
|
+
Sustar: this.traduzirDeclaracaoSustar.bind(this),
|
|
48353
|
+
Var: this.traduzirDeclaracaoVar.bind(this),
|
|
48354
|
+
};
|
|
48355
|
+
}
|
|
48356
|
+
traduzirSimboloOperador(simbolo) {
|
|
48357
|
+
switch (simbolo?.tipo) {
|
|
48358
|
+
case calango_1.default.ADICAO:
|
|
48359
|
+
return '+';
|
|
48360
|
+
case calango_1.default.SUBTRACAO:
|
|
48361
|
+
return '-';
|
|
48362
|
+
case calango_1.default.MULTIPLICACAO:
|
|
48363
|
+
return '*';
|
|
48364
|
+
case calango_1.default.DIVISAO:
|
|
48365
|
+
return '/';
|
|
48366
|
+
case calango_1.default.DIVISAO_INTEIRA:
|
|
48367
|
+
return '\\';
|
|
48368
|
+
case calango_1.default.MODULO:
|
|
48369
|
+
return '%';
|
|
48370
|
+
case calango_1.default.EXPONENCIACAO:
|
|
48371
|
+
return '^';
|
|
48372
|
+
case calango_1.default.IGUAL:
|
|
48373
|
+
case calango_1.default.IGUAL_IGUAL:
|
|
48374
|
+
return '==';
|
|
48375
|
+
case calango_1.default.IGUAL_ATRIBUICAO:
|
|
48376
|
+
return '=';
|
|
48377
|
+
case calango_1.default.DIFERENTE:
|
|
48378
|
+
return '!=';
|
|
48379
|
+
case calango_1.default.MAIOR:
|
|
48380
|
+
return '>';
|
|
48381
|
+
case calango_1.default.MAIOR_IGUAL:
|
|
48382
|
+
return '>=';
|
|
48383
|
+
case calango_1.default.MENOR:
|
|
48384
|
+
return '<';
|
|
48385
|
+
case calango_1.default.MENOR_IGUAL:
|
|
48386
|
+
return '<=';
|
|
48387
|
+
case calango_1.default.E:
|
|
48388
|
+
return 'e';
|
|
48389
|
+
case calango_1.default.OU:
|
|
48390
|
+
return 'ou';
|
|
48391
|
+
case calango_1.default.NEGACAO:
|
|
48392
|
+
return 'nao';
|
|
48393
|
+
default:
|
|
48394
|
+
return simbolo?.lexema || '';
|
|
48395
|
+
}
|
|
48396
|
+
}
|
|
48397
|
+
traduzirQualquer(elemento) {
|
|
48398
|
+
if (!elemento) {
|
|
48399
|
+
return '';
|
|
48400
|
+
}
|
|
48401
|
+
const nomeConstrutor = elemento.constructor.name;
|
|
48402
|
+
if (this.dicionarioDeclaracoes.hasOwnProperty(nomeConstrutor)) {
|
|
48403
|
+
return this.dicionarioDeclaracoes[nomeConstrutor](elemento);
|
|
48404
|
+
}
|
|
48405
|
+
if (this.dicionarioConstrutos.hasOwnProperty(nomeConstrutor)) {
|
|
48406
|
+
return this.dicionarioConstrutos[nomeConstrutor](elemento);
|
|
48407
|
+
}
|
|
48408
|
+
throw new Error(`Elemento não suportado pelo tradutor Calango reverso: ${nomeConstrutor}`);
|
|
48409
|
+
}
|
|
48410
|
+
traduzirParametro(parametro) {
|
|
48411
|
+
const nome = parametro?.nome?.lexema;
|
|
48412
|
+
const tipo = parametro?.tipoDado;
|
|
48413
|
+
if (!nome) {
|
|
48414
|
+
return '';
|
|
48415
|
+
}
|
|
48416
|
+
if (!tipo || tipo === 'qualquer') {
|
|
48417
|
+
return nome;
|
|
48418
|
+
}
|
|
48419
|
+
return `${nome}: ${tipo}`;
|
|
48420
|
+
}
|
|
48421
|
+
logicaComumBlocoEscopo(declaracoes) {
|
|
48422
|
+
let resultado = '{\n';
|
|
48423
|
+
this.indentacao += 4;
|
|
48424
|
+
for (const declaracaoOuConstruto of declaracoes || []) {
|
|
48425
|
+
const traducao = this.traduzirQualquer(declaracaoOuConstruto);
|
|
48426
|
+
if (!traducao) {
|
|
48427
|
+
continue;
|
|
48428
|
+
}
|
|
48429
|
+
resultado += `${' '.repeat(this.indentacao)}${traducao}\n`;
|
|
48430
|
+
}
|
|
48431
|
+
this.indentacao -= 4;
|
|
48432
|
+
resultado += `${' '.repeat(this.indentacao)}}`;
|
|
48433
|
+
return resultado;
|
|
48434
|
+
}
|
|
48435
|
+
traduzirConstrutoAcessoIndiceVariavel(acessoIndiceVariavel) {
|
|
48436
|
+
const entidade = this.traduzirQualquer(acessoIndiceVariavel.entidadeChamada);
|
|
48437
|
+
const indice = this.traduzirQualquer(acessoIndiceVariavel.indice);
|
|
48438
|
+
return `${entidade}[${indice}]`;
|
|
48439
|
+
}
|
|
48440
|
+
traduzirConstrutoAgrupamento(agrupamento) {
|
|
48441
|
+
return `(${this.traduzirQualquer(agrupamento.expressao)})`;
|
|
48442
|
+
}
|
|
48443
|
+
traduzirConstrutoAtribuicaoPorIndice(atribuicao) {
|
|
48444
|
+
const objeto = this.traduzirQualquer(atribuicao.objeto);
|
|
48445
|
+
const indice = this.traduzirQualquer(atribuicao.indice);
|
|
48446
|
+
const valor = this.traduzirQualquer(atribuicao.valor);
|
|
48447
|
+
return `${objeto}[${indice}] = ${valor}`;
|
|
48448
|
+
}
|
|
48449
|
+
traduzirConstrutoAtribuir(atribuir) {
|
|
48450
|
+
let alvo = this.traduzirQualquer(atribuir.alvo);
|
|
48451
|
+
if (atribuir.indice) {
|
|
48452
|
+
alvo += `[${this.traduzirQualquer(atribuir.indice)}]`;
|
|
48453
|
+
}
|
|
48454
|
+
const operador = atribuir.simboloOperador
|
|
48455
|
+
? this.traduzirSimboloOperador(atribuir.simboloOperador)
|
|
48456
|
+
: '=';
|
|
48457
|
+
const valor = this.traduzirQualquer(atribuir.valor);
|
|
48458
|
+
return `${alvo} ${operador} ${valor}`;
|
|
48459
|
+
}
|
|
48460
|
+
traduzirConstrutoBinario(binario) {
|
|
48461
|
+
const esquerda = this.traduzirQualquer(binario.esquerda);
|
|
48462
|
+
const direita = this.traduzirQualquer(binario.direita);
|
|
48463
|
+
const operador = this.traduzirSimboloOperador(binario.operador);
|
|
48464
|
+
return `${esquerda} ${operador} ${direita}`;
|
|
48465
|
+
}
|
|
48466
|
+
traduzirConstrutoChamada(chamada) {
|
|
48467
|
+
const entidade = this.traduzirQualquer(chamada.entidadeChamada);
|
|
48468
|
+
const argumentos = (chamada.argumentos || []).map((argumento) => this.traduzirQualquer(argumento));
|
|
48469
|
+
return `${entidade}(${argumentos.join(', ')})`;
|
|
48470
|
+
}
|
|
48471
|
+
traduzirConstrutoFormatacaoEscrita(formatacaoEscrita) {
|
|
48472
|
+
const avaliacaoExpressao = this.traduzirQualquer(formatacaoEscrita.expressao);
|
|
48473
|
+
return `${avaliacaoExpressao}`;
|
|
48474
|
+
}
|
|
48475
|
+
traduzirConstrutoFuncao(funcaoConstruto) {
|
|
48476
|
+
const parametros = (funcaoConstruto.parametros || [])
|
|
48477
|
+
.map((parametro) => this.traduzirParametro(parametro))
|
|
48478
|
+
.filter((p) => p)
|
|
48479
|
+
.join(', ');
|
|
48480
|
+
let resultado = `funcao(${parametros}) `;
|
|
48481
|
+
resultado += this.logicaComumBlocoEscopo(funcaoConstruto.corpo);
|
|
48482
|
+
return resultado;
|
|
48483
|
+
}
|
|
48484
|
+
traduzirConstrutoLeia(leia) {
|
|
48485
|
+
const argumentos = (leia.argumentos || []).map((argumento) => this.traduzirQualquer(argumento));
|
|
48486
|
+
return `leia(${argumentos.join(', ')})`;
|
|
48487
|
+
}
|
|
48488
|
+
traduzirConstrutoLiteral(literal) {
|
|
48489
|
+
if (typeof literal.valor === 'string') {
|
|
48490
|
+
const valorEscapado = literal.valor.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
48491
|
+
return `'${valorEscapado}'`;
|
|
48492
|
+
}
|
|
48493
|
+
if (literal.valor === null || literal.valor === undefined) {
|
|
48494
|
+
return 'nulo';
|
|
48495
|
+
}
|
|
48496
|
+
if (typeof literal.valor === 'boolean') {
|
|
48497
|
+
return literal.valor ? 'verdadeiro' : 'falso';
|
|
48498
|
+
}
|
|
48499
|
+
return String(literal.valor);
|
|
48500
|
+
}
|
|
48501
|
+
traduzirConstrutoLogico(logico) {
|
|
48502
|
+
const esquerda = this.traduzirQualquer(logico.esquerda);
|
|
48503
|
+
const direita = this.traduzirQualquer(logico.direita);
|
|
48504
|
+
const operador = this.traduzirSimboloOperador(logico.operador);
|
|
48505
|
+
return `${esquerda} ${operador} ${direita}`;
|
|
48506
|
+
}
|
|
48507
|
+
traduzirConstrutoUnario(unario) {
|
|
48508
|
+
const operador = this.traduzirSimboloOperador(unario.operador);
|
|
48509
|
+
const operando = this.traduzirQualquer(unario.operando);
|
|
48510
|
+
if (unario.incidenciaOperador === 'DEPOIS') {
|
|
48511
|
+
return `${operando}${operador}`;
|
|
48512
|
+
}
|
|
48513
|
+
if (operador === 'nao') {
|
|
48514
|
+
return `${operador} ${operando}`;
|
|
48515
|
+
}
|
|
48516
|
+
return `${operador}${operando}`;
|
|
48517
|
+
}
|
|
48518
|
+
traduzirConstrutoVariavel(variavel) {
|
|
48519
|
+
return variavel.simbolo.lexema;
|
|
48520
|
+
}
|
|
48521
|
+
traduzirConstrutoVetor(vetor) {
|
|
48522
|
+
const elementos = (vetor.elementos || []).map((elemento) => this.traduzirQualquer(elemento));
|
|
48523
|
+
return `[${elementos.join(', ')}]`;
|
|
48524
|
+
}
|
|
48525
|
+
traduzirDeclaracaoBloco(bloco) {
|
|
48526
|
+
return this.logicaComumBlocoEscopo(bloco.declaracoes);
|
|
48527
|
+
}
|
|
48528
|
+
traduzirDeclaracaoEnquanto(declaracaoEnquanto) {
|
|
48529
|
+
const condicao = this.traduzirQualquer(declaracaoEnquanto.condicao);
|
|
48530
|
+
const corpo = this.traduzirDeclaracaoBloco(declaracaoEnquanto.corpo);
|
|
48531
|
+
return `enquanto (${condicao}) ${corpo}`;
|
|
48532
|
+
}
|
|
48533
|
+
traduzirDeclaracaoEscolha(declaracaoEscolha) {
|
|
48534
|
+
const expressao = this.traduzirQualquer(declaracaoEscolha.identificadorOuLiteral);
|
|
48535
|
+
let resultado = `escolha (${expressao}) {\n`;
|
|
48536
|
+
this.indentacao += 4;
|
|
48537
|
+
for (const caminho of declaracaoEscolha.caminhos || []) {
|
|
48538
|
+
for (const condicao of caminho.condicoes || []) {
|
|
48539
|
+
resultado += `${' '.repeat(this.indentacao)}caso ${this.traduzirQualquer(condicao)}:\n`;
|
|
48540
|
+
}
|
|
48541
|
+
this.indentacao += 4;
|
|
48542
|
+
for (const declaracao of caminho.declaracoes || []) {
|
|
48543
|
+
const traducao = this.traduzirQualquer(declaracao);
|
|
48544
|
+
if (traducao) {
|
|
48545
|
+
resultado += `${' '.repeat(this.indentacao)}${traducao}\n`;
|
|
48546
|
+
}
|
|
48547
|
+
}
|
|
48548
|
+
this.indentacao -= 4;
|
|
48549
|
+
}
|
|
48550
|
+
if (declaracaoEscolha.caminhoPadrao) {
|
|
48551
|
+
resultado += `${' '.repeat(this.indentacao)}padrao:\n`;
|
|
48552
|
+
this.indentacao += 4;
|
|
48553
|
+
for (const declaracao of declaracaoEscolha.caminhoPadrao.declaracoes || []) {
|
|
48554
|
+
const traducao = this.traduzirQualquer(declaracao);
|
|
48555
|
+
if (traducao) {
|
|
48556
|
+
resultado += `${' '.repeat(this.indentacao)}${traducao}\n`;
|
|
48557
|
+
}
|
|
48558
|
+
}
|
|
48559
|
+
this.indentacao -= 4;
|
|
48560
|
+
}
|
|
48561
|
+
this.indentacao -= 4;
|
|
48562
|
+
resultado += `${' '.repeat(this.indentacao)}}`;
|
|
48563
|
+
return resultado;
|
|
48564
|
+
}
|
|
48565
|
+
traduzirDeclaracaoEscreva(declaracaoEscreva) {
|
|
48566
|
+
let resultado = 'escreva(';
|
|
48567
|
+
for (const argumento of declaracaoEscreva.argumentos) {
|
|
48568
|
+
const valor = this.traduzirQualquer(argumento);
|
|
48569
|
+
resultado += valor + ', ';
|
|
48570
|
+
}
|
|
48571
|
+
if (declaracaoEscreva.argumentos.length > 0) {
|
|
48572
|
+
resultado = resultado.slice(0, -2);
|
|
48573
|
+
}
|
|
48574
|
+
resultado += ')';
|
|
48575
|
+
return resultado;
|
|
48576
|
+
}
|
|
48577
|
+
traduzirDeclaracaoEscrevaMesmaLinha(declaracaoEscreva) {
|
|
48578
|
+
let resultado = 'escreva(';
|
|
48579
|
+
for (const argumento of declaracaoEscreva.argumentos) {
|
|
48580
|
+
const valor = this.traduzirQualquer(argumento);
|
|
48581
|
+
resultado += valor + ', ';
|
|
48582
|
+
}
|
|
48583
|
+
if (declaracaoEscreva.argumentos.length > 0) {
|
|
48584
|
+
resultado = resultado.slice(0, -2);
|
|
48585
|
+
}
|
|
48586
|
+
resultado += ')';
|
|
48587
|
+
return resultado;
|
|
48588
|
+
}
|
|
48589
|
+
traduzirDeclaracaoExpressao(expressao) {
|
|
48590
|
+
return this.traduzirQualquer(expressao.expressao);
|
|
48591
|
+
}
|
|
48592
|
+
traduzirDeclaracaoFazer(fazer) {
|
|
48593
|
+
const corpo = this.traduzirDeclaracaoBloco(fazer.caminhoFazer);
|
|
48594
|
+
const condicao = this.traduzirQualquer(fazer.condicaoEnquanto);
|
|
48595
|
+
return `fazer ${corpo} enquanto (${condicao})`;
|
|
48596
|
+
}
|
|
48597
|
+
traduzirDeclaracaoFuncao(declaracaoFuncao) {
|
|
48598
|
+
const parametros = (declaracaoFuncao.funcao.parametros || [])
|
|
48599
|
+
.map((parametro) => this.traduzirParametro(parametro))
|
|
48600
|
+
.filter((p) => p)
|
|
48601
|
+
.join(', ');
|
|
48602
|
+
const tipoRetorno = declaracaoFuncao.tipo && declaracaoFuncao.tipo !== 'qualquer' && declaracaoFuncao.tipo !== 'vazio'
|
|
48603
|
+
? `: ${declaracaoFuncao.tipo}`
|
|
48604
|
+
: '';
|
|
48605
|
+
let resultado = `funcao ${declaracaoFuncao.simbolo.lexema}(${parametros})${tipoRetorno} `;
|
|
48606
|
+
resultado += this.logicaComumBlocoEscopo(declaracaoFuncao.funcao.corpo);
|
|
48607
|
+
return resultado;
|
|
48608
|
+
}
|
|
48609
|
+
traduzirDeclaracaoPara(declaracaoPara) {
|
|
48610
|
+
let inicializador = '';
|
|
48611
|
+
if (Array.isArray(declaracaoPara.inicializador)) {
|
|
48612
|
+
inicializador = declaracaoPara.inicializador
|
|
48613
|
+
.map((declaracao) => this.traduzirQualquer(declaracao))
|
|
48614
|
+
.join(', ');
|
|
48615
|
+
}
|
|
48616
|
+
else if (declaracaoPara.inicializador) {
|
|
48617
|
+
inicializador = this.traduzirQualquer(declaracaoPara.inicializador);
|
|
48618
|
+
}
|
|
48619
|
+
const condicao = this.traduzirQualquer(declaracaoPara.condicao);
|
|
48620
|
+
const incremento = this.traduzirQualquer(declaracaoPara.incrementar);
|
|
48621
|
+
const corpo = this.traduzirDeclaracaoBloco(declaracaoPara.corpo);
|
|
48622
|
+
return `para (${inicializador}; ${condicao}; ${incremento}) ${corpo}`;
|
|
48623
|
+
}
|
|
48624
|
+
traduzirDeclaracaoRetorna(retorna) {
|
|
48625
|
+
if (!retorna.valor) {
|
|
48626
|
+
return 'retorna';
|
|
48627
|
+
}
|
|
48628
|
+
return `retorna ${this.traduzirQualquer(retorna.valor)}`;
|
|
48629
|
+
}
|
|
48630
|
+
traduzirDeclaracaoSe(declaracaoSe) {
|
|
48631
|
+
const condicao = this.traduzirQualquer(declaracaoSe.condicao);
|
|
48632
|
+
const caminhoEntao = this.traduzirQualquer(declaracaoSe.caminhoEntao);
|
|
48633
|
+
let resultado = `se (${condicao}) ${caminhoEntao}`;
|
|
48634
|
+
const caminhosSeSenao = declaracaoSe.caminhosSeSenao || [];
|
|
48635
|
+
for (const caminhoSeSenao of caminhosSeSenao) {
|
|
48636
|
+
resultado += ` senao se (${this.traduzirQualquer(caminhoSeSenao.condicao)}) ${this.traduzirQualquer(caminhoSeSenao.caminho)}`;
|
|
48637
|
+
}
|
|
48638
|
+
if (declaracaoSe.caminhoSenao) {
|
|
48639
|
+
resultado += ` senao ${this.traduzirQualquer(declaracaoSe.caminhoSenao)}`;
|
|
48640
|
+
}
|
|
48641
|
+
return resultado;
|
|
48642
|
+
}
|
|
48643
|
+
traduzirDeclaracaoSustar(_sustar) {
|
|
48644
|
+
return 'sustar';
|
|
48645
|
+
}
|
|
48646
|
+
traduzirDeclaracaoVar(declaracaoVar) {
|
|
48647
|
+
if (!declaracaoVar.inicializador) {
|
|
48648
|
+
return `var ${declaracaoVar.simbolo.lexema}`;
|
|
48649
|
+
}
|
|
48650
|
+
return `var ${declaracaoVar.simbolo.lexema} = ${this.traduzirQualquer(declaracaoVar.inicializador)}`;
|
|
48651
|
+
}
|
|
48652
|
+
traduzir(declaracoes) {
|
|
48653
|
+
const linhas = [];
|
|
48654
|
+
for (const declaracao of declaracoes) {
|
|
48655
|
+
const traducao = this.traduzirQualquer(declaracao);
|
|
48656
|
+
if (traducao) {
|
|
48657
|
+
linhas.push(traducao);
|
|
48658
|
+
}
|
|
48659
|
+
}
|
|
48660
|
+
return linhas.join('\n');
|
|
48661
|
+
}
|
|
48662
|
+
}
|
|
48663
|
+
exports.TradutorReversoCalango = TradutorReversoCalango;
|
|
48664
|
+
|
|
48665
|
+
},{"../tipos-de-simbolos/calango":222}],251:[function(require,module,exports){
|
|
48346
48666
|
"use strict";
|
|
48347
48667
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48348
48668
|
exports.TradutorReversoJavaScript = void 0;
|
|
@@ -48742,75 +49062,632 @@ exports.TradutorReversoJavaScript = TradutorReversoJavaScript;
|
|
|
48742
49062
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48743
49063
|
exports.TradutorReversoPython = void 0;
|
|
48744
49064
|
const antlr4ts_1 = require("antlr4ts");
|
|
48745
|
-
const
|
|
48746
|
-
const ParseTreeWalker_1 = require("antlr4ts/tree/ParseTreeWalker");
|
|
49065
|
+
const AbstractParseTreeVisitor_1 = require("antlr4ts/tree/AbstractParseTreeVisitor");
|
|
48747
49066
|
const python3_lexer_1 = require("./python/python3-lexer");
|
|
49067
|
+
const python3_parser_1 = require("./python/python3-parser");
|
|
48748
49068
|
/**
|
|
48749
49069
|
* Tradutor reverso de Python para Delégua.
|
|
48750
|
-
* Utiliza o
|
|
49070
|
+
* Utiliza o visitor do ANTLR para percorrer a árvore sintática em
|
|
48751
49071
|
* Python e traduzir para Delégua.
|
|
48752
49072
|
*/
|
|
48753
|
-
class TradutorReversoPython {
|
|
48754
|
-
|
|
48755
|
-
|
|
48756
|
-
|
|
48757
|
-
|
|
48758
|
-
|
|
48759
|
-
|
|
48760
|
-
|
|
48761
|
-
|
|
48762
|
-
|
|
49073
|
+
class TradutorReversoPython extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
|
|
49074
|
+
constructor() {
|
|
49075
|
+
super(...arguments);
|
|
49076
|
+
// Funções globais Python → Delégua
|
|
49077
|
+
this.mapeamentoFuncoes = {
|
|
49078
|
+
print: 'escreva',
|
|
49079
|
+
input: 'leia',
|
|
49080
|
+
len: 'tamanho',
|
|
49081
|
+
int: 'inteiro',
|
|
49082
|
+
float: 'real',
|
|
49083
|
+
str: 'texto',
|
|
49084
|
+
bool: 'logico',
|
|
49085
|
+
type: 'tipoDe',
|
|
49086
|
+
range: 'intervalo',
|
|
49087
|
+
abs: 'absoluto',
|
|
49088
|
+
round: 'arredondar',
|
|
49089
|
+
min: 'minimo',
|
|
49090
|
+
max: 'maximo',
|
|
49091
|
+
sum: 'somar',
|
|
49092
|
+
};
|
|
49093
|
+
// Métodos de instância Python → Delégua
|
|
49094
|
+
this.mapeamentoMetodos = {
|
|
49095
|
+
// Lista / vetor
|
|
49096
|
+
append: 'adicionar',
|
|
49097
|
+
pop: 'removerUltimo',
|
|
49098
|
+
reverse: 'inverter',
|
|
49099
|
+
sort: 'ordenar',
|
|
49100
|
+
clear: 'limpar',
|
|
49101
|
+
// Texto / string
|
|
49102
|
+
upper: 'maiusculo',
|
|
49103
|
+
lower: 'minusculo',
|
|
49104
|
+
strip: 'aparar',
|
|
49105
|
+
lstrip: 'aparar',
|
|
49106
|
+
rstrip: 'aparar',
|
|
49107
|
+
split: 'dividir',
|
|
49108
|
+
join: 'juntar',
|
|
49109
|
+
startswith: 'iniciaCom',
|
|
49110
|
+
endswith: 'terminaCom',
|
|
49111
|
+
replace: 'substituir',
|
|
49112
|
+
find: 'encontrar',
|
|
49113
|
+
count: 'contar',
|
|
49114
|
+
// Dicionário
|
|
49115
|
+
keys: 'chaves',
|
|
49116
|
+
values: 'valores',
|
|
49117
|
+
items: 'itens',
|
|
49118
|
+
};
|
|
49119
|
+
}
|
|
49120
|
+
defaultResult() {
|
|
49121
|
+
return '';
|
|
49122
|
+
}
|
|
49123
|
+
aggregateResult(aggregate, nextResult) {
|
|
49124
|
+
return aggregate + nextResult;
|
|
49125
|
+
}
|
|
49126
|
+
visitTerminal(node) {
|
|
49127
|
+
return node.text;
|
|
49128
|
+
}
|
|
49129
|
+
visitFile_input(ctx) {
|
|
49130
|
+
return ctx.stmt().map((s) => this.visit(s)).join('\n');
|
|
49131
|
+
}
|
|
49132
|
+
visitSimple_stmt(ctx) {
|
|
49133
|
+
return ctx.small_stmt().map((s) => this.visit(s)).join('; ');
|
|
49134
|
+
}
|
|
49135
|
+
visitExpr_stmt(ctx) {
|
|
49136
|
+
const lhs = this.visit(ctx.testlist_star_expr());
|
|
49137
|
+
const simpleAssign = ctx.simple_assign();
|
|
49138
|
+
if (simpleAssign && simpleAssign.childCount > 0) {
|
|
49139
|
+
const rhs = this.visitSimple_assign(simpleAssign);
|
|
49140
|
+
// Atribuições a atributos (a.b = x) ou índices (a[i] = x) não usam 'var'
|
|
49141
|
+
const prefixo = lhs.includes('.') || lhs.includes('[') ? '' : 'var ';
|
|
49142
|
+
return `${prefixo}${lhs} = ${rhs}`;
|
|
49143
|
+
}
|
|
49144
|
+
if (ctx.augassign()) {
|
|
49145
|
+
const op = this.visitAugassign(ctx.augassign());
|
|
49146
|
+
const testlist = ctx.testlist();
|
|
49147
|
+
const yieldExpr = ctx.yield_expr();
|
|
49148
|
+
const rhs = testlist
|
|
49149
|
+
? this.visit(testlist)
|
|
49150
|
+
: yieldExpr
|
|
49151
|
+
? this.visit(yieldExpr)
|
|
49152
|
+
: '';
|
|
49153
|
+
return `${lhs} ${op} ${rhs}`;
|
|
49154
|
+
}
|
|
49155
|
+
return lhs;
|
|
49156
|
+
}
|
|
49157
|
+
visitSimple_assign(ctx) {
|
|
49158
|
+
const exprs = ctx.testlist_star_expr();
|
|
49159
|
+
return this.visit(exprs[exprs.length - 1]);
|
|
49160
|
+
}
|
|
49161
|
+
visitAugassign(ctx) {
|
|
49162
|
+
if (ctx.ADD_ASSIGN())
|
|
49163
|
+
return '+=';
|
|
49164
|
+
if (ctx.SUB_ASSIGN())
|
|
49165
|
+
return '-=';
|
|
49166
|
+
if (ctx.MULT_ASSIGN())
|
|
49167
|
+
return '*=';
|
|
49168
|
+
if (ctx.DIV_ASSIGN())
|
|
49169
|
+
return '/=';
|
|
49170
|
+
if (ctx.MOD_ASSIGN())
|
|
49171
|
+
return '%=';
|
|
49172
|
+
if (ctx.AND_ASSIGN())
|
|
49173
|
+
return '&=';
|
|
49174
|
+
if (ctx.OR_ASSIGN())
|
|
49175
|
+
return '|=';
|
|
49176
|
+
if (ctx.XOR_ASSIGN())
|
|
49177
|
+
return '^=';
|
|
49178
|
+
if (ctx.LEFT_SHIFT_ASSIGN())
|
|
49179
|
+
return '<<=';
|
|
49180
|
+
if (ctx.RIGHT_SHIFT_ASSIGN())
|
|
49181
|
+
return '>>=';
|
|
49182
|
+
if (ctx.POWER_ASSIGN())
|
|
49183
|
+
return '**=';
|
|
49184
|
+
if (ctx.IDIV_ASSIGN())
|
|
49185
|
+
return '//=';
|
|
49186
|
+
return ctx.text;
|
|
49187
|
+
}
|
|
49188
|
+
visitTestlist_star_expr(ctx) {
|
|
49189
|
+
return ctx.test().map((t) => this.visit(t)).join(', ');
|
|
49190
|
+
}
|
|
49191
|
+
visitTestlist(ctx) {
|
|
49192
|
+
return ctx.test().map((t) => this.visit(t)).join(', ');
|
|
49193
|
+
}
|
|
49194
|
+
visitTest(ctx) {
|
|
49195
|
+
const orTests = ctx.or_test();
|
|
49196
|
+
if (orTests.length === 1)
|
|
49197
|
+
return this.visit(orTests[0]);
|
|
49198
|
+
const lambdef = ctx.lambdef();
|
|
49199
|
+
if (lambdef)
|
|
49200
|
+
return this.visit(lambdef);
|
|
49201
|
+
// Expressão ternária (a if cond else b) — implementada em fase futura
|
|
49202
|
+
return this.visitChildren(ctx);
|
|
49203
|
+
}
|
|
49204
|
+
visitOr_test(ctx) {
|
|
49205
|
+
return ctx.and_test().map((t) => this.visit(t)).join(' ou ');
|
|
49206
|
+
}
|
|
49207
|
+
visitAnd_test(ctx) {
|
|
49208
|
+
return ctx.not_test().map((t) => this.visit(t)).join(' e ');
|
|
49209
|
+
}
|
|
49210
|
+
visitNot_test(ctx) {
|
|
49211
|
+
if (ctx.NOT()) {
|
|
49212
|
+
return `nao ${this.visit(ctx.not_test())}`;
|
|
49213
|
+
}
|
|
49214
|
+
const comp = ctx.comparison();
|
|
49215
|
+
if (comp)
|
|
49216
|
+
return this.visit(comp);
|
|
49217
|
+
return this.visitChildren(ctx);
|
|
49218
|
+
}
|
|
49219
|
+
visitComparison(ctx) {
|
|
49220
|
+
const exprs = ctx.expr();
|
|
49221
|
+
if (exprs.length === 1)
|
|
49222
|
+
return this.visit(exprs[0]);
|
|
49223
|
+
const ops = ctx.comp_op();
|
|
49224
|
+
let resultado = this.visit(exprs[0]);
|
|
49225
|
+
for (let i = 0; i < ops.length; i++) {
|
|
49226
|
+
resultado += ` ${this.visitComp_op(ops[i])} ${this.visit(exprs[i + 1])}`;
|
|
48763
49227
|
}
|
|
49228
|
+
return resultado;
|
|
48764
49229
|
}
|
|
48765
|
-
|
|
48766
|
-
|
|
48767
|
-
|
|
48768
|
-
|
|
48769
|
-
|
|
48770
|
-
|
|
49230
|
+
visitComp_op(ctx) {
|
|
49231
|
+
if (ctx.LESS_THAN())
|
|
49232
|
+
return '<';
|
|
49233
|
+
if (ctx.GREATER_THAN())
|
|
49234
|
+
return '>';
|
|
49235
|
+
if (ctx.EQUALS())
|
|
49236
|
+
return '==';
|
|
49237
|
+
if (ctx.GT_EQ())
|
|
49238
|
+
return '>=';
|
|
49239
|
+
if (ctx.LT_EQ())
|
|
49240
|
+
return '<=';
|
|
49241
|
+
if (ctx.NOT_EQ_1() || ctx.NOT_EQ_2())
|
|
49242
|
+
return '!=';
|
|
49243
|
+
if (ctx.NOT() && ctx.IN())
|
|
49244
|
+
return 'nao em';
|
|
49245
|
+
if (ctx.IN())
|
|
49246
|
+
return 'em';
|
|
49247
|
+
if (ctx.NOT() && ctx.IS())
|
|
49248
|
+
return '!=';
|
|
49249
|
+
if (ctx.IS())
|
|
49250
|
+
return '==';
|
|
49251
|
+
return ctx.text;
|
|
49252
|
+
}
|
|
49253
|
+
visitArith_expr(ctx) {
|
|
49254
|
+
const termos = ctx.term();
|
|
49255
|
+
if (termos.length === 1)
|
|
49256
|
+
return this.visit(termos[0]);
|
|
49257
|
+
let resultado = this.visit(termos[0]);
|
|
49258
|
+
let idx = 1;
|
|
49259
|
+
for (let i = 1; i < ctx.childCount; i++) {
|
|
49260
|
+
const texto = ctx.getChild(i).text;
|
|
49261
|
+
if (texto === '+' || texto === '-') {
|
|
49262
|
+
resultado += ` ${texto} ${this.visit(termos[idx++])}`;
|
|
49263
|
+
}
|
|
49264
|
+
}
|
|
49265
|
+
return resultado;
|
|
48771
49266
|
}
|
|
48772
|
-
|
|
48773
|
-
|
|
49267
|
+
visitTerm(ctx) {
|
|
49268
|
+
const fatores = ctx.factor();
|
|
49269
|
+
if (fatores.length === 1)
|
|
49270
|
+
return this.visit(fatores[0]);
|
|
49271
|
+
let resultado = this.visit(fatores[0]);
|
|
49272
|
+
let idx = 1;
|
|
49273
|
+
for (let i = 1; i < ctx.childCount; i++) {
|
|
49274
|
+
const texto = ctx.getChild(i).text;
|
|
49275
|
+
if (['*', '/', '%', '//', '@'].includes(texto)) {
|
|
49276
|
+
resultado += ` ${texto} ${this.visit(fatores[idx++])}`;
|
|
49277
|
+
}
|
|
49278
|
+
}
|
|
49279
|
+
return resultado;
|
|
48774
49280
|
}
|
|
48775
|
-
|
|
48776
|
-
|
|
48777
|
-
|
|
48778
|
-
|
|
48779
|
-
|
|
48780
|
-
|
|
48781
|
-
|
|
48782
|
-
|
|
48783
|
-
|
|
48784
|
-
|
|
48785
|
-
|
|
49281
|
+
visitFactor(ctx) {
|
|
49282
|
+
if (ctx.ADD())
|
|
49283
|
+
return `+${this.visit(ctx.factor())}`;
|
|
49284
|
+
if (ctx.MINUS())
|
|
49285
|
+
return `-${this.visit(ctx.factor())}`;
|
|
49286
|
+
if (ctx.NOT_OP())
|
|
49287
|
+
return `~${this.visit(ctx.factor())}`;
|
|
49288
|
+
return this.visit(ctx.power());
|
|
49289
|
+
}
|
|
49290
|
+
visitPower(ctx) {
|
|
49291
|
+
const base = this.visit(ctx.atom_expr());
|
|
49292
|
+
if (ctx.POWER()) {
|
|
49293
|
+
return `${base} ** ${this.visit(ctx.factor())}`;
|
|
49294
|
+
}
|
|
49295
|
+
return base;
|
|
49296
|
+
}
|
|
49297
|
+
visitAtom_expr(ctx) {
|
|
49298
|
+
const textoAtomo = this.visit(ctx.atom());
|
|
49299
|
+
const trailers = ctx.trailer();
|
|
49300
|
+
if (trailers.length === 0)
|
|
49301
|
+
return textoAtomo;
|
|
49302
|
+
// Chamada de função simples: nome(args)
|
|
49303
|
+
if (trailers.length === 1 && trailers[0].OPEN_PAREN()) {
|
|
49304
|
+
const nomeFuncao = this.mapeamentoFuncoes[textoAtomo] ?? textoAtomo;
|
|
49305
|
+
const arglist = trailers[0].arglist();
|
|
49306
|
+
const args = arglist ? this.visit(arglist) : '';
|
|
49307
|
+
return `${nomeFuncao}(${args})`;
|
|
49308
|
+
}
|
|
49309
|
+
// Chamada de método: obj.metodo(args) → dois trailers: .nome e (args)
|
|
49310
|
+
if (trailers.length === 2 &&
|
|
49311
|
+
trailers[0].DOT() &&
|
|
49312
|
+
trailers[0].NAME() &&
|
|
49313
|
+
trailers[1].OPEN_PAREN()) {
|
|
49314
|
+
const nomeMetodoPython = trailers[0].NAME().text;
|
|
49315
|
+
const arglist = trailers[1].arglist();
|
|
49316
|
+
const args = arglist ? this.visit(arglist) : '';
|
|
49317
|
+
// join é invertido: sep.join(iteravel) → iteravel.juntar(sep)
|
|
49318
|
+
if (nomeMetodoPython === 'join') {
|
|
49319
|
+
return `${args}.juntar(${textoAtomo})`;
|
|
49320
|
+
}
|
|
49321
|
+
const nomeMetodoDelégua = this.mapeamentoMetodos[nomeMetodoPython] ?? nomeMetodoPython;
|
|
49322
|
+
return `${textoAtomo}.${nomeMetodoDelégua}(${args})`;
|
|
49323
|
+
}
|
|
49324
|
+
// Fallback: acesso a atributo, índice ou chamadas encadeadas
|
|
49325
|
+
let resultado = textoAtomo;
|
|
49326
|
+
for (const trailer of trailers) {
|
|
49327
|
+
resultado += this.visitTrailer(trailer);
|
|
48786
49328
|
}
|
|
49329
|
+
return resultado;
|
|
48787
49330
|
}
|
|
48788
|
-
|
|
48789
|
-
|
|
48790
|
-
|
|
48791
|
-
|
|
48792
|
-
|
|
49331
|
+
visitTrailer(ctx) {
|
|
49332
|
+
if (ctx.DOT() && ctx.NAME()) {
|
|
49333
|
+
return `.${ctx.NAME().text}`;
|
|
49334
|
+
}
|
|
49335
|
+
if (ctx.OPEN_BRACK()) {
|
|
49336
|
+
const subscriptlist = ctx.subscriptlist();
|
|
49337
|
+
const conteudo = subscriptlist ? this.visit(subscriptlist) : '';
|
|
49338
|
+
return `[${conteudo}]`;
|
|
49339
|
+
}
|
|
49340
|
+
if (ctx.OPEN_PAREN()) {
|
|
49341
|
+
const arglist = ctx.arglist();
|
|
49342
|
+
const args = arglist ? this.visit(arglist) : '';
|
|
49343
|
+
return `(${args})`;
|
|
49344
|
+
}
|
|
49345
|
+
return ctx.text;
|
|
49346
|
+
}
|
|
49347
|
+
visitAtom(ctx) {
|
|
49348
|
+
const nome = ctx.NAME();
|
|
49349
|
+
if (nome)
|
|
49350
|
+
return nome.text === 'self' ? 'isto' : nome.text;
|
|
49351
|
+
const numero = ctx.NUMBER();
|
|
49352
|
+
if (numero)
|
|
49353
|
+
return numero.text;
|
|
49354
|
+
if (ctx.TRUE())
|
|
49355
|
+
return 'verdadeiro';
|
|
49356
|
+
if (ctx.FALSE())
|
|
49357
|
+
return 'falso';
|
|
49358
|
+
if (ctx.NONE())
|
|
49359
|
+
return 'nulo';
|
|
49360
|
+
const strings = ctx.STRING();
|
|
49361
|
+
if (strings.length > 0)
|
|
49362
|
+
return strings.map((s) => s.text).join(' ');
|
|
49363
|
+
if (ctx.OPEN_PAREN()) {
|
|
49364
|
+
const testlistComp = ctx.testlist_comp();
|
|
49365
|
+
if (testlistComp) {
|
|
49366
|
+
// Tupla com vírgula → vetor em Delégua
|
|
49367
|
+
if (testlistComp.COMMA().length > 0) {
|
|
49368
|
+
return `[${this.visitTestlist_comp(testlistComp)}]`;
|
|
49369
|
+
}
|
|
49370
|
+
return `(${this.visitTestlist_comp(testlistComp)})`;
|
|
49371
|
+
}
|
|
49372
|
+
return '()';
|
|
49373
|
+
}
|
|
49374
|
+
if (ctx.OPEN_BRACK()) {
|
|
49375
|
+
const testlistComp = ctx.testlist_comp();
|
|
49376
|
+
if (testlistComp) {
|
|
49377
|
+
// Compreensão de lista: resultado já é um vetor, não envolve em []
|
|
49378
|
+
if (testlistComp.comp_for()) {
|
|
49379
|
+
return this.visitTestlist_comp(testlistComp);
|
|
49380
|
+
}
|
|
49381
|
+
return `[${this.visitTestlist_comp(testlistComp)}]`;
|
|
49382
|
+
}
|
|
49383
|
+
return '[]';
|
|
49384
|
+
}
|
|
49385
|
+
if (ctx.OPEN_BRACE()) {
|
|
49386
|
+
const dictorsetmaker = ctx.dictorsetmaker();
|
|
49387
|
+
if (dictorsetmaker)
|
|
49388
|
+
return `{${this.visitDictorsetmaker(dictorsetmaker)}}`;
|
|
49389
|
+
return '{}';
|
|
49390
|
+
}
|
|
49391
|
+
return ctx.text;
|
|
49392
|
+
}
|
|
49393
|
+
visitArglist(ctx) {
|
|
49394
|
+
return ctx.argument().map((a) => this.visit(a)).join(', ');
|
|
49395
|
+
}
|
|
49396
|
+
visitArgument(ctx) {
|
|
49397
|
+
const testes = ctx.test();
|
|
49398
|
+
if (testes.length === 1 && !ctx.ASSIGN()) {
|
|
49399
|
+
return this.visit(testes[0]);
|
|
49400
|
+
}
|
|
49401
|
+
// Argumento nomeado: nome=valor
|
|
49402
|
+
if (testes.length === 2 && ctx.ASSIGN()) {
|
|
49403
|
+
return `${this.visit(testes[0])} = ${this.visit(testes[1])}`;
|
|
49404
|
+
}
|
|
49405
|
+
return this.visitChildren(ctx);
|
|
49406
|
+
}
|
|
49407
|
+
visitTestlist_comp(ctx) {
|
|
49408
|
+
const compFor = ctx.comp_for();
|
|
49409
|
+
if (compFor) {
|
|
49410
|
+
return this.traduzirCompreensao(ctx.test(0), compFor);
|
|
49411
|
+
}
|
|
49412
|
+
return ctx.test().map((t) => this.visit(t)).join(', ');
|
|
49413
|
+
}
|
|
49414
|
+
traduzirCompreensao(exprCtx, compFor) {
|
|
49415
|
+
const variavel = this.visit(compFor.exprlist());
|
|
49416
|
+
const iteravel = this.visit(compFor.or_test());
|
|
49417
|
+
const expr = this.visit(exprCtx);
|
|
49418
|
+
const compIter = compFor.comp_iter();
|
|
49419
|
+
const compIf = compIter?.comp_if();
|
|
49420
|
+
if (compIf) {
|
|
49421
|
+
const cond = this.visitChildren(compIf.test_nocond());
|
|
49422
|
+
return `filtrarPor(${iteravel}, funcao(${variavel}) { retorna ${cond} }).mapear(funcao(${variavel}) { retorna ${expr} })`;
|
|
49423
|
+
}
|
|
49424
|
+
return `${iteravel}.mapear(funcao(${variavel}) { retorna ${expr} })`;
|
|
49425
|
+
}
|
|
49426
|
+
visitLambdef(ctx) {
|
|
49427
|
+
const varargslist = ctx.varargslist();
|
|
49428
|
+
const params = varargslist ? this.visitVarargslist(varargslist) : '';
|
|
49429
|
+
const corpo = this.visit(ctx.test());
|
|
49430
|
+
return `funcao(${params}) { retorna ${corpo} }`;
|
|
49431
|
+
}
|
|
49432
|
+
visitVarargslist(ctx) {
|
|
49433
|
+
const params = [];
|
|
49434
|
+
for (let i = 0; i < ctx.childCount;) {
|
|
49435
|
+
const texto = ctx.getChild(i).text;
|
|
49436
|
+
if (texto === ',') {
|
|
49437
|
+
i++;
|
|
49438
|
+
continue;
|
|
49439
|
+
}
|
|
49440
|
+
if (texto === '*' || texto === '**')
|
|
48793
49441
|
break;
|
|
48794
|
-
|
|
49442
|
+
const nomeParam = texto;
|
|
49443
|
+
if (i + 1 < ctx.childCount && ctx.getChild(i + 1).text === '=') {
|
|
49444
|
+
const valorPadrao = this.visit(ctx.getChild(i + 2));
|
|
49445
|
+
params.push(`${nomeParam} = ${valorPadrao}`);
|
|
49446
|
+
i += 3;
|
|
49447
|
+
}
|
|
49448
|
+
else {
|
|
49449
|
+
params.push(nomeParam);
|
|
49450
|
+
i++;
|
|
49451
|
+
}
|
|
49452
|
+
}
|
|
49453
|
+
return params.join(', ');
|
|
49454
|
+
}
|
|
49455
|
+
visitDictorsetmaker(ctx) {
|
|
49456
|
+
const tests = ctx.test();
|
|
49457
|
+
if (ctx.COLON().length > 0) {
|
|
49458
|
+
// Dicionário: testes alternados como chave/valor
|
|
49459
|
+
const pares = [];
|
|
49460
|
+
for (let i = 0; i + 1 < tests.length; i += 2) {
|
|
49461
|
+
pares.push(`${this.visit(tests[i])}: ${this.visit(tests[i + 1])}`);
|
|
49462
|
+
}
|
|
49463
|
+
return pares.join(', ');
|
|
49464
|
+
}
|
|
49465
|
+
// Conjunto (set) — representado como lista em Delégua
|
|
49466
|
+
return tests.map((t) => this.visit(t)).join(', ');
|
|
49467
|
+
}
|
|
49468
|
+
visitSubscriptlist(ctx) {
|
|
49469
|
+
return ctx.subscript().map((s) => this.visitSubscript(s)).join(', ');
|
|
49470
|
+
}
|
|
49471
|
+
visitSubscript(ctx) {
|
|
49472
|
+
const tests = ctx.test();
|
|
49473
|
+
if (!ctx.COLON()) {
|
|
49474
|
+
// Índice simples
|
|
49475
|
+
return tests.length > 0 ? this.visit(tests[0]) : '';
|
|
49476
|
+
}
|
|
49477
|
+
// Fatia: [inicio]:fim → inicio..fim
|
|
49478
|
+
// Se o primeiro filho é ':', não há início (ex: texto[:3])
|
|
49479
|
+
const temInicio = ctx.childCount > 0 && ctx.getChild(0).text !== ':';
|
|
49480
|
+
const inicio = temInicio ? this.visit(tests[0]) : '';
|
|
49481
|
+
const fimIdx = temInicio ? 1 : 0;
|
|
49482
|
+
const fim = tests.length > fimIdx ? this.visit(tests[fimIdx]) : '';
|
|
49483
|
+
return `${inicio}..${fim}`;
|
|
49484
|
+
}
|
|
49485
|
+
// Retorna as linhas já indentadas de um bloco, sem os colchetes externos.
|
|
49486
|
+
visitLinhasCorpo(ctx) {
|
|
49487
|
+
const linhas = [];
|
|
49488
|
+
const simpleStmt = ctx.simple_stmt();
|
|
49489
|
+
if (simpleStmt) {
|
|
49490
|
+
linhas.push(` ${this.visit(simpleStmt)}`);
|
|
49491
|
+
}
|
|
49492
|
+
else {
|
|
49493
|
+
for (const stmt of ctx.stmt()) {
|
|
49494
|
+
const traduzido = this.visit(stmt);
|
|
49495
|
+
for (const linha of traduzido.split('\n')) {
|
|
49496
|
+
linhas.push(` ${linha}`);
|
|
49497
|
+
}
|
|
49498
|
+
}
|
|
49499
|
+
}
|
|
49500
|
+
return linhas;
|
|
49501
|
+
}
|
|
49502
|
+
// Traduz um bloco indentado (suite) para o corpo entre chaves de Delégua.
|
|
49503
|
+
visitCorpo(ctx) {
|
|
49504
|
+
return `{\n${this.visitLinhasCorpo(ctx).join('\n')}\n}`;
|
|
49505
|
+
}
|
|
49506
|
+
visitTry_stmt(ctx) {
|
|
49507
|
+
const corpoTente = this.visitCorpo(ctx.suite(0));
|
|
49508
|
+
let resultado = `tente ${corpoTente}`;
|
|
49509
|
+
const excepts = ctx.except_clause();
|
|
49510
|
+
if (excepts.length > 0) {
|
|
49511
|
+
// Detecta alias do erro na primeira cláusula except com `as nome`
|
|
49512
|
+
const alias = excepts.find((e) => e.NAME())?.NAME()?.text;
|
|
49513
|
+
// Junta todos os corpos except num único bloco pegue
|
|
49514
|
+
const todasLinhas = [];
|
|
49515
|
+
for (let i = 0; i < excepts.length; i++) {
|
|
49516
|
+
todasLinhas.push(...this.visitLinhasCorpo(ctx.suite(i + 1)));
|
|
49517
|
+
}
|
|
49518
|
+
const corpoPegue = `{\n${todasLinhas.join('\n')}\n}`;
|
|
49519
|
+
resultado += alias ? ` pegue (${alias}) ${corpoPegue}` : ` pegue ${corpoPegue}`;
|
|
49520
|
+
}
|
|
49521
|
+
// Índice da suite do else/finally começa após as suites de except
|
|
49522
|
+
let suiteIdx = 1 + excepts.length;
|
|
49523
|
+
if (ctx.ELSE()) {
|
|
49524
|
+
suiteIdx++; // else não tem equivalente em Delégua — ignora
|
|
49525
|
+
}
|
|
49526
|
+
if (ctx.FINALLY()) {
|
|
49527
|
+
resultado += ` finalmente ${this.visitCorpo(ctx.suite(suiteIdx))}`;
|
|
49528
|
+
}
|
|
49529
|
+
return resultado;
|
|
49530
|
+
}
|
|
49531
|
+
visitRaise_stmt(ctx) {
|
|
49532
|
+
const tests = ctx.test();
|
|
49533
|
+
if (tests.length === 0)
|
|
49534
|
+
return 'levante';
|
|
49535
|
+
return `levante ${this.visit(tests[0])}`;
|
|
49536
|
+
}
|
|
49537
|
+
visitWith_stmt(ctx) {
|
|
49538
|
+
const linhasCorpo = this.visitLinhasCorpo(ctx.suite());
|
|
49539
|
+
// Apenas itens com `as` podem ser traduzidos para `tendo...como`
|
|
49540
|
+
const itemsComAs = ctx.with_item().filter((item) => item.expr());
|
|
49541
|
+
if (itemsComAs.length === 0) {
|
|
49542
|
+
// Nenhum item com `as`: traduz apenas o corpo, sem tendo
|
|
49543
|
+
return linhasCorpo.map((l) => l.trimStart()).join('\n');
|
|
49544
|
+
}
|
|
49545
|
+
return this.construirTendo(itemsComAs, 0, linhasCorpo);
|
|
49546
|
+
}
|
|
49547
|
+
// Constrói blocos `tendo` aninhados para cada item do `with`.
|
|
49548
|
+
// Items sem `as` são ignorados (Delégua exige um identificador).
|
|
49549
|
+
construirTendo(items, i, linhas) {
|
|
49550
|
+
if (i >= items.length) {
|
|
49551
|
+
return `{\n${linhas.join('\n')}\n}`;
|
|
49552
|
+
}
|
|
49553
|
+
const item = items[i];
|
|
49554
|
+
const varExpr = item.expr();
|
|
49555
|
+
const expr = this.visit(item.test());
|
|
49556
|
+
if (!varExpr) {
|
|
49557
|
+
// Sem `as`: sem variável para ligar — pula este item
|
|
49558
|
+
return this.construirTendo(items, i + 1, linhas);
|
|
49559
|
+
}
|
|
49560
|
+
const nomeVar = this.visit(varExpr);
|
|
49561
|
+
// Para múltiplos itens, o próximo nível é indentado dentro deste bloco
|
|
49562
|
+
let linhasInternas;
|
|
49563
|
+
if (i + 1 < items.length) {
|
|
49564
|
+
const blocoInterno = this.construirTendo(items, i + 1, linhas);
|
|
49565
|
+
linhasInternas = blocoInterno.split('\n').map((l) => ` ${l}`);
|
|
49566
|
+
}
|
|
49567
|
+
else {
|
|
49568
|
+
linhasInternas = linhas;
|
|
49569
|
+
}
|
|
49570
|
+
return `tendo ${expr} como ${nomeVar} {\n${linhasInternas.join('\n')}\n}`;
|
|
49571
|
+
}
|
|
49572
|
+
visitIf_stmt(ctx) {
|
|
49573
|
+
const testes = ctx.test();
|
|
49574
|
+
const suites = ctx.suite();
|
|
49575
|
+
const elifs = ctx.ELIF();
|
|
49576
|
+
// Primeiro bloco: se (cond) { ... }
|
|
49577
|
+
let resultado = `se (${this.visit(testes[0])}) ${this.visitCorpo(suites[0])}`;
|
|
49578
|
+
// Blocos elif: senão se (cond) { ... }
|
|
49579
|
+
for (let i = 0; i < elifs.length; i++) {
|
|
49580
|
+
resultado += ` senão se (${this.visit(testes[i + 1])}) ${this.visitCorpo(suites[i + 1])}`;
|
|
49581
|
+
}
|
|
49582
|
+
// Bloco else: senão { ... }
|
|
49583
|
+
if (ctx.ELSE()) {
|
|
49584
|
+
resultado += ` senão ${this.visitCorpo(suites[suites.length - 1])}`;
|
|
49585
|
+
}
|
|
49586
|
+
return resultado;
|
|
49587
|
+
}
|
|
49588
|
+
visitWhile_stmt(ctx) {
|
|
49589
|
+
const cond = this.visit(ctx.test());
|
|
49590
|
+
const corpo = this.visitCorpo(ctx.suite(0));
|
|
49591
|
+
return `enquanto (${cond}) ${corpo}`;
|
|
49592
|
+
}
|
|
49593
|
+
visitFor_stmt(ctx) {
|
|
49594
|
+
const variavel = this.visit(ctx.exprlist());
|
|
49595
|
+
const iteravel = this.visit(ctx.testlist());
|
|
49596
|
+
const corpo = this.visitCorpo(ctx.suite(0));
|
|
49597
|
+
return `para cada ${variavel} em ${iteravel} ${corpo}`;
|
|
49598
|
+
}
|
|
49599
|
+
visitBreak_stmt(_ctx) {
|
|
49600
|
+
return 'sustar';
|
|
49601
|
+
}
|
|
49602
|
+
visitContinue_stmt(_ctx) {
|
|
49603
|
+
return 'continua';
|
|
49604
|
+
}
|
|
49605
|
+
visitReturn_stmt(ctx) {
|
|
49606
|
+
const testlist = ctx.testlist();
|
|
49607
|
+
if (testlist)
|
|
49608
|
+
return `retorna ${this.visit(testlist)}`;
|
|
49609
|
+
return 'retorna';
|
|
49610
|
+
}
|
|
49611
|
+
visitTfpdef(ctx) {
|
|
49612
|
+
// Ignora anotação de tipo (: Tipo) — retorna apenas o nome
|
|
49613
|
+
return ctx.NAME().text;
|
|
49614
|
+
}
|
|
49615
|
+
visitTypedargslist(ctx) {
|
|
49616
|
+
const params = [];
|
|
49617
|
+
for (let i = 0; i < ctx.childCount;) {
|
|
49618
|
+
const filho = ctx.getChild(i);
|
|
49619
|
+
const texto = filho.text;
|
|
49620
|
+
if (texto === ',') {
|
|
49621
|
+
i++;
|
|
49622
|
+
continue;
|
|
49623
|
+
}
|
|
49624
|
+
// Para em *args ou **kwargs — suporte básico suficiente para fase 4
|
|
49625
|
+
if (texto === '*' || texto === '**')
|
|
48795
49626
|
break;
|
|
49627
|
+
const nomeParam = this.visit(filho); // → visitTfpdef → NAME
|
|
49628
|
+
if (nomeParam === 'self') {
|
|
49629
|
+
i++;
|
|
49630
|
+
continue;
|
|
49631
|
+
} // Remove self
|
|
49632
|
+
// Verifica se há valor padrão: tfpdef '=' test
|
|
49633
|
+
if (i + 1 < ctx.childCount && ctx.getChild(i + 1).text === '=') {
|
|
49634
|
+
const valorPadrao = this.visit(ctx.getChild(i + 2));
|
|
49635
|
+
params.push(`${nomeParam} = ${valorPadrao}`);
|
|
49636
|
+
i += 3;
|
|
49637
|
+
}
|
|
49638
|
+
else {
|
|
49639
|
+
params.push(nomeParam);
|
|
49640
|
+
i++;
|
|
49641
|
+
}
|
|
48796
49642
|
}
|
|
49643
|
+
return params.join(', ');
|
|
49644
|
+
}
|
|
49645
|
+
visitParameters(ctx) {
|
|
49646
|
+
const argslist = ctx.typedargslist();
|
|
49647
|
+
if (!argslist)
|
|
49648
|
+
return '';
|
|
49649
|
+
return this.visitTypedargslist(argslist);
|
|
49650
|
+
}
|
|
49651
|
+
visitFuncdef(ctx) {
|
|
49652
|
+
const nomePython = ctx.NAME().text;
|
|
49653
|
+
const params = this.visitParameters(ctx.parameters());
|
|
49654
|
+
const corpo = this.visitCorpo(ctx.suite());
|
|
49655
|
+
if (nomePython === '__init__') {
|
|
49656
|
+
return `construtor(${params}) ${corpo}`;
|
|
49657
|
+
}
|
|
49658
|
+
return `funcao ${nomePython}(${params}) ${corpo}`;
|
|
49659
|
+
}
|
|
49660
|
+
visitClassdef(ctx) {
|
|
49661
|
+
const nome = ctx.NAME().text;
|
|
49662
|
+
const arglist = ctx.arglist();
|
|
49663
|
+
const heranca = arglist ? ` herda ${this.visit(arglist)}` : '';
|
|
49664
|
+
const corpo = this.visitCorpo(ctx.suite());
|
|
49665
|
+
return `classe ${nome}${heranca} ${corpo}`;
|
|
49666
|
+
}
|
|
49667
|
+
visitDecorated(ctx) {
|
|
49668
|
+
// Ignora decoradores — traduz apenas o funcdef ou classdef subjacente
|
|
49669
|
+
const funcdef = ctx.funcdef();
|
|
49670
|
+
if (funcdef)
|
|
49671
|
+
return this.visitFuncdef(funcdef);
|
|
49672
|
+
const classdef = ctx.classdef();
|
|
49673
|
+
if (classdef)
|
|
49674
|
+
return this.visitClassdef(classdef);
|
|
49675
|
+
return this.visitChildren(ctx);
|
|
48797
49676
|
}
|
|
48798
49677
|
traduzir(codigo) {
|
|
48799
|
-
|
|
48800
|
-
|
|
48801
|
-
|
|
48802
|
-
|
|
48803
|
-
|
|
48804
|
-
|
|
48805
|
-
|
|
48806
|
-
|
|
48807
|
-
ParseTreeWalker_1.ParseTreeWalker.DEFAULT.walk(this, tree);
|
|
48808
|
-
return this.resultado;
|
|
49678
|
+
// O lexer Python3 do ANTLR exige NEWLINE ao final de cada instrução.
|
|
49679
|
+
const codigoNormalizado = codigo.endsWith('\n') ? codigo : codigo + '\n';
|
|
49680
|
+
const inputStream = antlr4ts_1.CharStreams.fromString(codigoNormalizado);
|
|
49681
|
+
const lexer = new python3_lexer_1.Python3Lexer(inputStream);
|
|
49682
|
+
const tokenStream = new antlr4ts_1.CommonTokenStream(lexer);
|
|
49683
|
+
const parser = new python3_parser_1.Python3Parser(tokenStream);
|
|
49684
|
+
const tree = parser.file_input();
|
|
49685
|
+
return this.visit(tree);
|
|
48809
49686
|
}
|
|
48810
49687
|
}
|
|
48811
49688
|
exports.TradutorReversoPython = TradutorReversoPython;
|
|
48812
49689
|
|
|
48813
|
-
},{"./python/python3-lexer":239,"./python/python3-parser":240,"antlr4ts":371,"antlr4ts/tree/
|
|
49690
|
+
},{"./python/python3-lexer":239,"./python/python3-parser":240,"antlr4ts":371,"antlr4ts/tree/AbstractParseTreeVisitor":389}],253:[function(require,module,exports){
|
|
48814
49691
|
"use strict";
|
|
48815
49692
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48816
49693
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -55532,7 +56409,7 @@ __decorate([
|
|
|
55532
56409
|
exports.Parser = Parser;
|
|
55533
56410
|
|
|
55534
56411
|
}).call(this)}).call(this,require('_process'))
|
|
55535
|
-
},{"./Decorators":269,"./DefaultErrorStrategy":270,"./Lexer":277,"./ProxyParserErrorListener":287,"./Recognizer":289,"./Token":294,"./atn/ATNDeserializationOptions":305,"./atn/ATNDeserializer":306,"./atn/ParseInfo":342,"./atn/ParserATNSimulator":343,"./atn/ProfilingATNSimulator":352,"./misc/IntegerStack":380,"./misc/Utils":388,"./tree/ErrorNode":
|
|
56412
|
+
},{"./Decorators":269,"./DefaultErrorStrategy":270,"./Lexer":277,"./ProxyParserErrorListener":287,"./Recognizer":289,"./Token":294,"./atn/ATNDeserializationOptions":305,"./atn/ATNDeserializer":306,"./atn/ParseInfo":342,"./atn/ParserATNSimulator":343,"./atn/ProfilingATNSimulator":352,"./misc/IntegerStack":380,"./misc/Utils":388,"./tree/ErrorNode":390,"./tree/TerminalNode":392,"./tree/pattern/ParseTreePatternMatcher":397,"_process":471}],283:[function(require,module,exports){
|
|
55536
56413
|
"use strict";
|
|
55537
56414
|
/*!
|
|
55538
56415
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
@@ -56249,7 +57126,7 @@ __decorate([
|
|
|
56249
57126
|
], ParserRuleContext.prototype, "sourceInterval", null);
|
|
56250
57127
|
exports.ParserRuleContext = ParserRuleContext;
|
|
56251
57128
|
|
|
56252
|
-
},{"./Decorators":269,"./RuleContext":290,"./misc/Interval":381,"./tree/ErrorNode":
|
|
57129
|
+
},{"./Decorators":269,"./RuleContext":290,"./misc/Interval":381,"./tree/ErrorNode":390,"./tree/TerminalNode":392}],286:[function(require,module,exports){
|
|
56253
57130
|
"use strict";
|
|
56254
57131
|
/*!
|
|
56255
57132
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
@@ -70471,7 +71348,7 @@ class BitSetIterator {
|
|
|
70471
71348
|
[Symbol.iterator]() { return this; }
|
|
70472
71349
|
}
|
|
70473
71350
|
|
|
70474
|
-
},{"./MurmurHash":384,"util":
|
|
71351
|
+
},{"./MurmurHash":384,"util":476}],377:[function(require,module,exports){
|
|
70475
71352
|
"use strict";
|
|
70476
71353
|
/*!
|
|
70477
71354
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
@@ -72153,6 +73030,151 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
72153
73030
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
72154
73031
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
72155
73032
|
};
|
|
73033
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
73034
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
73035
|
+
};
|
|
73036
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73037
|
+
exports.AbstractParseTreeVisitor = void 0;
|
|
73038
|
+
const Decorators_1 = require("../Decorators");
|
|
73039
|
+
class AbstractParseTreeVisitor {
|
|
73040
|
+
/**
|
|
73041
|
+
* {@inheritDoc}
|
|
73042
|
+
*
|
|
73043
|
+
* The default implementation calls {@link ParseTree#accept} on the
|
|
73044
|
+
* specified tree.
|
|
73045
|
+
*/
|
|
73046
|
+
visit(tree) {
|
|
73047
|
+
return tree.accept(this);
|
|
73048
|
+
}
|
|
73049
|
+
/**
|
|
73050
|
+
* {@inheritDoc}
|
|
73051
|
+
*
|
|
73052
|
+
* The default implementation initializes the aggregate result to
|
|
73053
|
+
* {@link #defaultResult defaultResult()}. Before visiting each child, it
|
|
73054
|
+
* calls {@link #shouldVisitNextChild shouldVisitNextChild}; if the result
|
|
73055
|
+
* is `false` no more children are visited and the current aggregate
|
|
73056
|
+
* result is returned. After visiting a child, the aggregate result is
|
|
73057
|
+
* updated by calling {@link #aggregateResult aggregateResult} with the
|
|
73058
|
+
* previous aggregate result and the result of visiting the child.
|
|
73059
|
+
*
|
|
73060
|
+
* The default implementation is not safe for use in visitors that modify
|
|
73061
|
+
* the tree structure. Visitors that modify the tree should override this
|
|
73062
|
+
* method to behave properly in respect to the specific algorithm in use.
|
|
73063
|
+
*/
|
|
73064
|
+
visitChildren(node) {
|
|
73065
|
+
let result = this.defaultResult();
|
|
73066
|
+
let n = node.childCount;
|
|
73067
|
+
for (let i = 0; i < n; i++) {
|
|
73068
|
+
if (!this.shouldVisitNextChild(node, result)) {
|
|
73069
|
+
break;
|
|
73070
|
+
}
|
|
73071
|
+
let c = node.getChild(i);
|
|
73072
|
+
let childResult = c.accept(this);
|
|
73073
|
+
result = this.aggregateResult(result, childResult);
|
|
73074
|
+
}
|
|
73075
|
+
return result;
|
|
73076
|
+
}
|
|
73077
|
+
/**
|
|
73078
|
+
* {@inheritDoc}
|
|
73079
|
+
*
|
|
73080
|
+
* The default implementation returns the result of
|
|
73081
|
+
* {@link #defaultResult defaultResult}.
|
|
73082
|
+
*/
|
|
73083
|
+
visitTerminal(node) {
|
|
73084
|
+
return this.defaultResult();
|
|
73085
|
+
}
|
|
73086
|
+
/**
|
|
73087
|
+
* {@inheritDoc}
|
|
73088
|
+
*
|
|
73089
|
+
* The default implementation returns the result of
|
|
73090
|
+
* {@link #defaultResult defaultResult}.
|
|
73091
|
+
*/
|
|
73092
|
+
visitErrorNode(node) {
|
|
73093
|
+
return this.defaultResult();
|
|
73094
|
+
}
|
|
73095
|
+
/**
|
|
73096
|
+
* Aggregates the results of visiting multiple children of a node. After
|
|
73097
|
+
* either all children are visited or {@link #shouldVisitNextChild} returns
|
|
73098
|
+
* `false`, the aggregate value is returned as the result of
|
|
73099
|
+
* {@link #visitChildren}.
|
|
73100
|
+
*
|
|
73101
|
+
* The default implementation returns `nextResult`, meaning
|
|
73102
|
+
* {@link #visitChildren} will return the result of the last child visited
|
|
73103
|
+
* (or return the initial value if the node has no children).
|
|
73104
|
+
*
|
|
73105
|
+
* @param aggregate The previous aggregate value. In the default
|
|
73106
|
+
* implementation, the aggregate value is initialized to
|
|
73107
|
+
* {@link #defaultResult}, which is passed as the `aggregate` argument
|
|
73108
|
+
* to this method after the first child node is visited.
|
|
73109
|
+
* @param nextResult The result of the immediately preceeding call to visit
|
|
73110
|
+
* a child node.
|
|
73111
|
+
*
|
|
73112
|
+
* @returns The updated aggregate result.
|
|
73113
|
+
*/
|
|
73114
|
+
aggregateResult(aggregate, nextResult) {
|
|
73115
|
+
return nextResult;
|
|
73116
|
+
}
|
|
73117
|
+
/**
|
|
73118
|
+
* This method is called after visiting each child in
|
|
73119
|
+
* {@link #visitChildren}. This method is first called before the first
|
|
73120
|
+
* child is visited; at that point `currentResult` will be the initial
|
|
73121
|
+
* value (in the default implementation, the initial value is returned by a
|
|
73122
|
+
* call to {@link #defaultResult}. This method is not called after the last
|
|
73123
|
+
* child is visited.
|
|
73124
|
+
*
|
|
73125
|
+
* The default implementation always returns `true`, indicating that
|
|
73126
|
+
* `visitChildren` should only return after all children are visited.
|
|
73127
|
+
* One reason to override this method is to provide a "short circuit"
|
|
73128
|
+
* evaluation option for situations where the result of visiting a single
|
|
73129
|
+
* child has the potential to determine the result of the visit operation as
|
|
73130
|
+
* a whole.
|
|
73131
|
+
*
|
|
73132
|
+
* @param node The {@link RuleNode} whose children are currently being
|
|
73133
|
+
* visited.
|
|
73134
|
+
* @param currentResult The current aggregate result of the children visited
|
|
73135
|
+
* to the current point.
|
|
73136
|
+
*
|
|
73137
|
+
* @returns `true` to continue visiting children. Otherwise return
|
|
73138
|
+
* `false` to stop visiting children and immediately return the
|
|
73139
|
+
* current aggregate result from {@link #visitChildren}.
|
|
73140
|
+
*/
|
|
73141
|
+
shouldVisitNextChild(node, currentResult) {
|
|
73142
|
+
return true;
|
|
73143
|
+
}
|
|
73144
|
+
}
|
|
73145
|
+
__decorate([
|
|
73146
|
+
Decorators_1.Override,
|
|
73147
|
+
__param(0, Decorators_1.NotNull)
|
|
73148
|
+
], AbstractParseTreeVisitor.prototype, "visit", null);
|
|
73149
|
+
__decorate([
|
|
73150
|
+
Decorators_1.Override,
|
|
73151
|
+
__param(0, Decorators_1.NotNull)
|
|
73152
|
+
], AbstractParseTreeVisitor.prototype, "visitChildren", null);
|
|
73153
|
+
__decorate([
|
|
73154
|
+
Decorators_1.Override,
|
|
73155
|
+
__param(0, Decorators_1.NotNull)
|
|
73156
|
+
], AbstractParseTreeVisitor.prototype, "visitTerminal", null);
|
|
73157
|
+
__decorate([
|
|
73158
|
+
Decorators_1.Override,
|
|
73159
|
+
__param(0, Decorators_1.NotNull)
|
|
73160
|
+
], AbstractParseTreeVisitor.prototype, "visitErrorNode", null);
|
|
73161
|
+
__decorate([
|
|
73162
|
+
__param(0, Decorators_1.NotNull)
|
|
73163
|
+
], AbstractParseTreeVisitor.prototype, "shouldVisitNextChild", null);
|
|
73164
|
+
exports.AbstractParseTreeVisitor = AbstractParseTreeVisitor;
|
|
73165
|
+
|
|
73166
|
+
},{"../Decorators":269}],390:[function(require,module,exports){
|
|
73167
|
+
"use strict";
|
|
73168
|
+
/*!
|
|
73169
|
+
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
73170
|
+
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
73171
|
+
*/
|
|
73172
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
73173
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
73174
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
73175
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
73176
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
73177
|
+
};
|
|
72156
73178
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72157
73179
|
exports.ErrorNode = void 0;
|
|
72158
73180
|
// ConvertTo-TS run at 2016-10-04T11:26:47.4646355-07:00
|
|
@@ -72177,112 +73199,7 @@ __decorate([
|
|
|
72177
73199
|
], ErrorNode.prototype, "accept", null);
|
|
72178
73200
|
exports.ErrorNode = ErrorNode;
|
|
72179
73201
|
|
|
72180
|
-
},{"../Decorators":269,"./TerminalNode":392}],
|
|
72181
|
-
"use strict";
|
|
72182
|
-
/*!
|
|
72183
|
-
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
72184
|
-
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
72185
|
-
*/
|
|
72186
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72187
|
-
exports.ParseTreeWalker = void 0;
|
|
72188
|
-
const ErrorNode_1 = require("./ErrorNode");
|
|
72189
|
-
const TerminalNode_1 = require("./TerminalNode");
|
|
72190
|
-
const RuleNode_1 = require("./RuleNode");
|
|
72191
|
-
class ParseTreeWalker {
|
|
72192
|
-
/**
|
|
72193
|
-
* Performs a walk on the given parse tree starting at the root and going down recursively
|
|
72194
|
-
* with depth-first search. On each node, {@link ParseTreeWalker#enterRule} is called before
|
|
72195
|
-
* recursively walking down into child nodes, then
|
|
72196
|
-
* {@link ParseTreeWalker#exitRule} is called after the recursive call to wind up.
|
|
72197
|
-
* @param listener The listener used by the walker to process grammar rules
|
|
72198
|
-
* @param t The parse tree to be walked on
|
|
72199
|
-
*/
|
|
72200
|
-
walk(listener, t) {
|
|
72201
|
-
let nodeStack = [];
|
|
72202
|
-
let indexStack = [];
|
|
72203
|
-
let currentNode = t;
|
|
72204
|
-
let currentIndex = 0;
|
|
72205
|
-
while (currentNode) {
|
|
72206
|
-
// pre-order visit
|
|
72207
|
-
if (currentNode instanceof ErrorNode_1.ErrorNode) {
|
|
72208
|
-
if (listener.visitErrorNode) {
|
|
72209
|
-
listener.visitErrorNode(currentNode);
|
|
72210
|
-
}
|
|
72211
|
-
}
|
|
72212
|
-
else if (currentNode instanceof TerminalNode_1.TerminalNode) {
|
|
72213
|
-
if (listener.visitTerminal) {
|
|
72214
|
-
listener.visitTerminal(currentNode);
|
|
72215
|
-
}
|
|
72216
|
-
}
|
|
72217
|
-
else {
|
|
72218
|
-
this.enterRule(listener, currentNode);
|
|
72219
|
-
}
|
|
72220
|
-
// Move down to first child, if exists
|
|
72221
|
-
if (currentNode.childCount > 0) {
|
|
72222
|
-
nodeStack.push(currentNode);
|
|
72223
|
-
indexStack.push(currentIndex);
|
|
72224
|
-
currentIndex = 0;
|
|
72225
|
-
currentNode = currentNode.getChild(0);
|
|
72226
|
-
continue;
|
|
72227
|
-
}
|
|
72228
|
-
// No child nodes, so walk tree
|
|
72229
|
-
do {
|
|
72230
|
-
// post-order visit
|
|
72231
|
-
if (currentNode instanceof RuleNode_1.RuleNode) {
|
|
72232
|
-
this.exitRule(listener, currentNode);
|
|
72233
|
-
}
|
|
72234
|
-
// No parent, so no siblings
|
|
72235
|
-
if (nodeStack.length === 0) {
|
|
72236
|
-
currentNode = undefined;
|
|
72237
|
-
currentIndex = 0;
|
|
72238
|
-
break;
|
|
72239
|
-
}
|
|
72240
|
-
// Move to next sibling if possible
|
|
72241
|
-
let last = nodeStack[nodeStack.length - 1];
|
|
72242
|
-
currentIndex++;
|
|
72243
|
-
currentNode = currentIndex < last.childCount ? last.getChild(currentIndex) : undefined;
|
|
72244
|
-
if (currentNode) {
|
|
72245
|
-
break;
|
|
72246
|
-
}
|
|
72247
|
-
// No next sibling, so move up
|
|
72248
|
-
currentNode = nodeStack.pop();
|
|
72249
|
-
currentIndex = indexStack.pop();
|
|
72250
|
-
} while (currentNode);
|
|
72251
|
-
}
|
|
72252
|
-
}
|
|
72253
|
-
/**
|
|
72254
|
-
* Enters a grammar rule by first triggering the generic event {@link ParseTreeListener#enterEveryRule}
|
|
72255
|
-
* then by triggering the event specific to the given parse tree node
|
|
72256
|
-
* @param listener The listener responding to the trigger events
|
|
72257
|
-
* @param r The grammar rule containing the rule context
|
|
72258
|
-
*/
|
|
72259
|
-
enterRule(listener, r) {
|
|
72260
|
-
let ctx = r.ruleContext;
|
|
72261
|
-
if (listener.enterEveryRule) {
|
|
72262
|
-
listener.enterEveryRule(ctx);
|
|
72263
|
-
}
|
|
72264
|
-
ctx.enterRule(listener);
|
|
72265
|
-
}
|
|
72266
|
-
/**
|
|
72267
|
-
* Exits a grammar rule by first triggering the event specific to the given parse tree node
|
|
72268
|
-
* then by triggering the generic event {@link ParseTreeListener#exitEveryRule}
|
|
72269
|
-
* @param listener The listener responding to the trigger events
|
|
72270
|
-
* @param r The grammar rule containing the rule context
|
|
72271
|
-
*/
|
|
72272
|
-
exitRule(listener, r) {
|
|
72273
|
-
let ctx = r.ruleContext;
|
|
72274
|
-
ctx.exitRule(listener);
|
|
72275
|
-
if (listener.exitEveryRule) {
|
|
72276
|
-
listener.exitEveryRule(ctx);
|
|
72277
|
-
}
|
|
72278
|
-
}
|
|
72279
|
-
}
|
|
72280
|
-
exports.ParseTreeWalker = ParseTreeWalker;
|
|
72281
|
-
(function (ParseTreeWalker) {
|
|
72282
|
-
ParseTreeWalker.DEFAULT = new ParseTreeWalker();
|
|
72283
|
-
})(ParseTreeWalker = exports.ParseTreeWalker || (exports.ParseTreeWalker = {}));
|
|
72284
|
-
|
|
72285
|
-
},{"./ErrorNode":389,"./RuleNode":391,"./TerminalNode":392}],391:[function(require,module,exports){
|
|
73202
|
+
},{"../Decorators":269,"./TerminalNode":392}],391:[function(require,module,exports){
|
|
72286
73203
|
"use strict";
|
|
72287
73204
|
/*!
|
|
72288
73205
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
@@ -72630,7 +73547,7 @@ __decorate([
|
|
|
72630
73547
|
], Trees, "getRootOfSubtreeEnclosingRegion", null);
|
|
72631
73548
|
exports.Trees = Trees;
|
|
72632
73549
|
|
|
72633
|
-
},{"../CommonToken":265,"../Decorators":269,"../Parser":282,"../ParserRuleContext":285,"../Token":294,"../atn/ATN":302,"../misc/Utils":388,"./ErrorNode":
|
|
73550
|
+
},{"../CommonToken":265,"../Decorators":269,"../Parser":282,"../ParserRuleContext":285,"../Token":294,"../atn/ATN":302,"../misc/Utils":388,"./ErrorNode":390,"./RuleNode":391,"./TerminalNode":392}],394:[function(require,module,exports){
|
|
72634
73551
|
"use strict";
|
|
72635
73552
|
/*!
|
|
72636
73553
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
@@ -77349,7 +78266,7 @@ module.exports = function isTypedArray(value) {
|
|
|
77349
78266
|
return !!whichTypedArray(value);
|
|
77350
78267
|
};
|
|
77351
78268
|
|
|
77352
|
-
},{"which-typed-array":
|
|
78269
|
+
},{"which-typed-array":477}],457:[function(require,module,exports){
|
|
77353
78270
|
'use strict';
|
|
77354
78271
|
|
|
77355
78272
|
/** @type {import('./abs')} */
|
|
@@ -77957,87 +78874,8 @@ module.exports = function setFunctionLength(fn, length) {
|
|
|
77957
78874
|
};
|
|
77958
78875
|
|
|
77959
78876
|
},{"define-data-property":426,"es-errors/type":434,"get-intrinsic":440,"gopd":445,"has-property-descriptors":446}],474:[function(require,module,exports){
|
|
77960
|
-
(function (setImmediate,clearImmediate){(function (){
|
|
77961
|
-
var nextTick = require('process/browser.js').nextTick;
|
|
77962
|
-
var apply = Function.prototype.apply;
|
|
77963
|
-
var slice = Array.prototype.slice;
|
|
77964
|
-
var immediateIds = {};
|
|
77965
|
-
var nextImmediateId = 0;
|
|
77966
|
-
|
|
77967
|
-
// DOM APIs, for completeness
|
|
77968
|
-
|
|
77969
|
-
exports.setTimeout = function() {
|
|
77970
|
-
return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
|
77971
|
-
};
|
|
77972
|
-
exports.setInterval = function() {
|
|
77973
|
-
return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
|
77974
|
-
};
|
|
77975
|
-
exports.clearTimeout =
|
|
77976
|
-
exports.clearInterval = function(timeout) { timeout.close(); };
|
|
77977
|
-
|
|
77978
|
-
function Timeout(id, clearFn) {
|
|
77979
|
-
this._id = id;
|
|
77980
|
-
this._clearFn = clearFn;
|
|
77981
|
-
}
|
|
77982
|
-
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
|
77983
|
-
Timeout.prototype.close = function() {
|
|
77984
|
-
this._clearFn.call(window, this._id);
|
|
77985
|
-
};
|
|
77986
|
-
|
|
77987
|
-
// Does not start the time, just sets up the members needed.
|
|
77988
|
-
exports.enroll = function(item, msecs) {
|
|
77989
|
-
clearTimeout(item._idleTimeoutId);
|
|
77990
|
-
item._idleTimeout = msecs;
|
|
77991
|
-
};
|
|
77992
|
-
|
|
77993
|
-
exports.unenroll = function(item) {
|
|
77994
|
-
clearTimeout(item._idleTimeoutId);
|
|
77995
|
-
item._idleTimeout = -1;
|
|
77996
|
-
};
|
|
77997
|
-
|
|
77998
|
-
exports._unrefActive = exports.active = function(item) {
|
|
77999
|
-
clearTimeout(item._idleTimeoutId);
|
|
78000
|
-
|
|
78001
|
-
var msecs = item._idleTimeout;
|
|
78002
|
-
if (msecs >= 0) {
|
|
78003
|
-
item._idleTimeoutId = setTimeout(function onTimeout() {
|
|
78004
|
-
if (item._onTimeout)
|
|
78005
|
-
item._onTimeout();
|
|
78006
|
-
}, msecs);
|
|
78007
|
-
}
|
|
78008
|
-
};
|
|
78009
|
-
|
|
78010
|
-
// That's not how node.js implements it but the exposed api is the same.
|
|
78011
|
-
exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
|
|
78012
|
-
var id = nextImmediateId++;
|
|
78013
|
-
var args = arguments.length < 2 ? false : slice.call(arguments, 1);
|
|
78014
|
-
|
|
78015
|
-
immediateIds[id] = true;
|
|
78016
|
-
|
|
78017
|
-
nextTick(function onNextTick() {
|
|
78018
|
-
if (immediateIds[id]) {
|
|
78019
|
-
// fn.call() is faster so we optimize for the common use-case
|
|
78020
|
-
// @see http://jsperf.com/call-apply-segu
|
|
78021
|
-
if (args) {
|
|
78022
|
-
fn.apply(null, args);
|
|
78023
|
-
} else {
|
|
78024
|
-
fn.call(null);
|
|
78025
|
-
}
|
|
78026
|
-
// Prevent ids from leaking
|
|
78027
|
-
exports.clearImmediate(id);
|
|
78028
|
-
}
|
|
78029
|
-
});
|
|
78030
|
-
|
|
78031
|
-
return id;
|
|
78032
|
-
};
|
|
78033
|
-
|
|
78034
|
-
exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
|
|
78035
|
-
delete immediateIds[id];
|
|
78036
|
-
};
|
|
78037
|
-
}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
|
78038
|
-
},{"process/browser.js":471,"timers":474}],475:[function(require,module,exports){
|
|
78039
78877
|
arguments[4][414][0].apply(exports,arguments)
|
|
78040
|
-
},{"dup":414}],
|
|
78878
|
+
},{"dup":414}],475:[function(require,module,exports){
|
|
78041
78879
|
// Currently in sync with Node.js lib/internal/util/types.js
|
|
78042
78880
|
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
|
|
78043
78881
|
|
|
@@ -78373,7 +79211,7 @@ exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
|
|
78373
79211
|
});
|
|
78374
79212
|
});
|
|
78375
79213
|
|
|
78376
|
-
},{"is-arguments":452,"is-generator-function":454,"is-typed-array":456,"which-typed-array":
|
|
79214
|
+
},{"is-arguments":452,"is-generator-function":454,"is-typed-array":456,"which-typed-array":477}],476:[function(require,module,exports){
|
|
78377
79215
|
(function (process){(function (){
|
|
78378
79216
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
78379
79217
|
//
|
|
@@ -79092,7 +79930,7 @@ function callbackify(original) {
|
|
|
79092
79930
|
exports.callbackify = callbackify;
|
|
79093
79931
|
|
|
79094
79932
|
}).call(this)}).call(this,require('_process'))
|
|
79095
|
-
},{"./support/isBuffer":
|
|
79933
|
+
},{"./support/isBuffer":474,"./support/types":475,"_process":471,"inherits":451}],477:[function(require,module,exports){
|
|
79096
79934
|
(function (global){(function (){
|
|
79097
79935
|
'use strict';
|
|
79098
79936
|
|