@designliquido/delegua 0.72.0 → 1.0.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.js +1 -1
- package/analisador-semantico/analisador-semantico.js.map +1 -1
- package/analisador-semantico/dialetos/analisador-semantico-pitugues.js +4 -4
- package/analisador-semantico/dialetos/analisador-semantico-pitugues.js.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico-base.d.ts +34 -34
- package/avaliador-sintatico/avaliador-sintatico-base.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico-base.js +35 -34
- package/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.d.ts +77 -73
- package/avaliador-sintatico/avaliador-sintatico.d.ts.map +1 -1
- package/avaliador-sintatico/avaliador-sintatico.js +266 -245
- package/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-calango.d.ts +14 -14
- package/avaliador-sintatico/dialetos/avaliador-sintatico-calango.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-calango.js +29 -28
- package/avaliador-sintatico/dialetos/avaliador-sintatico-calango.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js +3 -3
- package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.d.ts +13 -13
- package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.js +17 -17
- package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.d.ts +41 -40
- package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.js +208 -140
- package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.d.ts +13 -13
- package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.js +25 -25
- package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-prisma.d.ts +37 -38
- package/avaliador-sintatico/dialetos/avaliador-sintatico-prisma.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-prisma.js +105 -110
- package/avaliador-sintatico/dialetos/avaliador-sintatico-prisma.js.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.d.ts +35 -35
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.d.ts.map +1 -1
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.js +98 -101
- package/avaliador-sintatico/dialetos/avaliador-sintatico-tenda.js.map +1 -1
- package/avaliador-sintatico/traducao/avaliador-sintatico-javascript.d.ts +1 -1
- package/avaliador-sintatico/traducao/avaliador-sintatico-javascript.d.ts.map +1 -1
- package/avaliador-sintatico/traducao/avaliador-sintatico-javascript.js +3 -3
- package/avaliador-sintatico/traducao/avaliador-sintatico-javascript.js.map +1 -1
- package/bibliotecas/biblioteca-global.d.ts +3 -2
- package/bibliotecas/biblioteca-global.d.ts.map +1 -1
- package/bibliotecas/biblioteca-global.js +92 -151
- package/bibliotecas/biblioteca-global.js.map +1 -1
- package/bibliotecas/dialetos/pitugues/biblioteca-global.d.ts +3 -2
- package/bibliotecas/dialetos/pitugues/biblioteca-global.d.ts.map +1 -1
- package/bibliotecas/dialetos/pitugues/biblioteca-global.js +20 -25
- package/bibliotecas/dialetos/pitugues/biblioteca-global.js.map +1 -1
- package/bibliotecas/dialetos/pitugues/primitivas-tupla.d.ts +6 -0
- package/bibliotecas/dialetos/pitugues/primitivas-tupla.d.ts.map +1 -0
- package/bibliotecas/dialetos/pitugues/primitivas-tupla.js +23 -0
- package/bibliotecas/dialetos/pitugues/primitivas-tupla.js.map +1 -0
- package/bibliotecas/dialetos/pitugues/primitivas-vetor.d.ts.map +1 -1
- package/bibliotecas/dialetos/pitugues/primitivas-vetor.js +16 -0
- package/bibliotecas/dialetos/pitugues/primitivas-vetor.js.map +1 -1
- package/bibliotecas/primitivas-tupla.d.ts +6 -0
- package/bibliotecas/primitivas-tupla.d.ts.map +1 -0
- package/bibliotecas/primitivas-tupla.js +45 -0
- package/bibliotecas/primitivas-tupla.js.map +1 -0
- package/bibliotecas/primitivas-vetor.d.ts.map +1 -1
- package/bibliotecas/primitivas-vetor.js +38 -0
- package/bibliotecas/primitivas-vetor.js.map +1 -1
- package/bin/package.json +1 -1
- package/construtos/dicionario.d.ts +2 -1
- package/construtos/dicionario.d.ts.map +1 -1
- package/construtos/dicionario.js +2 -1
- package/construtos/dicionario.js.map +1 -1
- package/construtos/literal.d.ts +1 -1
- package/construtos/literal.d.ts.map +1 -1
- package/construtos/literal.js +4 -0
- package/construtos/literal.js.map +1 -1
- package/estilizador/regras/index.d.ts +1 -0
- package/estilizador/regras/index.d.ts.map +1 -1
- package/estilizador/regras/index.js +1 -0
- package/estilizador/regras/index.js.map +1 -1
- package/estilizador/regras/paradigma-consistente.d.ts +45 -0
- package/estilizador/regras/paradigma-consistente.d.ts.map +1 -0
- package/estilizador/regras/paradigma-consistente.js +89 -0
- package/estilizador/regras/paradigma-consistente.js.map +1 -0
- package/formatadores/formatador-delegua.d.ts.map +1 -1
- package/formatadores/formatador-delegua.js +10 -3
- package/formatadores/formatador-delegua.js.map +1 -1
- package/interfaces/avaliador-sintatico-interface.d.ts +1 -1
- package/interfaces/avaliador-sintatico-interface.d.ts.map +1 -1
- package/interpretador/dialetos/calango/index.d.ts +2 -0
- package/interpretador/dialetos/calango/index.d.ts.map +1 -0
- package/interpretador/dialetos/calango/index.js +18 -0
- package/interpretador/dialetos/calango/index.js.map +1 -0
- package/interpretador/dialetos/egua-classico/interpretador-egua-classico.d.ts +1 -1
- package/interpretador/dialetos/egua-classico/interpretador-egua-classico.js +1 -1
- package/interpretador/dialetos/egua-classico/interpretador-egua-classico.js.map +1 -1
- package/interpretador/dialetos/index.d.ts +2 -0
- package/interpretador/dialetos/index.d.ts.map +1 -1
- package/interpretador/dialetos/index.js +2 -0
- package/interpretador/dialetos/index.js.map +1 -1
- package/interpretador/dialetos/pitugues/comum.d.ts.map +1 -1
- package/interpretador/dialetos/pitugues/comum.js +19 -0
- package/interpretador/dialetos/pitugues/comum.js.map +1 -1
- package/interpretador/dialetos/pitugues/interpretador-pitugues.d.ts +2 -1
- package/interpretador/dialetos/pitugues/interpretador-pitugues.d.ts.map +1 -1
- package/interpretador/dialetos/pitugues/interpretador-pitugues.js +42 -1
- package/interpretador/dialetos/pitugues/interpretador-pitugues.js.map +1 -1
- package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.d.ts +1 -1
- package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.d.ts.map +1 -1
- package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.js +3 -4
- package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.js.map +1 -1
- package/interpretador/interpretador-base.d.ts.map +1 -1
- package/interpretador/interpretador-base.js +60 -15
- package/interpretador/interpretador-base.js.map +1 -1
- package/interpretador/interpretador.d.ts.map +1 -1
- package/interpretador/interpretador.js +53 -23
- package/interpretador/interpretador.js.map +1 -1
- package/lexador/dialetos/lexador-pitugues.d.ts.map +1 -1
- package/lexador/dialetos/lexador-pitugues.js +8 -0
- package/lexador/dialetos/lexador-pitugues.js.map +1 -1
- package/lexador/filtro-paradigma.d.ts +15 -0
- package/lexador/filtro-paradigma.d.ts.map +1 -0
- package/lexador/filtro-paradigma.js +51 -0
- package/lexador/filtro-paradigma.js.map +1 -0
- package/lexador/lexador.d.ts.map +1 -1
- package/lexador/lexador.js +4 -0
- package/lexador/lexador.js.map +1 -1
- package/lexador/mapeamento-paradigmas.d.ts +47 -0
- package/lexador/mapeamento-paradigmas.d.ts.map +1 -0
- package/lexador/mapeamento-paradigmas.js +183 -0
- package/lexador/mapeamento-paradigmas.js.map +1 -0
- 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/tipos-de-simbolos/pitugues.d.ts +2 -0
- package/tipos-de-simbolos/pitugues.d.ts.map +1 -1
- package/tipos-de-simbolos/pitugues.js +2 -0
- package/tipos-de-simbolos/pitugues.js.map +1 -1
- package/tradutores/tradutor-assembly-x64.js +122 -122
- package/tradutores/tradutor-assemblyscript.js +1 -1
- package/tradutores/tradutor-assemblyscript.js.map +1 -1
- package/tradutores/tradutor-calango.d.ts +4 -3
- package/tradutores/tradutor-calango.d.ts.map +1 -1
- package/tradutores/tradutor-calango.js +7 -14
- package/tradutores/tradutor-calango.js.map +1 -1
- package/tradutores/tradutor-javascript.d.ts.map +1 -1
- package/tradutores/tradutor-javascript.js +12 -5
- package/tradutores/tradutor-javascript.js.map +1 -1
- package/tradutores/tradutor-mermaidjs.js +1 -1
- package/tradutores/tradutor-mermaidjs.js.map +1 -1
- package/tradutores/tradutor-portugol-ipt.d.ts +1 -1
- package/tradutores/tradutor-portugol-ipt.d.ts.map +1 -1
- package/tradutores/tradutor-portugol-ipt.js +3 -3
- package/tradutores/tradutor-portugol-ipt.js.map +1 -1
- package/tradutores/tradutor-python.d.ts.map +1 -1
- package/tradutores/tradutor-python.js +12 -5
- package/tradutores/tradutor-python.js.map +1 -1
- package/tradutores/tradutor-reverso-tenda.js +1 -1
- package/tradutores/tradutor-reverso-tenda.js.map +1 -1
- package/umd/delegua.js +1827 -1584
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avaliador-sintatico-prisma.d.ts","sourceRoot":"","sources":["../../../fontes/avaliador-sintatico/dialetos/avaliador-sintatico-prisma.ts"],"names":[],"mappings":"AAEA,OAAO,EAOH,OAAO,EAEP,SAAS,EAET,eAAe,EAOf,IAAI,EAEJ,qBAAqB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACH,OAAO,EACP,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,GAAG,EACH,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,SAAS,EAET,MAAM,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAQlG,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKhD,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAWlF;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,sBAAsB;IAChE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAEhC,sBAAsB,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAC;IAC3D,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE;QAClB,CAAC,kBAAkB,EAAE,MAAM,GAAG;YAAE,CAAC,aAAa,EAAE,MAAM,GAAG,2BAA2B,CAAA;SAAE,CAAC;KAC1F,CAAC;IAEF,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEzB,WAAW,UAAQ;IAe/B,WAAW,IAAI,IAAI;IAqBnB,
|
|
1
|
+
{"version":3,"file":"avaliador-sintatico-prisma.d.ts","sourceRoot":"","sources":["../../../fontes/avaliador-sintatico/dialetos/avaliador-sintatico-prisma.ts"],"names":[],"mappings":"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"}
|
|
@@ -8,7 +8,6 @@ const browser_process_hrtime_1 = __importDefault(require("browser-process-hrtime
|
|
|
8
8
|
const construtos_1 = require("../../construtos");
|
|
9
9
|
const declaracoes_1 = require("../../declaracoes");
|
|
10
10
|
const avaliador_sintatico_base_1 = require("../avaliador-sintatico-base");
|
|
11
|
-
const erro_avaliador_sintatico_1 = require("../erro-avaliador-sintatico");
|
|
12
11
|
const inferenciador_1 = require("../../inferenciador");
|
|
13
12
|
const pilha_escopos_1 = require("../pilha-escopos");
|
|
14
13
|
const informacao_escopo_1 = require("../informacao-escopo");
|
|
@@ -59,11 +58,6 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
59
58
|
this.avancarEDevolverAnterior();
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
erro(simbolo, mensagemDeErro) {
|
|
63
|
-
const excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(simbolo, mensagemDeErro);
|
|
64
|
-
this.erros.push(excecao);
|
|
65
|
-
return excecao;
|
|
66
|
-
}
|
|
67
61
|
consumir(tipo, mensagemDeErro) {
|
|
68
62
|
if (this.verificarTipoSimboloAtual(tipo))
|
|
69
63
|
return this.avancarEDevolverAnterior();
|
|
@@ -97,7 +91,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
97
91
|
}
|
|
98
92
|
return false;
|
|
99
93
|
}
|
|
100
|
-
primario() {
|
|
94
|
+
async primario() {
|
|
101
95
|
const simboloAtual = this.simbolos[this.atual];
|
|
102
96
|
let valores = [];
|
|
103
97
|
switch (simboloAtual.tipo) {
|
|
@@ -124,7 +118,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
124
118
|
// Lógica para índice nomeado
|
|
125
119
|
// TODO: Terminar
|
|
126
120
|
}
|
|
127
|
-
const valor = this.ou();
|
|
121
|
+
const valor = await this.ou();
|
|
128
122
|
chaves.push(chave);
|
|
129
123
|
valores.push(valor);
|
|
130
124
|
indice++;
|
|
@@ -138,7 +132,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
138
132
|
case prisma_1.default.FUNCAO:
|
|
139
133
|
case prisma_1.default.FUNÇÃO:
|
|
140
134
|
const simboloFuncao = this.avancarEDevolverAnterior();
|
|
141
|
-
const corpoDaFuncao = this.corpoDaFuncao(simboloFuncao.lexema);
|
|
135
|
+
const corpoDaFuncao = await this.corpoDaFuncao(simboloFuncao.lexema);
|
|
142
136
|
this.pilhaEscopos.definirInformacoesVariavel(simboloFuncao.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(simboloFuncao.lexema, 'função'));
|
|
143
137
|
return corpoDaFuncao;
|
|
144
138
|
case prisma_1.default.IMPORTAR:
|
|
@@ -174,7 +168,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
174
168
|
return new construtos_1.Variavel(this.hashArquivo, simboloIdentificador, tipoOperando);
|
|
175
169
|
case prisma_1.default.PARENTESE_ESQUERDO:
|
|
176
170
|
this.avancarEDevolverAnterior();
|
|
177
|
-
const expressao = this.expressao();
|
|
171
|
+
const expressao = await this.expressao();
|
|
178
172
|
this.consumir(prisma_1.default.PARENTESE_DIREITO, "Esperado ')' após a expressão.");
|
|
179
173
|
return new construtos_1.Agrupamento(this.hashArquivo, simboloAtual.linha, expressao);
|
|
180
174
|
case prisma_1.default.SUPER:
|
|
@@ -205,43 +199,43 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
205
199
|
this.consumir(prisma_1.default.COLCHETE_DIREITO, "Esperado ']' após o texto multilinhas.");
|
|
206
200
|
return new construtos_1.Literal(this.hashArquivo, segundoColchete.linha, texto);
|
|
207
201
|
}
|
|
208
|
-
expressaoLeia() {
|
|
202
|
+
async expressaoLeia() {
|
|
209
203
|
const simboloLeia = this.avancarEDevolverAnterior();
|
|
210
204
|
this.consumir(prisma_1.default.PARENTESE_ESQUERDO, "Esperado '(' antes dos valores em leia.");
|
|
211
205
|
const argumentos = [];
|
|
212
206
|
if (!this.verificarTipoSimboloAtual(prisma_1.default.PARENTESE_DIREITO)) {
|
|
213
207
|
do {
|
|
214
|
-
argumentos.push(this.expressao());
|
|
208
|
+
argumentos.push(await this.expressao());
|
|
215
209
|
} while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.VIRGULA));
|
|
216
210
|
}
|
|
217
211
|
this.consumir(prisma_1.default.PARENTESE_DIREITO, "Esperado ')' após os valores em leia.");
|
|
218
212
|
return new construtos_1.Leia(simboloLeia, argumentos);
|
|
219
213
|
}
|
|
220
|
-
finalizarChamada(entidadeChamada) {
|
|
214
|
+
async finalizarChamada(entidadeChamada) {
|
|
221
215
|
const argumentos = [];
|
|
222
216
|
if (!this.verificarTipoSimboloAtual(prisma_1.default.PARENTESE_DIREITO)) {
|
|
223
217
|
do {
|
|
224
218
|
if (argumentos.length >= 255) {
|
|
225
219
|
throw this.erro(this.simbolos[this.atual], 'Não pode haver mais de 255 argumentos.');
|
|
226
220
|
}
|
|
227
|
-
argumentos.push(this.expressao());
|
|
221
|
+
argumentos.push(await this.expressao());
|
|
228
222
|
} while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.VIRGULA));
|
|
229
223
|
}
|
|
230
224
|
this.consumir(prisma_1.default.PARENTESE_DIREITO, "Esperado ')' após os argumentos.");
|
|
231
225
|
return new construtos_1.Chamada(this.hashArquivo, entidadeChamada, argumentos);
|
|
232
226
|
}
|
|
233
|
-
chamar() {
|
|
234
|
-
let expressao = this.primario();
|
|
227
|
+
async chamar() {
|
|
228
|
+
let expressao = await this.primario();
|
|
235
229
|
while (true) {
|
|
236
230
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.PARENTESE_ESQUERDO)) {
|
|
237
|
-
expressao = this.finalizarChamada(expressao);
|
|
231
|
+
expressao = await this.finalizarChamada(expressao);
|
|
238
232
|
}
|
|
239
233
|
else if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.PONTO)) {
|
|
240
234
|
const nome = this.consumir(prisma_1.default.IDENTIFICADOR, "Esperado nome do método após '.'.");
|
|
241
235
|
expressao = new construtos_1.AcessoMetodoOuPropriedade(this.hashArquivo, expressao, nome);
|
|
242
236
|
}
|
|
243
237
|
else if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.COLCHETE_ESQUERDO)) {
|
|
244
|
-
const indice = this.expressao();
|
|
238
|
+
const indice = await this.expressao();
|
|
245
239
|
const simboloFechamento = this.consumir(prisma_1.default.COLCHETE_DIREITO, "Esperado ']' após escrita do indice.");
|
|
246
240
|
expressao = new construtos_1.AcessoIndiceVariavel(this.hashArquivo, expressao, indice, simboloFechamento);
|
|
247
241
|
}
|
|
@@ -251,119 +245,119 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
251
245
|
}
|
|
252
246
|
return expressao;
|
|
253
247
|
}
|
|
254
|
-
unario() {
|
|
248
|
+
async unario() {
|
|
255
249
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.NEGACAO, prisma_1.default.SUBTRACAO, prisma_1.default.BIT_NOT)) {
|
|
256
250
|
const operador = this.simboloAnterior();
|
|
257
|
-
const direito = this.unario();
|
|
251
|
+
const direito = await this.unario();
|
|
258
252
|
return new construtos_1.Unario(this.hashArquivo, operador, direito);
|
|
259
253
|
}
|
|
260
|
-
return this.chamar();
|
|
254
|
+
return await this.chamar();
|
|
261
255
|
}
|
|
262
|
-
exponenciacao() {
|
|
263
|
-
let expressao = this.unario();
|
|
256
|
+
async exponenciacao() {
|
|
257
|
+
let expressao = await this.unario();
|
|
264
258
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.EXPONENCIACAO)) {
|
|
265
259
|
const operador = this.simboloAnterior();
|
|
266
|
-
const direito = this.unario();
|
|
260
|
+
const direito = await this.unario();
|
|
267
261
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
268
262
|
}
|
|
269
263
|
return expressao;
|
|
270
264
|
}
|
|
271
|
-
multiplicar() {
|
|
272
|
-
let expressao = this.exponenciacao();
|
|
265
|
+
async multiplicar() {
|
|
266
|
+
let expressao = await this.exponenciacao();
|
|
273
267
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.DIVISAO, prisma_1.default.DIVISAO_INTEIRA, prisma_1.default.MULTIPLICACAO, prisma_1.default.MODULO)) {
|
|
274
268
|
const operador = this.simboloAnterior();
|
|
275
|
-
const direito = this.exponenciacao();
|
|
269
|
+
const direito = await this.exponenciacao();
|
|
276
270
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
277
271
|
}
|
|
278
272
|
return expressao;
|
|
279
273
|
}
|
|
280
|
-
adicaoOuSubtracao() {
|
|
281
|
-
let expressao = this.multiplicar();
|
|
274
|
+
async adicaoOuSubtracao() {
|
|
275
|
+
let expressao = await this.multiplicar();
|
|
282
276
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.SUBTRACAO, prisma_1.default.ADICAO)) {
|
|
283
277
|
const operador = this.simboloAnterior();
|
|
284
|
-
const direito = this.multiplicar();
|
|
278
|
+
const direito = await this.multiplicar();
|
|
285
279
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
286
280
|
}
|
|
287
281
|
return expressao;
|
|
288
282
|
}
|
|
289
|
-
bitShift() {
|
|
290
|
-
let expressao = this.adicaoOuSubtracao();
|
|
283
|
+
async bitShift() {
|
|
284
|
+
let expressao = await this.adicaoOuSubtracao();
|
|
291
285
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.MENOR_MENOR, prisma_1.default.MAIOR_MAIOR)) {
|
|
292
286
|
const operador = this.simboloAnterior();
|
|
293
|
-
const direito = this.adicaoOuSubtracao();
|
|
287
|
+
const direito = await this.adicaoOuSubtracao();
|
|
294
288
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
295
289
|
}
|
|
296
290
|
return expressao;
|
|
297
291
|
}
|
|
298
|
-
bitE() {
|
|
299
|
-
let expressao = this.bitShift();
|
|
292
|
+
async bitE() {
|
|
293
|
+
let expressao = await this.bitShift();
|
|
300
294
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.BIT_AND)) {
|
|
301
295
|
const operador = this.simboloAnterior();
|
|
302
|
-
const direito = this.bitShift();
|
|
296
|
+
const direito = await this.bitShift();
|
|
303
297
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
304
298
|
}
|
|
305
299
|
return expressao;
|
|
306
300
|
}
|
|
307
|
-
bitOu() {
|
|
308
|
-
let expressao = this.bitE();
|
|
301
|
+
async bitOu() {
|
|
302
|
+
let expressao = await this.bitE();
|
|
309
303
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.BIT_OR, prisma_1.default.BIT_XOR)) {
|
|
310
304
|
const operador = this.simboloAnterior();
|
|
311
|
-
const direito = this.bitE();
|
|
305
|
+
const direito = await this.bitE();
|
|
312
306
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
313
307
|
}
|
|
314
308
|
return expressao;
|
|
315
309
|
}
|
|
316
|
-
comparar() {
|
|
317
|
-
let expressao = this.bitOu();
|
|
310
|
+
async comparar() {
|
|
311
|
+
let expressao = await this.bitOu();
|
|
318
312
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.MAIOR, prisma_1.default.MAIOR_IGUAL, prisma_1.default.MENOR, prisma_1.default.MENOR_IGUAL)) {
|
|
319
313
|
const operador = this.simboloAnterior();
|
|
320
|
-
const direito = this.bitOu();
|
|
314
|
+
const direito = await this.bitOu();
|
|
321
315
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
322
316
|
}
|
|
323
317
|
return expressao;
|
|
324
318
|
}
|
|
325
|
-
comparacaoIgualdade() {
|
|
326
|
-
let expressao = this.comparar();
|
|
319
|
+
async comparacaoIgualdade() {
|
|
320
|
+
let expressao = await this.comparar();
|
|
327
321
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.DIFERENTE, prisma_1.default.IGUAL_IGUAL)) {
|
|
328
322
|
const operador = this.simboloAnterior();
|
|
329
|
-
const direito = this.comparar();
|
|
323
|
+
const direito = await this.comparar();
|
|
330
324
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
331
325
|
}
|
|
332
326
|
return expressao;
|
|
333
327
|
}
|
|
334
|
-
em() {
|
|
335
|
-
let expressao = this.comparacaoIgualdade();
|
|
328
|
+
async em() {
|
|
329
|
+
let expressao = await this.comparacaoIgualdade();
|
|
336
330
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.EM)) {
|
|
337
331
|
const operador = this.simboloAnterior();
|
|
338
|
-
const direito = this.comparacaoIgualdade();
|
|
332
|
+
const direito = await this.comparacaoIgualdade();
|
|
339
333
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
340
334
|
}
|
|
341
335
|
return expressao;
|
|
342
336
|
}
|
|
343
|
-
e() {
|
|
344
|
-
let expressao = this.em();
|
|
337
|
+
async e() {
|
|
338
|
+
let expressao = await this.em();
|
|
345
339
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.E)) {
|
|
346
340
|
const operador = this.simboloAnterior();
|
|
347
|
-
const direito = this.em();
|
|
341
|
+
const direito = await this.em();
|
|
348
342
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
349
343
|
}
|
|
350
344
|
return expressao;
|
|
351
345
|
}
|
|
352
|
-
ou() {
|
|
353
|
-
let expressao = this.e();
|
|
346
|
+
async ou() {
|
|
347
|
+
let expressao = await this.e();
|
|
354
348
|
while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.OU)) {
|
|
355
349
|
const operador = this.simboloAnterior();
|
|
356
|
-
const direito = this.e();
|
|
350
|
+
const direito = await this.e();
|
|
357
351
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
358
352
|
}
|
|
359
353
|
return expressao;
|
|
360
354
|
}
|
|
361
|
-
atribuir() {
|
|
362
|
-
const expressao = this.ou();
|
|
355
|
+
async atribuir() {
|
|
356
|
+
const expressao = await this.ou();
|
|
363
357
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.IGUAL) ||
|
|
364
358
|
this.verificarSeSimboloAtualEIgualA(prisma_1.default.MAIS_IGUAL)) {
|
|
365
359
|
const igual = this.simboloAnterior();
|
|
366
|
-
const valor = this.atribuir();
|
|
360
|
+
const valor = await this.atribuir();
|
|
367
361
|
if (expressao instanceof construtos_1.Variavel) {
|
|
368
362
|
return new construtos_1.Atribuir(this.hashArquivo, expressao, valor);
|
|
369
363
|
}
|
|
@@ -377,31 +371,31 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
377
371
|
}
|
|
378
372
|
return expressao;
|
|
379
373
|
}
|
|
380
|
-
expressao() {
|
|
381
|
-
return this.atribuir();
|
|
374
|
+
async expressao() {
|
|
375
|
+
return await this.atribuir();
|
|
382
376
|
}
|
|
383
|
-
declaracaoEscreva() {
|
|
377
|
+
async declaracaoEscreva() {
|
|
384
378
|
const simboloEscreva = this.simboloAnterior();
|
|
385
379
|
this.consumir(prisma_1.default.PARENTESE_ESQUERDO, "Esperado '(' antes dos valores em imprima.");
|
|
386
380
|
const argumentos = [];
|
|
387
381
|
if (!this.verificarTipoSimboloAtual(prisma_1.default.PARENTESE_DIREITO)) {
|
|
388
382
|
do {
|
|
389
|
-
argumentos.push(this.expressao());
|
|
383
|
+
argumentos.push(await this.expressao());
|
|
390
384
|
} while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.VIRGULA));
|
|
391
385
|
}
|
|
392
386
|
this.consumir(prisma_1.default.PARENTESE_DIREITO, "Esperado ')' após os valores em imprima.");
|
|
393
387
|
this.verificarSeSimboloAtualEIgualA(prisma_1.default.PONTO_E_VIRGULA);
|
|
394
388
|
return new declaracoes_1.Escreva(Number(simboloEscreva.linha), simboloEscreva.hashArquivo, argumentos);
|
|
395
389
|
}
|
|
396
|
-
declaracaoExpressao() {
|
|
397
|
-
const expressao = this.expressao();
|
|
390
|
+
async declaracaoExpressao() {
|
|
391
|
+
const expressao = await this.expressao();
|
|
398
392
|
return new declaracoes_1.Expressao(expressao);
|
|
399
393
|
}
|
|
400
|
-
blocoEscopo() {
|
|
394
|
+
async blocoEscopo() {
|
|
401
395
|
this.pilhaEscopos.empilhar(new informacao_escopo_1.InformacaoEscopo());
|
|
402
396
|
let declaracoes = [];
|
|
403
397
|
while (!this.verificarTipoSimboloAtual(prisma_1.default.FIM) && !this.estaNoFinal()) {
|
|
404
|
-
const retornoDeclaracao = this.resolverDeclaracaoForaDeBloco();
|
|
398
|
+
const retornoDeclaracao = await this.resolverDeclaracaoForaDeBloco();
|
|
405
399
|
if (Array.isArray(retornoDeclaracao)) {
|
|
406
400
|
declaracoes = declaracoes.concat(retornoDeclaracao);
|
|
407
401
|
}
|
|
@@ -413,11 +407,11 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
413
407
|
this.pilhaEscopos.removerUltimo();
|
|
414
408
|
return declaracoes;
|
|
415
409
|
}
|
|
416
|
-
declaracaoDeLocal() {
|
|
410
|
+
async declaracaoDeLocal() {
|
|
417
411
|
const identificador = this.consumir(prisma_1.default.IDENTIFICADOR, 'Esperado nome de variável.');
|
|
418
412
|
let inicializador = null;
|
|
419
413
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.IGUAL)) {
|
|
420
|
-
inicializador = this.expressao();
|
|
414
|
+
inicializador = await this.expressao();
|
|
421
415
|
}
|
|
422
416
|
this.consumir(prisma_1.default.PONTO_E_VIRGULA, "Esperado ';' após declaração de variável.");
|
|
423
417
|
// Para Prisma, mantemos a tipagem inferida de forma simples por enquanto.
|
|
@@ -425,24 +419,24 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
425
419
|
this.pilhaEscopos.definirInformacoesVariavel(identificador.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(identificador.lexema, tipo));
|
|
426
420
|
return new declaracoes_1.Var(identificador, inicializador, tipo);
|
|
427
421
|
}
|
|
428
|
-
declaracaoEnquanto() {
|
|
422
|
+
async declaracaoEnquanto() {
|
|
429
423
|
try {
|
|
430
424
|
this.blocos += 1;
|
|
431
|
-
const condicao = this.expressao();
|
|
432
|
-
const bloco = this.resolverDeclaracao();
|
|
425
|
+
const condicao = await this.expressao();
|
|
426
|
+
const bloco = await this.resolverDeclaracao();
|
|
433
427
|
return new declaracoes_1.Enquanto(condicao, bloco);
|
|
434
428
|
}
|
|
435
429
|
finally {
|
|
436
430
|
this.blocos -= 1;
|
|
437
431
|
}
|
|
438
432
|
}
|
|
439
|
-
declaracaoSe() {
|
|
433
|
+
async declaracaoSe() {
|
|
440
434
|
const simboloSe = this.simbolos[this.atual];
|
|
441
|
-
const condicao = this.expressao();
|
|
435
|
+
const condicao = await this.expressao();
|
|
442
436
|
this.consumir(prisma_1.default.ENTAO, "Esperado palavra reservada 'entao' ou 'então' após condição em declaração 'se'.");
|
|
443
437
|
const declaracoes = [];
|
|
444
438
|
do {
|
|
445
|
-
declaracoes.push(this.resolverDeclaracaoForaDeBloco());
|
|
439
|
+
declaracoes.push(await this.resolverDeclaracaoForaDeBloco());
|
|
446
440
|
} while (!this.estaNoFinal() &&
|
|
447
441
|
![prisma_1.default.SENAO, prisma_1.default.SENÃO, prisma_1.default.FIM].includes(this.simbolos[this.atual].tipo));
|
|
448
442
|
let caminhoSenao = null;
|
|
@@ -450,14 +444,14 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
450
444
|
const simboloSenao = this.simbolos[this.atual - 1];
|
|
451
445
|
const declaracoesSenao = [];
|
|
452
446
|
do {
|
|
453
|
-
declaracoesSenao.push(this.resolverDeclaracaoForaDeBloco());
|
|
447
|
+
declaracoesSenao.push(await this.resolverDeclaracaoForaDeBloco());
|
|
454
448
|
} while (![prisma_1.default.FIM].includes(this.simbolos[this.atual].tipo));
|
|
455
449
|
caminhoSenao = new declaracoes_1.Bloco(this.hashArquivo, Number(simboloSenao.linha), declaracoesSenao.filter((d) => d));
|
|
456
450
|
}
|
|
457
451
|
this.consumir(prisma_1.default.FIM, "Esperado palavra-chave 'fimse' para fechamento de declaração 'se'.");
|
|
458
452
|
return new declaracoes_1.Se(condicao, new declaracoes_1.Bloco(this.hashArquivo, Number(simboloSe.linha), declaracoes.filter((d) => d)), [], caminhoSenao);
|
|
459
453
|
}
|
|
460
|
-
declaracaoQuebre() {
|
|
454
|
+
async declaracaoQuebre() {
|
|
461
455
|
if (this.blocos < 1) {
|
|
462
456
|
throw this.erro(this.simboloAnterior(), "'quebre' deve estar dentro de um laço de repetição.");
|
|
463
457
|
}
|
|
@@ -471,37 +465,37 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
471
465
|
this.consumir(prisma_1.default.PONTO_E_VIRGULA, "Esperado ';' após 'continua'.");
|
|
472
466
|
return new declaracoes_1.Continua(this.simbolos[this.atual]);
|
|
473
467
|
}
|
|
474
|
-
declaracaoRetorna() {
|
|
468
|
+
async declaracaoRetorna() {
|
|
475
469
|
const palavraChave = this.simboloAnterior();
|
|
476
470
|
let valor = null;
|
|
477
471
|
if (!this.verificarTipoSimboloAtual(prisma_1.default.PONTO_E_VIRGULA)) {
|
|
478
|
-
valor = this.expressao();
|
|
472
|
+
valor = await this.expressao();
|
|
479
473
|
}
|
|
480
474
|
this.consumir(prisma_1.default.PONTO_E_VIRGULA, "Esperado ';' após valor de retorno.");
|
|
481
475
|
return new declaracoes_1.Retorna(palavraChave, valor);
|
|
482
476
|
}
|
|
483
|
-
declaracaoImportar() {
|
|
477
|
+
async declaracaoImportar() {
|
|
484
478
|
this.avancarEDevolverAnterior();
|
|
485
479
|
this.consumir(prisma_1.default.PARENTESE_ESQUERDO, "Esperado '(' após declaração.");
|
|
486
|
-
const caminho = this.expressao();
|
|
480
|
+
const caminho = await this.expressao();
|
|
487
481
|
this.consumir(prisma_1.default.PARENTESE_DIREITO, "Esperado ')' após declaração.");
|
|
488
482
|
return new declaracoes_1.Importar(caminho);
|
|
489
483
|
}
|
|
490
|
-
corpoDaFuncao(tipo) {
|
|
484
|
+
async corpoDaFuncao(tipo) {
|
|
491
485
|
const parenteseEsquerdo = this.consumir(prisma_1.default.PARENTESE_ESQUERDO, `Esperado '(' após o nome ${tipo}.`);
|
|
492
486
|
let parametros = [];
|
|
493
487
|
if (!this.verificarTipoSimboloAtual(prisma_1.default.PARENTESE_DIREITO)) {
|
|
494
|
-
parametros = this.logicaComumParametros();
|
|
488
|
+
parametros = await this.logicaComumParametros();
|
|
495
489
|
}
|
|
496
490
|
this.consumir(prisma_1.default.PARENTESE_DIREITO, "Esperado ')' após parâmetros.");
|
|
497
491
|
let tipoRetorno = 'qualquer';
|
|
498
492
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.SETA)) {
|
|
499
493
|
tipoRetorno = 'qualquer'; // Simplificado por enquanto
|
|
500
494
|
}
|
|
501
|
-
const corpo = this.blocoEscopo();
|
|
495
|
+
const corpo = await this.blocoEscopo();
|
|
502
496
|
return new construtos_1.FuncaoConstruto(this.hashArquivo, 0, parametros, corpo, tipoRetorno, false);
|
|
503
497
|
}
|
|
504
|
-
logicaComumParametros() {
|
|
498
|
+
async logicaComumParametros() {
|
|
505
499
|
const parametros = [];
|
|
506
500
|
do {
|
|
507
501
|
if (parametros.length >= 255) {
|
|
@@ -511,24 +505,24 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
511
505
|
parametro.abrangencia = 'padrao';
|
|
512
506
|
parametro.nome = this.consumir(prisma_1.default.IDENTIFICADOR, 'Esperado nome do parâmetro.');
|
|
513
507
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.IGUAL)) {
|
|
514
|
-
parametro.valorPadrao = this.primario();
|
|
508
|
+
parametro.valorPadrao = await this.primario();
|
|
515
509
|
}
|
|
516
510
|
this.pilhaEscopos.definirInformacoesVariavel(parametro.nome.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(parametro.nome.lexema, parametro.tipoDado || 'qualquer'));
|
|
517
511
|
parametros.push(parametro);
|
|
518
512
|
} while (this.verificarSeSimboloAtualEIgualA(prisma_1.default.VIRGULA));
|
|
519
513
|
return parametros;
|
|
520
514
|
}
|
|
521
|
-
funcao(tipo) {
|
|
515
|
+
async funcao(tipo) {
|
|
522
516
|
const simbolo = this.consumir(prisma_1.default.IDENTIFICADOR, `Esperado nome ${tipo}.`);
|
|
523
517
|
this.pilhaEscopos.definirInformacoesVariavel(simbolo.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(simbolo.lexema, 'qualquer'));
|
|
524
|
-
const corpoDaFuncao = this.corpoDaFuncao(tipo);
|
|
518
|
+
const corpoDaFuncao = await this.corpoDaFuncao(tipo);
|
|
525
519
|
const tipoDaFuncao = `função<${corpoDaFuncao.tipo}>`;
|
|
526
520
|
this.pilhaEscopos.definirInformacoesVariavel(simbolo.lexema, new informacao_elemento_sintatico_1.InformacaoElementoSintatico(simbolo.lexema, tipoDaFuncao));
|
|
527
521
|
const funcaoDeclaracao = new declaracoes_1.FuncaoDeclaracao(simbolo, corpoDaFuncao, tipoDaFuncao);
|
|
528
522
|
this.pilhaEscopos.registrarReferenciaFuncao(simbolo.lexema, funcaoDeclaracao);
|
|
529
523
|
return funcaoDeclaracao;
|
|
530
524
|
}
|
|
531
|
-
resolverDeclaracao() {
|
|
525
|
+
async resolverDeclaracao() {
|
|
532
526
|
const simboloAtual = this.simbolos[this.atual];
|
|
533
527
|
switch (simboloAtual.tipo) {
|
|
534
528
|
case prisma_1.default.CONTINUA:
|
|
@@ -541,44 +535,44 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
541
535
|
case prisma_1.default.ENTAO:
|
|
542
536
|
case prisma_1.default.INICIO:
|
|
543
537
|
const simboloInicioBloco = this.avancarEDevolverAnterior();
|
|
544
|
-
return new declaracoes_1.Bloco(simboloInicioBloco.hashArquivo, Number(simboloInicioBloco.linha), this.blocoEscopo());
|
|
538
|
+
return new declaracoes_1.Bloco(simboloInicioBloco.hashArquivo, Number(simboloInicioBloco.linha), await this.blocoEscopo());
|
|
545
539
|
case prisma_1.default.ENQUANTO:
|
|
546
540
|
this.avancarEDevolverAnterior();
|
|
547
|
-
return this.declaracaoEnquanto();
|
|
541
|
+
return await this.declaracaoEnquanto();
|
|
548
542
|
case prisma_1.default.IDENTIFICADOR:
|
|
549
543
|
const proximoSimbolo = this.simbolos[this.atual + 1];
|
|
550
544
|
if (proximoSimbolo && proximoSimbolo.tipo === prisma_1.default.IGUAL) {
|
|
551
|
-
return this.declaracaoOuAtribuicaoVariaveis();
|
|
545
|
+
return await this.declaracaoOuAtribuicaoVariaveis();
|
|
552
546
|
}
|
|
553
547
|
// Avaliar como expressão normal, sair do `switch`.
|
|
554
548
|
break;
|
|
555
549
|
case prisma_1.default.IMPRIMA:
|
|
556
550
|
this.avancarEDevolverAnterior();
|
|
557
|
-
return this.declaracaoEscreva();
|
|
551
|
+
return await this.declaracaoEscreva();
|
|
558
552
|
case prisma_1.default.PARA:
|
|
559
|
-
return this.declaracaoPara();
|
|
553
|
+
return await this.declaracaoPara();
|
|
560
554
|
case prisma_1.default.QUEBRE:
|
|
561
555
|
this.avancarEDevolverAnterior();
|
|
562
556
|
return this.declaracaoQuebre();
|
|
563
557
|
case prisma_1.default.SE:
|
|
564
558
|
this.avancarEDevolverAnterior();
|
|
565
|
-
return this.declaracaoSe();
|
|
559
|
+
return await this.declaracaoSe();
|
|
566
560
|
case prisma_1.default.RETORNE:
|
|
567
561
|
this.avancarEDevolverAnterior();
|
|
568
|
-
return this.declaracaoRetorna();
|
|
562
|
+
return await this.declaracaoRetorna();
|
|
569
563
|
case prisma_1.default.LOCAL:
|
|
570
564
|
this.avancarEDevolverAnterior();
|
|
571
|
-
return this.declaracaoDeLocal();
|
|
565
|
+
return await this.declaracaoDeLocal();
|
|
572
566
|
}
|
|
573
|
-
return this.declaracaoExpressao();
|
|
567
|
+
return await this.declaracaoExpressao();
|
|
574
568
|
}
|
|
575
|
-
declaracaoOuAtribuicaoVariaveis() {
|
|
569
|
+
async declaracaoOuAtribuicaoVariaveis() {
|
|
576
570
|
const identificador = this.avancarEDevolverAnterior();
|
|
577
571
|
this.consumir(prisma_1.default.IGUAL, "Esperado '=' após identificador.");
|
|
578
572
|
if (this.estaNoFinal()) {
|
|
579
573
|
throw this.erro(this.simboloAnterior(), 'Esperado valor após o símbolo de igual.');
|
|
580
574
|
}
|
|
581
|
-
const valor = this.expressao();
|
|
575
|
+
const valor = await this.expressao();
|
|
582
576
|
const tipo = this.logicaComumInferenciaTiposVariaveisEConstantes(valor, 'qualquer');
|
|
583
577
|
if (this.pilhaEscopos.variavelJaDefinida(identificador.lexema)) {
|
|
584
578
|
return new declaracoes_1.Expressao(new construtos_1.Atribuir(identificador.hashArquivo, new construtos_1.Variavel(identificador.hashArquivo, identificador), valor));
|
|
@@ -608,15 +602,15 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
608
602
|
console.log(inicializador.constructor.name);
|
|
609
603
|
}
|
|
610
604
|
}
|
|
611
|
-
declaracaoPara() {
|
|
605
|
+
async declaracaoPara() {
|
|
612
606
|
try {
|
|
613
607
|
this.blocos += 1;
|
|
614
608
|
const simboloPara = this.avancarEDevolverAnterior();
|
|
615
609
|
const variavelIteracao = this.consumir(prisma_1.default.IDENTIFICADOR, "Esperado identificador de variável após 'para'.");
|
|
616
610
|
this.consumir(prisma_1.default.IGUAL, `'=' or 'em' esperado próximo a '${this.simbolos[this.atual].lexema}'.`);
|
|
617
|
-
const literalOuVariavelInicio = this.adicaoOuSubtracao();
|
|
611
|
+
const literalOuVariavelInicio = await this.adicaoOuSubtracao();
|
|
618
612
|
this.consumir(prisma_1.default.VIRGULA, `Espera-se '=' próximo a '${this.simbolos[this.atual].lexema}'.`);
|
|
619
|
-
const literalOuVariavelFim = this.adicaoOuSubtracao();
|
|
613
|
+
const literalOuVariavelFim = await this.adicaoOuSubtracao();
|
|
620
614
|
let operadorCondicao = new lexador_1.Simbolo(prisma_1.default.MENOR_IGUAL, '<=', null, Number(simboloPara.linha), this.hashArquivo);
|
|
621
615
|
let operadorCondicaoIncremento = new lexador_1.Simbolo(prisma_1.default.MENOR, '<', null, Number(simboloPara.linha), this.hashArquivo);
|
|
622
616
|
let passo = new construtos_1.Literal(this.hashArquivo, Number(simboloPara.linha), 1);
|
|
@@ -627,7 +621,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
627
621
|
const declaracoesBlocoPara = [];
|
|
628
622
|
let simboloAtualBlocoPara = this.simbolos[this.atual];
|
|
629
623
|
while (simboloAtualBlocoPara.tipo !== prisma_1.default.FIM) {
|
|
630
|
-
declaracoesBlocoPara.push(this.resolverDeclaracaoForaDeBloco());
|
|
624
|
+
declaracoesBlocoPara.push(await this.resolverDeclaracaoForaDeBloco());
|
|
631
625
|
simboloAtualBlocoPara = this.simbolos[this.atual];
|
|
632
626
|
}
|
|
633
627
|
this.avancarEDevolverAnterior(); // fim
|
|
@@ -647,24 +641,25 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
647
641
|
this.blocos -= 1;
|
|
648
642
|
}
|
|
649
643
|
}
|
|
650
|
-
resolverDeclaracaoForaDeBloco() {
|
|
644
|
+
async resolverDeclaracaoForaDeBloco() {
|
|
651
645
|
try {
|
|
652
646
|
if ((this.verificarTipoSimboloAtual(prisma_1.default.FUNCAO) ||
|
|
653
647
|
this.verificarTipoSimboloAtual(prisma_1.default.FUNÇÃO)) &&
|
|
654
648
|
this.verificarTipoProximoSimbolo(prisma_1.default.IDENTIFICADOR)) {
|
|
655
649
|
this.avancarEDevolverAnterior();
|
|
656
|
-
return this.funcao('funcao');
|
|
650
|
+
return await this.funcao('funcao');
|
|
657
651
|
}
|
|
658
652
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.CLASSE))
|
|
659
|
-
return this.declaracaoDeClasse();
|
|
660
|
-
return this.resolverDeclaracao();
|
|
653
|
+
return await this.declaracaoDeClasse();
|
|
654
|
+
return await this.resolverDeclaracao();
|
|
661
655
|
}
|
|
662
656
|
catch (erro) {
|
|
663
657
|
this.sincronizar();
|
|
658
|
+
this.erros.push(erro);
|
|
664
659
|
return null;
|
|
665
660
|
}
|
|
666
661
|
}
|
|
667
|
-
declaracaoDeClasse() {
|
|
662
|
+
async declaracaoDeClasse() {
|
|
668
663
|
const simbolo = this.consumir(prisma_1.default.IDENTIFICADOR, 'Esperado nome da classe.');
|
|
669
664
|
let superClasse = null;
|
|
670
665
|
if (this.verificarSeSimboloAtualEIgualA(prisma_1.default.PARENTESE_ESQUERDO)) {
|
|
@@ -680,7 +675,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
680
675
|
this.verificarTipoSimboloAtual(prisma_1.default.FUNCAO) ||
|
|
681
676
|
this.verificarTipoSimboloAtual(prisma_1.default.FUNÇÃO))) {
|
|
682
677
|
const ehConstrutor = this.verificarSeSimboloAtualEIgualA(prisma_1.default.CONSTRUTOR);
|
|
683
|
-
metodos.push(this.funcao('método'));
|
|
678
|
+
metodos.push(await this.funcao('método'));
|
|
684
679
|
}
|
|
685
680
|
this.consumir(prisma_1.default.CHAVE_DIREITA, "Esperado '}' após métodos da classe.");
|
|
686
681
|
this.superclasseAtual = undefined;
|
|
@@ -721,7 +716,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
721
716
|
])
|
|
722
717
|
); */
|
|
723
718
|
}
|
|
724
|
-
analisar(retornoLexador, hashArquivo) {
|
|
719
|
+
async analisar(retornoLexador, hashArquivo) {
|
|
725
720
|
const inicioAnalise = (0, browser_process_hrtime_1.default)();
|
|
726
721
|
this.erros = [];
|
|
727
722
|
this.atual = 0;
|
|
@@ -732,7 +727,7 @@ class AvaliadorSintaticoPrisma extends avaliador_sintatico_base_1.AvaliadorSinta
|
|
|
732
727
|
this.simbolos = (retornoLexador === null || retornoLexador === void 0 ? void 0 : retornoLexador.simbolos) || [];
|
|
733
728
|
let declaracoes = [];
|
|
734
729
|
while (!this.estaNoFinal()) {
|
|
735
|
-
const retornoDeclaracao = this.resolverDeclaracaoForaDeBloco();
|
|
730
|
+
const retornoDeclaracao = await this.resolverDeclaracaoForaDeBloco();
|
|
736
731
|
if (Array.isArray(retornoDeclaracao)) {
|
|
737
732
|
declaracoes = declaracoes.concat(retornoDeclaracao);
|
|
738
733
|
}
|