@designliquido/delegua 1.3.0 → 1.3.1
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/bin/package.json +1 -1
- package/interfaces/visitante-comum-interface.d.ts +3 -4
- package/interfaces/visitante-comum-interface.d.ts.map +1 -1
- package/interpretador/depuracao/comum.d.ts +2 -0
- package/interpretador/depuracao/comum.d.ts.map +1 -1
- package/interpretador/depuracao/comum.js +15 -2
- package/interpretador/depuracao/comum.js.map +1 -1
- package/interpretador/depuracao/interpretador-base-com-depuracao.d.ts +2 -0
- package/interpretador/depuracao/interpretador-base-com-depuracao.d.ts.map +1 -1
- package/interpretador/depuracao/interpretador-base-com-depuracao.js +6 -0
- package/interpretador/depuracao/interpretador-base-com-depuracao.js.map +1 -1
- package/interpretador/interpretador-base.d.ts +2 -2
- package/interpretador/interpretador-base.d.ts.map +1 -1
- package/interpretador/interpretador-base.js +8 -5
- package/interpretador/interpretador-base.js.map +1 -1
- package/interpretador/interpretador.d.ts +1 -3
- package/interpretador/interpretador.d.ts.map +1 -1
- package/interpretador/interpretador.js +0 -8
- package/interpretador/interpretador.js.map +1 -1
- package/package.json +1 -1
- package/tradutores/tradutor-mermaidjs.d.ts +24 -25
- package/tradutores/tradutor-mermaidjs.d.ts.map +1 -1
- package/tradutores/tradutor-mermaidjs.js +187 -31
- package/tradutores/tradutor-mermaidjs.js.map +1 -1
- package/umd/delegua.js +196 -45
package/umd/delegua.js
CHANGED
|
@@ -16628,11 +16628,9 @@ class InterpretadorBase {
|
|
|
16628
16628
|
// Outros tipos de objetos (Date, classes customizadas, etc.)
|
|
16629
16629
|
return objeto;
|
|
16630
16630
|
}
|
|
16631
|
-
visitarExpressaoArgumentoReferenciaFuncao(expressao) {
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
visitarExpressaoReferenciaFuncao(expressao) {
|
|
16635
|
-
throw new Error('Método não implementado.');
|
|
16631
|
+
async visitarExpressaoArgumentoReferenciaFuncao(expressao) {
|
|
16632
|
+
const deleguaFuncao = this.pilhaEscoposExecucao.obterVariavelPorNome(expressao.simboloFuncao.lexema);
|
|
16633
|
+
return deleguaFuncao;
|
|
16636
16634
|
}
|
|
16637
16635
|
visitarExpressaoAcessoMetodo(expressao) {
|
|
16638
16636
|
throw new Error('Método não implementado.');
|
|
@@ -16710,6 +16708,10 @@ class InterpretadorBase {
|
|
|
16710
16708
|
async visitarExpressaoFimPara(declaracao) {
|
|
16711
16709
|
throw new Error('Método não implementado.');
|
|
16712
16710
|
}
|
|
16711
|
+
async visitarExpressaoReferenciaFuncao(expressao) {
|
|
16712
|
+
const deleguaFuncao = this.pilhaEscoposExecucao.obterReferenciaFuncao(expressao.idFuncao);
|
|
16713
|
+
return deleguaFuncao;
|
|
16714
|
+
}
|
|
16713
16715
|
/**
|
|
16714
16716
|
* Chama o método `aceitar` de um construto ou declaração, passando o
|
|
16715
16717
|
* próprio interpretador como parâmetro.
|
|
@@ -17774,6 +17776,7 @@ class InterpretadorBase {
|
|
|
17774
17776
|
visitarDeclaracaoDefinicaoFuncao(declaracao) {
|
|
17775
17777
|
const funcao = new estruturas_1.DeleguaFuncao(declaracao.simbolo.lexema, declaracao.funcao);
|
|
17776
17778
|
this.pilhaEscoposExecucao.definirVariavel(declaracao.simbolo.lexema, funcao);
|
|
17779
|
+
this.pilhaEscoposExecucao.registrarReferenciaFuncao(declaracao.id, funcao);
|
|
17777
17780
|
return Promise.resolve({
|
|
17778
17781
|
declaracao: funcao,
|
|
17779
17782
|
});
|
|
@@ -19031,10 +19034,6 @@ class Interpretador extends interpretador_base_1.InterpretadorBase {
|
|
|
19031
19034
|
async visitarExpressaoAjuda(expressao) {
|
|
19032
19035
|
return Promise.resolve((0, comum_1.pontoEntradaAjuda)(expressao.funcao, expressao.valor));
|
|
19033
19036
|
}
|
|
19034
|
-
async visitarExpressaoArgumentoReferenciaFuncao(expressao) {
|
|
19035
|
-
const deleguaFuncao = this.pilhaEscoposExecucao.obterVariavelPorNome(expressao.simboloFuncao.lexema);
|
|
19036
|
-
return deleguaFuncao;
|
|
19037
|
-
}
|
|
19038
19037
|
async visitarExpressaoAtribuicaoPorIndice(expressao) {
|
|
19039
19038
|
const promises = await Promise.all([
|
|
19040
19039
|
this.avaliar(expressao.objeto),
|
|
@@ -19201,10 +19200,6 @@ class Interpretador extends interpretador_base_1.InterpretadorBase {
|
|
|
19201
19200
|
visitarExpressaoParaCada(expressao) {
|
|
19202
19201
|
return this.logicaComumExecucaoParaCada(expressao, true);
|
|
19203
19202
|
}
|
|
19204
|
-
async visitarExpressaoReferenciaFuncao(expressao) {
|
|
19205
|
-
const deleguaFuncao = this.pilhaEscoposExecucao.obterReferenciaFuncao(expressao.idFuncao);
|
|
19206
|
-
return deleguaFuncao;
|
|
19207
|
-
}
|
|
19208
19203
|
async visitarExpressaoRetornar(declaracao) {
|
|
19209
19204
|
let valor = null;
|
|
19210
19205
|
if (declaracao.valor !== null && declaracao.valor !== undefined) {
|
|
@@ -40767,6 +40762,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40767
40762
|
};
|
|
40768
40763
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40769
40764
|
exports.TradutorMermaidJs = void 0;
|
|
40765
|
+
const construtos_1 = require("../construtos");
|
|
40770
40766
|
const mermaid_1 = require("./mermaid");
|
|
40771
40767
|
const delegua_1 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
40772
40768
|
/**
|
|
@@ -40859,7 +40855,7 @@ class TradutorMermaidJs {
|
|
|
40859
40855
|
}
|
|
40860
40856
|
async visitarDeclaracaoDeExpressao(declaracao) {
|
|
40861
40857
|
// Verifica se é uma chamada de função
|
|
40862
|
-
if (declaracao.expressao.constructor
|
|
40858
|
+
if (declaracao.expressao.constructor === construtos_1.Chamada) {
|
|
40863
40859
|
const chamada = declaracao.expressao;
|
|
40864
40860
|
const verticesChamada = await this.traduzirChamadaFuncao(declaracao, chamada);
|
|
40865
40861
|
if (verticesChamada.length > 0) {
|
|
@@ -41050,7 +41046,9 @@ class TradutorMermaidJs {
|
|
|
41050
41046
|
// Caminho então, normalmente um `Bloco`.
|
|
41051
41047
|
const verticesEntao = await declaracao.caminhoEntao.aceitar(this);
|
|
41052
41048
|
vertices = vertices.concat(verticesEntao);
|
|
41053
|
-
const ultimaArestaEntao = verticesEntao
|
|
41049
|
+
const ultimaArestaEntao = verticesEntao.length > 0
|
|
41050
|
+
? verticesEntao[verticesEntao.length - 1].destino
|
|
41051
|
+
: aresta;
|
|
41054
41052
|
if (declaracao.caminhoSenao) {
|
|
41055
41053
|
this.anteriores = [];
|
|
41056
41054
|
const arestaSenao = new mermaid_1.ArestaFluxograma(declaracao, `Linha${declaracao.caminhoSenao.linha}(senão)`);
|
|
@@ -41076,8 +41074,80 @@ class TradutorMermaidJs {
|
|
|
41076
41074
|
vertices.push(new mermaid_1.VerticeFluxograma(ultimaArestaCorpo, aresta));
|
|
41077
41075
|
return Promise.resolve(vertices);
|
|
41078
41076
|
}
|
|
41079
|
-
visitarDeclaracaoTente(declaracao) {
|
|
41080
|
-
|
|
41077
|
+
async visitarDeclaracaoTente(declaracao) {
|
|
41078
|
+
const texto = `Linha${declaracao.linha}(tente)`;
|
|
41079
|
+
const aresta = new mermaid_1.ArestaFluxograma(declaracao, texto);
|
|
41080
|
+
let vertices = this.logicaComumConexaoArestas(aresta);
|
|
41081
|
+
this.anteriores.push(aresta);
|
|
41082
|
+
// Caminho tente (try)
|
|
41083
|
+
const verticesTente = [];
|
|
41084
|
+
for (const declaracaoTente of declaracao.caminhoTente) {
|
|
41085
|
+
const verticesDeclaracao = await declaracaoTente.aceitar(this);
|
|
41086
|
+
verticesTente.push(...verticesDeclaracao);
|
|
41087
|
+
}
|
|
41088
|
+
vertices = vertices.concat(verticesTente);
|
|
41089
|
+
const ultimaArestaTente = verticesTente.length > 0
|
|
41090
|
+
? verticesTente[verticesTente.length - 1].destino
|
|
41091
|
+
: aresta;
|
|
41092
|
+
const anterioresAposTente = [];
|
|
41093
|
+
// Caminho pegue (catch) - se existir
|
|
41094
|
+
if (declaracao.caminhoPegue) {
|
|
41095
|
+
this.anteriores = [aresta];
|
|
41096
|
+
const arestaPegue = new mermaid_1.ArestaFluxograma(declaracao, `Linha${declaracao.linha}Pegue(pegue)`);
|
|
41097
|
+
vertices.push(new mermaid_1.VerticeFluxograma(aresta, arestaPegue, 'Erro'));
|
|
41098
|
+
this.anteriores.push(arestaPegue);
|
|
41099
|
+
const verticesPegue = [];
|
|
41100
|
+
if (Array.isArray(declaracao.caminhoPegue)) {
|
|
41101
|
+
for (const declaracaoPegue of declaracao.caminhoPegue) {
|
|
41102
|
+
const verticesDeclaracao = await declaracaoPegue.aceitar(this);
|
|
41103
|
+
verticesPegue.push(...verticesDeclaracao);
|
|
41104
|
+
}
|
|
41105
|
+
}
|
|
41106
|
+
vertices = vertices.concat(verticesPegue);
|
|
41107
|
+
const ultimaArestaPegue = verticesPegue.length > 0
|
|
41108
|
+
? verticesPegue[verticesPegue.length - 1].destino
|
|
41109
|
+
: arestaPegue;
|
|
41110
|
+
anterioresAposTente.push(ultimaArestaPegue);
|
|
41111
|
+
}
|
|
41112
|
+
// Caminho senão (else) - se existir
|
|
41113
|
+
if (declaracao.caminhoSenao && declaracao.caminhoSenao.length > 0) {
|
|
41114
|
+
this.anteriores = [ultimaArestaTente];
|
|
41115
|
+
const arestaSenao = new mermaid_1.ArestaFluxograma(declaracao, `Linha${declaracao.linha}Senao(senão - sem erro)`);
|
|
41116
|
+
vertices.push(new mermaid_1.VerticeFluxograma(ultimaArestaTente, arestaSenao, 'Sucesso'));
|
|
41117
|
+
this.anteriores.push(arestaSenao);
|
|
41118
|
+
const verticesSenao = [];
|
|
41119
|
+
for (const declaracaoSenao of declaracao.caminhoSenao) {
|
|
41120
|
+
const verticesDeclaracao = await declaracaoSenao.aceitar(this);
|
|
41121
|
+
verticesSenao.push(...verticesDeclaracao);
|
|
41122
|
+
}
|
|
41123
|
+
vertices = vertices.concat(verticesSenao);
|
|
41124
|
+
const ultimaArestaSenao = verticesSenao.length > 0
|
|
41125
|
+
? verticesSenao[verticesSenao.length - 1].destino
|
|
41126
|
+
: arestaSenao;
|
|
41127
|
+
anterioresAposTente.push(ultimaArestaSenao);
|
|
41128
|
+
}
|
|
41129
|
+
else {
|
|
41130
|
+
// Se não há senão, o caminho de sucesso também continua
|
|
41131
|
+
anterioresAposTente.push(ultimaArestaTente);
|
|
41132
|
+
}
|
|
41133
|
+
// Caminho finalmente (finally) - se existir
|
|
41134
|
+
if (declaracao.caminhoFinalmente && declaracao.caminhoFinalmente.length > 0) {
|
|
41135
|
+
this.anteriores = anterioresAposTente;
|
|
41136
|
+
const arestaFinalmente = new mermaid_1.ArestaFluxograma(declaracao, `Linha${declaracao.linha}Finalmente(finalmente)`);
|
|
41137
|
+
vertices = vertices.concat(this.logicaComumConexaoArestas(arestaFinalmente));
|
|
41138
|
+
this.anteriores.push(arestaFinalmente);
|
|
41139
|
+
const verticesFinalmente = [];
|
|
41140
|
+
for (const declaracaoFinalmente of declaracao.caminhoFinalmente) {
|
|
41141
|
+
const verticesDeclaracao = await declaracaoFinalmente.aceitar(this);
|
|
41142
|
+
verticesFinalmente.push(...verticesDeclaracao);
|
|
41143
|
+
}
|
|
41144
|
+
vertices = vertices.concat(verticesFinalmente);
|
|
41145
|
+
}
|
|
41146
|
+
else {
|
|
41147
|
+
// Se não há finalmente, os anteriores são os caminhos após tente
|
|
41148
|
+
this.anteriores = anterioresAposTente;
|
|
41149
|
+
}
|
|
41150
|
+
return Promise.resolve(vertices);
|
|
41081
41151
|
}
|
|
41082
41152
|
visitarDeclaracaoTextoDocumentacao(declaracao) {
|
|
41083
41153
|
throw new Error('Método não implementado.');
|
|
@@ -41120,11 +41190,15 @@ class TradutorMermaidJs {
|
|
|
41120
41190
|
async visitarExpressaoAgrupamento(expressao) {
|
|
41121
41191
|
return await expressao.expressao.aceitar(this);
|
|
41122
41192
|
}
|
|
41123
|
-
visitarExpressaoArgumentoReferenciaFuncao(expressao) {
|
|
41124
|
-
|
|
41193
|
+
async visitarExpressaoArgumentoReferenciaFuncao(expressao) {
|
|
41194
|
+
const nomeFuncao = expressao.simboloFuncao.lexema;
|
|
41195
|
+
return Promise.resolve(`referência à função ${nomeFuncao}`);
|
|
41125
41196
|
}
|
|
41126
|
-
visitarExpressaoAtribuicaoPorIndice(expressao) {
|
|
41127
|
-
|
|
41197
|
+
async visitarExpressaoAtribuicaoPorIndice(expressao) {
|
|
41198
|
+
const textoObjeto = await expressao.objeto.aceitar(this);
|
|
41199
|
+
const textoIndice = await expressao.indice.aceitar(this);
|
|
41200
|
+
const textoValor = await expressao.valor.aceitar(this);
|
|
41201
|
+
return Promise.resolve(`${textoObjeto} no índice ${textoIndice} recebe: ${textoValor}`);
|
|
41128
41202
|
}
|
|
41129
41203
|
visitarExpressaoAtribuicaoPorIndicesMatriz(expressao) {
|
|
41130
41204
|
throw new Error('Método não implementado.');
|
|
@@ -41135,8 +41209,26 @@ class TradutorMermaidJs {
|
|
|
41135
41209
|
switch (expressao.operador.tipo) {
|
|
41136
41210
|
case delegua_1.default.ADICAO:
|
|
41137
41211
|
return Promise.resolve(`somar ${operandoEsquerdo} e ${operandoDireito}`);
|
|
41212
|
+
case delegua_1.default.SUBTRACAO:
|
|
41213
|
+
return Promise.resolve(`subtrair ${operandoDireito} de ${operandoEsquerdo}`);
|
|
41214
|
+
case delegua_1.default.MULTIPLICACAO:
|
|
41215
|
+
return Promise.resolve(`multiplicar ${operandoEsquerdo} por ${operandoDireito}`);
|
|
41216
|
+
case delegua_1.default.DIVISAO:
|
|
41217
|
+
return Promise.resolve(`dividir ${operandoEsquerdo} por ${operandoDireito}`);
|
|
41218
|
+
case delegua_1.default.MODULO:
|
|
41219
|
+
return Promise.resolve(`resto de ${operandoEsquerdo} dividido por ${operandoDireito}`);
|
|
41138
41220
|
case delegua_1.default.MENOR:
|
|
41139
41221
|
return Promise.resolve(`${operandoEsquerdo} for menor que ${operandoDireito}`);
|
|
41222
|
+
case delegua_1.default.MENOR_IGUAL:
|
|
41223
|
+
return Promise.resolve(`${operandoEsquerdo} for menor ou igual a ${operandoDireito}`);
|
|
41224
|
+
case delegua_1.default.MAIOR:
|
|
41225
|
+
return Promise.resolve(`${operandoEsquerdo} for maior que ${operandoDireito}`);
|
|
41226
|
+
case delegua_1.default.MAIOR_IGUAL:
|
|
41227
|
+
return Promise.resolve(`${operandoEsquerdo} for maior ou igual a ${operandoDireito}`);
|
|
41228
|
+
case delegua_1.default.IGUAL_IGUAL:
|
|
41229
|
+
return Promise.resolve(`${operandoEsquerdo} for igual a ${operandoDireito}`);
|
|
41230
|
+
case delegua_1.default.DIFERENTE:
|
|
41231
|
+
return Promise.resolve(`${operandoEsquerdo} for diferente de ${operandoDireito}`);
|
|
41140
41232
|
}
|
|
41141
41233
|
return Promise.resolve('');
|
|
41142
41234
|
}
|
|
@@ -41151,8 +41243,12 @@ class TradutorMermaidJs {
|
|
|
41151
41243
|
async visitarExpressaoComentario(expressao) {
|
|
41152
41244
|
return Promise.resolve('');
|
|
41153
41245
|
}
|
|
41154
|
-
visitarExpressaoContinua(declaracao) {
|
|
41155
|
-
|
|
41246
|
+
async visitarExpressaoContinua(declaracao) {
|
|
41247
|
+
const texto = `Linha${declaracao.linha}(continua)`;
|
|
41248
|
+
const aresta = new mermaid_1.ArestaFluxograma(declaracao, texto);
|
|
41249
|
+
const vertices = this.logicaComumConexaoArestas(aresta);
|
|
41250
|
+
this.anteriores.push(aresta);
|
|
41251
|
+
return Promise.resolve(vertices);
|
|
41156
41252
|
}
|
|
41157
41253
|
async visitarExpressaoDeChamada(expressao) {
|
|
41158
41254
|
const textoEntidadeChamada = await expressao.entidadeChamada.aceitar(this);
|
|
@@ -41175,8 +41271,16 @@ class TradutorMermaidJs {
|
|
|
41175
41271
|
const textoValor = await expressao.valor.aceitar(this);
|
|
41176
41272
|
return Promise.resolve(`${expressao.nome.lexema} em ${textoObjeto} recebe ${textoValor}`);
|
|
41177
41273
|
}
|
|
41178
|
-
visitarExpressaoFuncaoConstruto(expressao) {
|
|
41179
|
-
|
|
41274
|
+
async visitarExpressaoFuncaoConstruto(expressao) {
|
|
41275
|
+
let texto = 'função anônima';
|
|
41276
|
+
if (expressao.parametros && expressao.parametros.length > 0) {
|
|
41277
|
+
const parametros = expressao.parametros.map(p => p.nome.lexema).join(', ');
|
|
41278
|
+
texto += `(${parametros})`;
|
|
41279
|
+
}
|
|
41280
|
+
else {
|
|
41281
|
+
texto += '()';
|
|
41282
|
+
}
|
|
41283
|
+
return Promise.resolve(texto);
|
|
41180
41284
|
}
|
|
41181
41285
|
async visitarExpressaoDeVariavel(expressao) {
|
|
41182
41286
|
return Promise.resolve(expressao.simbolo.lexema);
|
|
@@ -41194,17 +41298,41 @@ class TradutorMermaidJs {
|
|
|
41194
41298
|
}
|
|
41195
41299
|
return Promise.resolve(texto);
|
|
41196
41300
|
}
|
|
41197
|
-
visitarExpressaoExpressaoRegular(expressao) {
|
|
41198
|
-
|
|
41301
|
+
async visitarExpressaoExpressaoRegular(expressao) {
|
|
41302
|
+
// Representa a expressão regular como texto para o fluxograma
|
|
41303
|
+
const padraoRegex = expressao.valor ? String(expressao.valor) : expressao.simbolo.lexema;
|
|
41304
|
+
return Promise.resolve(`expressão regular: /${padraoRegex}/`);
|
|
41199
41305
|
}
|
|
41200
|
-
visitarExpressaoFalhar(expressao) {
|
|
41201
|
-
|
|
41306
|
+
async visitarExpressaoFalhar(expressao) {
|
|
41307
|
+
let texto = `Linha${expressao.linha}(falhar`;
|
|
41308
|
+
if (expressao.explicacao) {
|
|
41309
|
+
const textoExplicacao = await expressao.explicacao.aceitar(this);
|
|
41310
|
+
texto += `: ${textoExplicacao}`;
|
|
41311
|
+
}
|
|
41312
|
+
texto += ')';
|
|
41313
|
+
const aresta = new mermaid_1.ArestaFluxograma(expressao, texto);
|
|
41314
|
+
const vertices = this.logicaComumConexaoArestas(aresta);
|
|
41315
|
+
this.anteriores.push(aresta);
|
|
41316
|
+
return Promise.resolve(vertices);
|
|
41202
41317
|
}
|
|
41203
41318
|
visitarExpressaoFimPara(declaracao) {
|
|
41204
41319
|
throw new Error('Método não implementado.');
|
|
41205
41320
|
}
|
|
41206
|
-
visitarExpressaoFormatacaoEscrita(declaracao) {
|
|
41207
|
-
|
|
41321
|
+
async visitarExpressaoFormatacaoEscrita(declaracao) {
|
|
41322
|
+
const textoExpressao = await declaracao.expressao.aceitar(this);
|
|
41323
|
+
let formato = textoExpressao;
|
|
41324
|
+
// Adiciona informações de formatação se especificadas
|
|
41325
|
+
const partes = [textoExpressao];
|
|
41326
|
+
if (declaracao.espacos > 0) {
|
|
41327
|
+
partes.push(`${declaracao.espacos} espaços`);
|
|
41328
|
+
}
|
|
41329
|
+
if (declaracao.casasDecimais > 0) {
|
|
41330
|
+
partes.push(`${declaracao.casasDecimais} casas decimais`);
|
|
41331
|
+
}
|
|
41332
|
+
if (partes.length > 1) {
|
|
41333
|
+
formato = `${partes[0]} (${partes.slice(1).join(', ')})`;
|
|
41334
|
+
}
|
|
41335
|
+
return Promise.resolve(formato);
|
|
41208
41336
|
}
|
|
41209
41337
|
async visitarExpressaoIsto(expressao) {
|
|
41210
41338
|
return Promise.resolve('this');
|
|
@@ -41227,11 +41355,20 @@ class TradutorMermaidJs {
|
|
|
41227
41355
|
return Promise.resolve(String(expressao.valor));
|
|
41228
41356
|
}
|
|
41229
41357
|
}
|
|
41230
|
-
visitarExpressaoLogica(expressao) {
|
|
41231
|
-
|
|
41358
|
+
async visitarExpressaoLogica(expressao) {
|
|
41359
|
+
const operandoEsquerdo = await expressao.esquerda.aceitar(this);
|
|
41360
|
+
const operandoDireito = await expressao.direita.aceitar(this);
|
|
41361
|
+
switch (expressao.operador.tipo) {
|
|
41362
|
+
case delegua_1.default.E:
|
|
41363
|
+
return Promise.resolve(`${operandoEsquerdo} e ${operandoDireito}`);
|
|
41364
|
+
case delegua_1.default.OU:
|
|
41365
|
+
return Promise.resolve(`${operandoEsquerdo} ou ${operandoDireito}`);
|
|
41366
|
+
}
|
|
41367
|
+
return Promise.resolve('');
|
|
41232
41368
|
}
|
|
41233
|
-
visitarExpressaoReferenciaFuncao(expressao) {
|
|
41234
|
-
|
|
41369
|
+
async visitarExpressaoReferenciaFuncao(expressao) {
|
|
41370
|
+
const nomeFuncao = expressao.simboloFuncao.lexema;
|
|
41371
|
+
return Promise.resolve(`@${nomeFuncao}`);
|
|
41235
41372
|
}
|
|
41236
41373
|
async visitarExpressaoRetornar(expressao) {
|
|
41237
41374
|
let texto = `Linha${expressao.linha}(retorna`;
|
|
@@ -41247,17 +41384,31 @@ class TradutorMermaidJs {
|
|
|
41247
41384
|
async visitarExpressaoSeparador(expressao) {
|
|
41248
41385
|
return Promise.resolve(`${expressao.conteudo} `);
|
|
41249
41386
|
}
|
|
41250
|
-
visitarExpressaoSuper(expressao) {
|
|
41251
|
-
|
|
41387
|
+
async visitarExpressaoSuper(expressao) {
|
|
41388
|
+
return Promise.resolve('super');
|
|
41252
41389
|
}
|
|
41253
|
-
visitarExpressaoSustar(declaracao) {
|
|
41254
|
-
|
|
41390
|
+
async visitarExpressaoSustar(declaracao) {
|
|
41391
|
+
const texto = `Linha${declaracao.linha}(sustar)`;
|
|
41392
|
+
const aresta = new mermaid_1.ArestaFluxograma(declaracao, texto);
|
|
41393
|
+
const vertices = this.logicaComumConexaoArestas(aresta);
|
|
41394
|
+
this.anteriores.push(aresta);
|
|
41395
|
+
return Promise.resolve(vertices);
|
|
41255
41396
|
}
|
|
41256
|
-
visitarExpressaoTupla(expressao) {
|
|
41257
|
-
|
|
41397
|
+
async visitarExpressaoTupla(expressao) {
|
|
41398
|
+
// Tupla base pode ter um único valor
|
|
41399
|
+
if (expressao.valor !== undefined) {
|
|
41400
|
+
return Promise.resolve(`tupla(${expressao.valor})`);
|
|
41401
|
+
}
|
|
41402
|
+
// Se não houver valor, tupla vazia
|
|
41403
|
+
return Promise.resolve('tupla()');
|
|
41258
41404
|
}
|
|
41259
|
-
visitarExpressaoTuplaN(expressao) {
|
|
41260
|
-
|
|
41405
|
+
async visitarExpressaoTuplaN(expressao) {
|
|
41406
|
+
const valores = [];
|
|
41407
|
+
for (const elemento of expressao.elementos) {
|
|
41408
|
+
const valorTraduzido = await elemento.aceitar(this);
|
|
41409
|
+
valores.push(valorTraduzido);
|
|
41410
|
+
}
|
|
41411
|
+
return Promise.resolve(`tupla(${valores.join(', ')})`);
|
|
41261
41412
|
}
|
|
41262
41413
|
visitarExpressaoTipoDe(expressao) {
|
|
41263
41414
|
throw new Error('Método não implementado.');
|
|
@@ -41293,7 +41444,7 @@ class TradutorMermaidJs {
|
|
|
41293
41444
|
*/
|
|
41294
41445
|
async traduzirChamadaFuncao(declaracaoExpressao, chamada) {
|
|
41295
41446
|
// Verifica se é uma chamada a uma função conhecida
|
|
41296
|
-
if (chamada.entidadeChamada.constructor
|
|
41447
|
+
if (chamada.entidadeChamada.constructor === construtos_1.Variavel) {
|
|
41297
41448
|
const variavel = chamada.entidadeChamada;
|
|
41298
41449
|
const nomeFuncao = variavel.simbolo.lexema;
|
|
41299
41450
|
if (this.declaracoesFuncoes[nomeFuncao]) {
|
|
@@ -41420,7 +41571,7 @@ class TradutorMermaidJs {
|
|
|
41420
41571
|
}
|
|
41421
41572
|
exports.TradutorMermaidJs = TradutorMermaidJs;
|
|
41422
41573
|
|
|
41423
|
-
},{"../tipos-de-simbolos/delegua":212,"./mermaid":222}],236:[function(require,module,exports){
|
|
41574
|
+
},{"../construtos":62,"../tipos-de-simbolos/delegua":212,"./mermaid":222}],236:[function(require,module,exports){
|
|
41424
41575
|
"use strict";
|
|
41425
41576
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41426
41577
|
exports.TradutorPortugolIpt = void 0;
|