@designliquido/delegua 0.7.6 → 0.8.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 +78 -65
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.d.ts +63 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js +180 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico.d.ts +5 -4
- package/fontes/avaliador-sintatico/avaliador-sintatico.js +189 -188
- package/fontes/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts +34 -32
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js +154 -148
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.d.ts +13 -12
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js +144 -142
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.d.ts +48 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js +297 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js.map +1 -0
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.d.ts +1 -1
- package/fontes/avaliador-sintatico/retornos/index.d.ts +3 -0
- package/fontes/avaliador-sintatico/retornos/index.js +20 -0
- package/fontes/avaliador-sintatico/retornos/index.js.map +1 -0
- package/fontes/avaliador-sintatico/retornos/retorno-declaracao.d.ts +3 -0
- package/fontes/avaliador-sintatico/retornos/retorno-declaracao.js +3 -0
- package/fontes/avaliador-sintatico/retornos/retorno-declaracao.js.map +1 -0
- package/fontes/avaliador-sintatico/retornos/retorno-primario.d.ts +3 -0
- package/fontes/avaliador-sintatico/retornos/retorno-primario.js +3 -0
- package/fontes/avaliador-sintatico/retornos/retorno-primario.js.map +1 -0
- package/fontes/avaliador-sintatico/retornos/retorno-resolver-declaracao.d.ts +2 -0
- package/fontes/avaliador-sintatico/retornos/retorno-resolver-declaracao.js +3 -0
- package/fontes/avaliador-sintatico/retornos/retorno-resolver-declaracao.js.map +1 -0
- package/fontes/bibliotecas/biblioteca-global.d.ts +2 -2
- package/fontes/bibliotecas/biblioteca-global.js +112 -57
- package/fontes/bibliotecas/biblioteca-global.js.map +1 -1
- package/fontes/bibliotecas/importar-biblioteca.d.ts +1 -1
- package/fontes/bibliotecas/importar-biblioteca.js +13 -14
- package/fontes/bibliotecas/importar-biblioteca.js.map +1 -1
- package/fontes/bibliotecas/primitivas-texto.js +13 -7
- package/fontes/bibliotecas/primitivas-texto.js.map +1 -1
- package/fontes/bibliotecas/primitivas-vetor.js +25 -11
- package/fontes/bibliotecas/primitivas-vetor.js.map +1 -1
- package/fontes/construtos/acesso-indice-variavel.d.ts +2 -2
- package/fontes/construtos/acesso-indice-variavel.js.map +1 -1
- package/fontes/construtos/acesso-metodo.d.ts +2 -2
- package/fontes/construtos/acesso-metodo.js.map +1 -1
- package/fontes/construtos/agrupamento.d.ts +2 -2
- package/fontes/construtos/atribuicao-sobrescrita.d.ts +1 -1
- package/fontes/construtos/atribuicao-sobrescrita.js.map +1 -1
- package/fontes/construtos/atribuir.d.ts +2 -2
- package/fontes/construtos/atribuir.js.map +1 -1
- package/fontes/construtos/binario.d.ts +2 -2
- package/fontes/construtos/binario.js.map +1 -1
- package/fontes/construtos/chamada.d.ts +2 -2
- package/fontes/construtos/chamada.js.map +1 -1
- package/fontes/construtos/conjunto.d.ts +1 -1
- package/fontes/construtos/conjunto.js.map +1 -1
- package/fontes/construtos/construto.d.ts +1 -0
- package/fontes/construtos/dicionario.d.ts +1 -1
- package/fontes/construtos/dicionario.js.map +1 -1
- package/fontes/construtos/funcao.d.ts +2 -2
- package/fontes/construtos/funcao.js.map +1 -1
- package/fontes/construtos/index.d.ts +18 -18
- package/fontes/construtos/isto.d.ts +1 -1
- package/fontes/construtos/isto.js.map +1 -1
- package/fontes/construtos/literal.d.ts +5 -4
- package/fontes/construtos/literal.js.map +1 -1
- package/fontes/construtos/logico.d.ts +1 -1
- package/fontes/construtos/logico.js.map +1 -1
- package/fontes/construtos/super.d.ts +4 -4
- package/fontes/construtos/super.js.map +1 -1
- package/fontes/construtos/unario.d.ts +1 -1
- package/fontes/construtos/unario.js.map +1 -1
- package/fontes/construtos/variavel.d.ts +2 -2
- package/fontes/construtos/variavel.js.map +1 -1
- package/fontes/construtos/vetor.d.ts +3 -3
- package/fontes/construtos/vetor.js.map +1 -1
- package/fontes/declaracoes/bloco.d.ts +4 -4
- package/fontes/declaracoes/bloco.js.map +1 -1
- package/fontes/declaracoes/classe.d.ts +2 -2
- package/fontes/declaracoes/classe.js.map +1 -1
- package/fontes/declaracoes/continua.d.ts +2 -2
- package/fontes/declaracoes/continua.js.map +1 -1
- package/fontes/declaracoes/declaracao.js +2 -2
- package/fontes/declaracoes/declaracao.js.map +1 -1
- package/fontes/declaracoes/enquanto.d.ts +2 -2
- package/fontes/declaracoes/enquanto.js.map +1 -1
- package/fontes/declaracoes/escolha.d.ts +7 -4
- package/fontes/declaracoes/escolha.js +6 -3
- package/fontes/declaracoes/escolha.js.map +1 -1
- package/fontes/declaracoes/escreva.d.ts +3 -3
- package/fontes/declaracoes/escreva.js.map +1 -1
- package/fontes/declaracoes/expressao.d.ts +3 -3
- package/fontes/declaracoes/expressao.js.map +1 -1
- package/fontes/declaracoes/fazer.d.ts +1 -1
- package/fontes/declaracoes/fazer.js.map +1 -1
- package/fontes/declaracoes/funcao.d.ts +2 -2
- package/fontes/declaracoes/funcao.js.map +1 -1
- package/fontes/declaracoes/importar.d.ts +2 -2
- package/fontes/declaracoes/importar.js.map +1 -1
- package/fontes/declaracoes/index.d.ts +1 -0
- package/fontes/declaracoes/index.js +1 -0
- package/fontes/declaracoes/index.js.map +1 -1
- package/fontes/declaracoes/leia.d.ts +12 -0
- package/fontes/declaracoes/leia.js +37 -0
- package/fontes/declaracoes/leia.js.map +1 -0
- package/fontes/declaracoes/para.d.ts +1 -1
- package/fontes/declaracoes/para.js.map +1 -1
- package/fontes/declaracoes/retorna.d.ts +2 -2
- package/fontes/declaracoes/retorna.js.map +1 -1
- package/fontes/declaracoes/se.d.ts +2 -2
- package/fontes/declaracoes/se.js.map +1 -1
- package/fontes/declaracoes/sustar.d.ts +2 -2
- package/fontes/declaracoes/sustar.js.map +1 -1
- package/fontes/declaracoes/tente.d.ts +2 -2
- package/fontes/declaracoes/tente.js.map +1 -1
- package/fontes/declaracoes/var.d.ts +5 -4
- package/fontes/declaracoes/var.js.map +1 -1
- package/fontes/delegua.d.ts +3 -3
- package/fontes/delegua.js +38 -22
- package/fontes/delegua.js.map +1 -1
- package/fontes/depuracao/cyrb53.js +6 -3
- package/fontes/depuracao/cyrb53.js.map +1 -1
- package/fontes/depuracao/servidor-depuracao.js +84 -46
- package/fontes/depuracao/servidor-depuracao.js.map +1 -1
- package/fontes/espaco-variaveis.d.ts +1 -1
- package/fontes/espaco-variaveis.js +0 -1
- package/fontes/espaco-variaveis.js.map +1 -1
- package/fontes/estruturas/chamavel.js +1 -1
- package/fontes/estruturas/classe-padrao.d.ts +1 -1
- package/fontes/estruturas/classe-padrao.js.map +1 -1
- package/fontes/estruturas/delegua-classe.d.ts +4 -4
- package/fontes/estruturas/delegua-classe.js +5 -3
- package/fontes/estruturas/delegua-classe.js.map +1 -1
- package/fontes/estruturas/funcao-padrao.d.ts +1 -1
- package/fontes/estruturas/funcao-padrao.js +1 -1
- package/fontes/estruturas/funcao.d.ts +4 -4
- package/fontes/estruturas/funcao.js +9 -4
- package/fontes/estruturas/funcao.js.map +1 -1
- package/fontes/estruturas/index.d.ts +9 -9
- package/fontes/estruturas/metodo-primitiva.d.ts +1 -1
- package/fontes/estruturas/modulo.d.ts +1 -1
- package/fontes/estruturas/modulo.js +1 -1
- package/fontes/estruturas/objeto-delegua-classe.d.ts +2 -2
- package/fontes/estruturas/objeto-delegua-classe.js +2 -2
- package/fontes/estruturas/objeto-delegua-classe.js.map +1 -1
- package/fontes/estruturas/objeto-padrao.js.map +1 -1
- package/fontes/excecoes/erro-em-tempo-de-execucao.d.ts +1 -1
- package/fontes/excecoes/erro-em-tempo-de-execucao.js.map +1 -1
- package/fontes/excecoes/index.d.ts +1 -1
- package/fontes/importador/importador.d.ts +1 -1
- package/fontes/importador/importador.js +3 -2
- package/fontes/importador/importador.js.map +1 -1
- package/fontes/importador/retorno-importador.d.ts +2 -2
- package/fontes/interfaces/avaliador-sintatico-interface.d.ts +3 -5
- package/fontes/interfaces/delegua-interface.d.ts +2 -2
- package/fontes/interfaces/escopo-execucao.d.ts +2 -2
- package/fontes/interfaces/importador-interface.d.ts +1 -1
- package/fontes/interfaces/interpretador-com-depuracao-interface.d.ts +3 -3
- package/fontes/interfaces/interpretador-interface.d.ts +8 -7
- package/fontes/interfaces/lexador-interface.d.ts +4 -4
- package/fontes/interfaces/parametro-interface.d.ts +1 -1
- package/fontes/interfaces/pilha-escopos-execucao-interface.d.ts +5 -5
- package/fontes/interfaces/resolvedor-interface.d.ts +5 -5
- package/fontes/interfaces/retornos/retorno-avaliador-sintatico.d.ts +2 -2
- package/fontes/interfaces/retornos/retorno-execucao-interface.d.ts +1 -1
- package/fontes/interfaces/retornos/retorno-interpretador.d.ts +1 -1
- package/fontes/interfaces/retornos/retorno-lexador.d.ts +3 -3
- package/fontes/interfaces/variavel-interface.d.ts +1 -1
- package/fontes/interpretador/dialetos/egua-classico.d.ts +2 -1
- package/fontes/interpretador/dialetos/egua-classico.js +75 -47
- package/fontes/interpretador/dialetos/egua-classico.js.map +1 -1
- package/fontes/interpretador/dialetos/index.js.map +1 -1
- package/fontes/interpretador/erro-interpretador.d.ts +1 -1
- package/fontes/interpretador/inferenciador.js.map +1 -1
- package/fontes/interpretador/interpretador-com-depuracao.js +5 -3
- package/fontes/interpretador/interpretador-com-depuracao.js.map +1 -1
- package/fontes/interpretador/interpretador.d.ts +10 -4
- package/fontes/interpretador/interpretador.js +57 -47
- package/fontes/interpretador/interpretador.js.map +1 -1
- package/fontes/interpretador/pilha-escopos-execucao.js +16 -5
- package/fontes/interpretador/pilha-escopos-execucao.js.map +1 -1
- package/fontes/lexador/dialetos/index.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-birl.d.ts +25 -0
- package/fontes/lexador/dialetos/lexador-birl.js +75 -0
- package/fontes/lexador/dialetos/lexador-birl.js.map +1 -0
- package/fontes/lexador/dialetos/lexador-egua-classico.js +38 -38
- package/fontes/lexador/dialetos/lexador-egua-classico.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-eguap.d.ts +4 -4
- package/fontes/lexador/dialetos/lexador-eguap.js +50 -44
- package/fontes/lexador/dialetos/lexador-eguap.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-visualg.d.ts +16 -0
- package/fontes/lexador/dialetos/lexador-visualg.js +227 -0
- package/fontes/lexador/dialetos/lexador-visualg.js.map +1 -0
- package/fontes/lexador/dialetos/palavras-reservadas/birl.d.ts +2 -0
- package/fontes/lexador/dialetos/palavras-reservadas/birl.js +4 -0
- package/fontes/lexador/dialetos/palavras-reservadas/birl.js.map +1 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.d.ts +26 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js +32 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js.map +1 -0
- package/fontes/lexador/lexador-base-linha-unica.d.ts +33 -0
- package/fontes/lexador/lexador-base-linha-unica.js +92 -0
- package/fontes/lexador/lexador-base-linha-unica.js.map +1 -0
- package/fontes/lexador/lexador.d.ts +3 -3
- package/fontes/lexador/lexador.js +43 -43
- package/fontes/lexador/lexador.js.map +1 -1
- package/fontes/lexador/palavras-reservadas.js +33 -33
- package/fontes/lexador/palavras-reservadas.js.map +1 -1
- package/fontes/lexador/simbolo.d.ts +1 -1
- package/fontes/lexador/simbolo.js +1 -1
- package/fontes/lexador/simbolo.js.map +1 -1
- package/fontes/quebras/index.js.map +1 -1
- package/fontes/resolvedor/dialetos/egua-classico.js +1 -1
- package/fontes/resolvedor/dialetos/egua-classico.js.map +1 -1
- package/fontes/resolvedor/dialetos/index.js.map +1 -1
- package/fontes/resolvedor/erro-resolvedor.d.ts +1 -1
- package/fontes/resolvedor/pilha-escopos.d.ts +1 -1
- package/fontes/resolvedor/pilha-escopos.js +2 -2
- package/fontes/resolvedor/pilha-escopos.js.map +1 -1
- package/fontes/resolvedor/retorno-resolvedor.d.ts +2 -2
- package/fontes/tipos-de-simbolos/birl.d.ts +18 -0
- package/fontes/tipos-de-simbolos/birl.js +21 -0
- package/fontes/tipos-de-simbolos/birl.js.map +1 -0
- package/fontes/tipos-de-simbolos/comum.d.ts +18 -0
- package/fontes/tipos-de-simbolos/comum.js +20 -0
- package/fontes/tipos-de-simbolos/comum.js.map +1 -0
- package/fontes/{tipos-de-simbolos.d.ts → tipos-de-simbolos/delegua.d.ts} +0 -0
- package/fontes/tipos-de-simbolos/delegua.js +78 -0
- package/fontes/tipos-de-simbolos/delegua.js.map +1 -0
- package/fontes/{lexador/dialetos/tipos-de-simbolos-eguap.d.ts → tipos-de-simbolos/eguap.d.ts} +0 -0
- package/fontes/tipos-de-simbolos/eguap.js +74 -0
- package/fontes/tipos-de-simbolos/eguap.js.map +1 -0
- package/fontes/tipos-de-simbolos/visualg.d.ts +47 -0
- package/fontes/tipos-de-simbolos/visualg.js +49 -0
- package/fontes/tipos-de-simbolos/visualg.js.map +1 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/jest.config.js +2 -2
- package/jest.config.js.map +1 -1
- package/package.json +78 -65
- package/testes/avaliador-sintatico.test.js +5 -5
- package/testes/avaliador-sintatico.test.js.map +1 -1
- package/testes/egua-classico/avaliador-sintatico.test.js +4 -1
- package/testes/egua-classico/avaliador-sintatico.test.js.map +1 -1
- package/testes/egua-classico/delegua.test.js.map +1 -1
- package/testes/egua-classico/resolvedor.test.js.map +1 -1
- package/testes/eguap/avaliador-sintatico.test.js +1 -5
- package/testes/eguap/avaliador-sintatico.test.js.map +1 -1
- package/testes/eguap/lexador.test.js +1 -1
- package/testes/eguap/lexador.test.js.map +1 -1
- package/testes/interpretador.test.js +48 -0
- package/testes/interpretador.test.js.map +1 -1
- package/testes/lexador.test.js +45 -45
- package/testes/lexador.test.js.map +1 -1
- package/testes/visualg/avaliador-sintatico.test.d.ts +1 -0
- package/testes/visualg/avaliador-sintatico.test.js +113 -0
- package/testes/visualg/avaliador-sintatico.test.js.map +1 -0
- package/testes/visualg/lexador.test.d.ts +1 -0
- package/testes/visualg/lexador.test.js +67 -0
- package/testes/visualg/lexador.test.js.map +1 -0
- package/fontes/lexador/dialetos/tipos-de-simbolos-eguap.js +0 -74
- package/fontes/lexador/dialetos/tipos-de-simbolos-eguap.js.map +0 -1
- package/fontes/tipos-de-simbolos.js +0 -78
- package/fontes/tipos-de-simbolos.js.map +0 -1
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AvaliadorSintatico = void 0;
|
|
7
|
-
var
|
|
7
|
+
var delegua_1 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
8
8
|
var browser_process_hrtime_1 = __importDefault(require("browser-process-hrtime"));
|
|
9
9
|
var construtos_1 = require("../construtos");
|
|
10
10
|
var erro_avaliador_sintatico_1 = require("./erro-avaliador-sintatico");
|
|
@@ -31,12 +31,12 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
31
31
|
AvaliadorSintatico.prototype.consumir = function (tipo, mensagemDeErro) {
|
|
32
32
|
if (this.verificarTipoSimboloAtual(tipo))
|
|
33
33
|
return this.avancarEDevolverAnterior();
|
|
34
|
-
throw this.erro(this.
|
|
34
|
+
throw this.erro(this.simbolos[this.atual], mensagemDeErro);
|
|
35
35
|
};
|
|
36
36
|
AvaliadorSintatico.prototype.verificarTipoSimboloAtual = function (tipo) {
|
|
37
37
|
if (this.estaNoFinal())
|
|
38
38
|
return false;
|
|
39
|
-
return this.
|
|
39
|
+
return this.simbolos[this.atual].tipo === tipo;
|
|
40
40
|
};
|
|
41
41
|
AvaliadorSintatico.prototype.verificarTipoProximoSimbolo = function (tipo) {
|
|
42
42
|
return this.simbolos[this.atual + 1].tipo === tipo;
|
|
@@ -53,7 +53,7 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
53
53
|
AvaliadorSintatico.prototype.avancarEDevolverAnterior = function () {
|
|
54
54
|
if (!this.estaNoFinal())
|
|
55
55
|
this.atual += 1;
|
|
56
|
-
return this.
|
|
56
|
+
return this.simbolos[this.atual - 1];
|
|
57
57
|
};
|
|
58
58
|
AvaliadorSintatico.prototype.verificarSeSimboloAtualEIgualA = function () {
|
|
59
59
|
var argumentos = [];
|
|
@@ -70,98 +70,99 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
70
70
|
return false;
|
|
71
71
|
};
|
|
72
72
|
AvaliadorSintatico.prototype.primario = function () {
|
|
73
|
-
var simboloAtual = this.
|
|
74
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
75
|
-
var simboloChave = this.
|
|
76
|
-
this.consumir(
|
|
77
|
-
var metodo = this.consumir(
|
|
73
|
+
var simboloAtual = this.simbolos[this.atual];
|
|
74
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.SUPER)) {
|
|
75
|
+
var simboloChave = this.simbolos[this.atual - 1];
|
|
76
|
+
this.consumir(delegua_1.default.PONTO, "Esperado '.' após 'super'.");
|
|
77
|
+
var metodo = this.consumir(delegua_1.default.IDENTIFICADOR, 'Esperado nome do método da SuperClasse.');
|
|
78
78
|
return new construtos_1.Super(this.hashArquivo, simboloChave, metodo);
|
|
79
79
|
}
|
|
80
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
80
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.COLCHETE_ESQUERDO)) {
|
|
81
81
|
var valores = [];
|
|
82
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
82
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.COLCHETE_DIREITO)) {
|
|
83
83
|
return new construtos_1.Vetor(this.hashArquivo, Number(simboloAtual.linha), []);
|
|
84
84
|
}
|
|
85
|
-
while (!this.verificarSeSimboloAtualEIgualA(
|
|
85
|
+
while (!this.verificarSeSimboloAtualEIgualA(delegua_1.default.COLCHETE_DIREITO)) {
|
|
86
86
|
var valor = this.atribuir();
|
|
87
87
|
valores.push(valor);
|
|
88
|
-
if (this.
|
|
89
|
-
|
|
90
|
-
this.consumir(
|
|
88
|
+
if (this.simbolos[this.atual].tipo !==
|
|
89
|
+
delegua_1.default.COLCHETE_DIREITO) {
|
|
90
|
+
this.consumir(delegua_1.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return new construtos_1.Vetor(this.hashArquivo, Number(simboloAtual.linha), valores);
|
|
94
94
|
}
|
|
95
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
95
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.CHAVE_ESQUERDA)) {
|
|
96
96
|
var chaves = [];
|
|
97
97
|
var valores = [];
|
|
98
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
98
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.CHAVE_DIREITA)) {
|
|
99
99
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloAtual.linha), [], []);
|
|
100
100
|
}
|
|
101
|
-
while (!this.verificarSeSimboloAtualEIgualA(
|
|
101
|
+
while (!this.verificarSeSimboloAtualEIgualA(delegua_1.default.CHAVE_DIREITA)) {
|
|
102
102
|
var chave = this.atribuir();
|
|
103
|
-
this.consumir(
|
|
103
|
+
this.consumir(delegua_1.default.DOIS_PONTOS, "Esperado ':' entre chave e valor.");
|
|
104
104
|
var valor = this.atribuir();
|
|
105
105
|
chaves.push(chave);
|
|
106
106
|
valores.push(valor);
|
|
107
|
-
if (this.
|
|
108
|
-
|
|
107
|
+
if (this.simbolos[this.atual].tipo !==
|
|
108
|
+
delegua_1.default.CHAVE_DIREITA) {
|
|
109
|
+
this.consumir(delegua_1.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
return new construtos_1.Dicionario(this.hashArquivo, Number(simboloAtual.linha), chaves, valores);
|
|
112
113
|
}
|
|
113
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
114
|
-
return this.corpoDaFuncao(this.
|
|
115
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
114
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.FUNÇÃO, delegua_1.default.FUNCAO))
|
|
115
|
+
return this.corpoDaFuncao(this.simbolos[this.atual - 1].lexema);
|
|
116
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.FALSO))
|
|
116
117
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), false);
|
|
117
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
118
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.VERDADEIRO))
|
|
118
119
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), true);
|
|
119
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
120
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.NULO))
|
|
120
121
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAtual.linha), null);
|
|
121
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
122
|
-
return new construtos_1.Isto(this.hashArquivo, Number(simboloAtual.linha), this.
|
|
123
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
124
|
-
var simboloAnterior = this.
|
|
122
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.ISTO))
|
|
123
|
+
return new construtos_1.Isto(this.hashArquivo, Number(simboloAtual.linha), this.simbolos[this.atual - 1]);
|
|
124
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.NUMERO, delegua_1.default.TEXTO)) {
|
|
125
|
+
var simboloAnterior = this.simbolos[this.atual - 1];
|
|
125
126
|
return new construtos_1.Literal(this.hashArquivo, Number(simboloAnterior.linha), simboloAnterior.literal);
|
|
126
127
|
}
|
|
127
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
128
|
-
return new construtos_1.Variavel(this.hashArquivo, this.
|
|
128
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.IDENTIFICADOR)) {
|
|
129
|
+
return new construtos_1.Variavel(this.hashArquivo, this.simbolos[this.atual - 1]);
|
|
129
130
|
}
|
|
130
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
131
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PARENTESE_ESQUERDO)) {
|
|
131
132
|
var expressao = this.expressao();
|
|
132
|
-
this.consumir(
|
|
133
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após a expressão.");
|
|
133
134
|
return new construtos_1.Agrupamento(this.hashArquivo, Number(simboloAtual.linha), expressao);
|
|
134
135
|
}
|
|
135
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
136
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.IMPORTAR))
|
|
136
137
|
return this.declaracaoImportar();
|
|
137
|
-
throw this.erro(this.
|
|
138
|
+
throw this.erro(this.simbolos[this.atual], 'Esperado expressão.');
|
|
138
139
|
};
|
|
139
140
|
AvaliadorSintatico.prototype.finalizarChamada = function (entidadeChamada) {
|
|
140
141
|
var argumentos = [];
|
|
141
|
-
if (!this.verificarTipoSimboloAtual(
|
|
142
|
+
if (!this.verificarTipoSimboloAtual(delegua_1.default.PARENTESE_DIREITO)) {
|
|
142
143
|
do {
|
|
143
144
|
if (argumentos.length >= 255) {
|
|
144
|
-
throw this.erro(this.
|
|
145
|
+
throw this.erro(this.simbolos[this.atual], 'Não pode haver mais de 255 argumentos.');
|
|
145
146
|
}
|
|
146
147
|
argumentos.push(this.expressao());
|
|
147
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
148
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.VIRGULA));
|
|
148
149
|
}
|
|
149
|
-
var parenteseDireito = this.consumir(
|
|
150
|
+
var parenteseDireito = this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após os argumentos.");
|
|
150
151
|
return new construtos_1.Chamada(this.hashArquivo, entidadeChamada, parenteseDireito, argumentos);
|
|
151
152
|
};
|
|
152
153
|
AvaliadorSintatico.prototype.chamar = function () {
|
|
153
154
|
var expressao = this.primario();
|
|
154
155
|
while (true) {
|
|
155
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
156
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PARENTESE_ESQUERDO)) {
|
|
156
157
|
expressao = this.finalizarChamada(expressao);
|
|
157
158
|
}
|
|
158
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
159
|
-
var nome = this.consumir(
|
|
159
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PONTO)) {
|
|
160
|
+
var nome = this.consumir(delegua_1.default.IDENTIFICADOR, "Esperado nome do método após '.'.");
|
|
160
161
|
expressao = new construtos_1.AcessoMetodo(this.hashArquivo, expressao, nome);
|
|
161
162
|
}
|
|
162
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
163
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.COLCHETE_ESQUERDO)) {
|
|
163
164
|
var indice = this.expressao();
|
|
164
|
-
var simboloFechamento = this.consumir(
|
|
165
|
+
var simboloFechamento = this.consumir(delegua_1.default.COLCHETE_DIREITO, "Esperado ']' após escrita do indice.");
|
|
165
166
|
expressao = new construtos_1.AcessoIndiceVariavel(this.hashArquivo, expressao, indice, simboloFechamento);
|
|
166
167
|
}
|
|
167
168
|
else {
|
|
@@ -171,8 +172,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
171
172
|
return expressao;
|
|
172
173
|
};
|
|
173
174
|
AvaliadorSintatico.prototype.unario = function () {
|
|
174
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
175
|
-
var operador = this.
|
|
175
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.NEGACAO, delegua_1.default.SUBTRACAO, delegua_1.default.BIT_NOT)) {
|
|
176
|
+
var operador = this.simbolos[this.atual - 1];
|
|
176
177
|
var direito = this.unario();
|
|
177
178
|
return new construtos_1.Unario(this.hashArquivo, operador, direito);
|
|
178
179
|
}
|
|
@@ -180,8 +181,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
180
181
|
};
|
|
181
182
|
AvaliadorSintatico.prototype.exponenciacao = function () {
|
|
182
183
|
var expressao = this.unario();
|
|
183
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
184
|
-
var operador = this.
|
|
184
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.EXPONENCIACAO)) {
|
|
185
|
+
var operador = this.simbolos[this.atual - 1];
|
|
185
186
|
var direito = this.unario();
|
|
186
187
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
187
188
|
}
|
|
@@ -189,8 +190,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
189
190
|
};
|
|
190
191
|
AvaliadorSintatico.prototype.multiplicar = function () {
|
|
191
192
|
var expressao = this.exponenciacao();
|
|
192
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
193
|
-
var operador = this.
|
|
193
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.DIVISAO, delegua_1.default.MULTIPLICACAO, delegua_1.default.MODULO, delegua_1.default.DIVISAO_IGUAL, delegua_1.default.MULTIPLICACAO_IGUAL, delegua_1.default.MODULO_IGUAL)) {
|
|
194
|
+
var operador = this.simbolos[this.atual - 1];
|
|
194
195
|
var direito = this.exponenciacao();
|
|
195
196
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
196
197
|
}
|
|
@@ -203,8 +204,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
203
204
|
*/
|
|
204
205
|
AvaliadorSintatico.prototype.adicaoOuSubtracao = function () {
|
|
205
206
|
var expressao = this.multiplicar();
|
|
206
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
207
|
-
var operador = this.
|
|
207
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.SUBTRACAO, delegua_1.default.ADICAO, delegua_1.default.MAIS_IGUAL, delegua_1.default.MENOS_IGUAL)) {
|
|
208
|
+
var operador = this.simbolos[this.atual - 1];
|
|
208
209
|
var direito = this.multiplicar();
|
|
209
210
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
210
211
|
}
|
|
@@ -212,8 +213,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
212
213
|
};
|
|
213
214
|
AvaliadorSintatico.prototype.bitFill = function () {
|
|
214
215
|
var expressao = this.adicaoOuSubtracao();
|
|
215
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
216
|
-
var operador = this.
|
|
216
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.MENOR_MENOR, delegua_1.default.MAIOR_MAIOR)) {
|
|
217
|
+
var operador = this.simbolos[this.atual - 1];
|
|
217
218
|
var direito = this.adicaoOuSubtracao();
|
|
218
219
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
219
220
|
}
|
|
@@ -221,8 +222,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
221
222
|
};
|
|
222
223
|
AvaliadorSintatico.prototype.bitE = function () {
|
|
223
224
|
var expressao = this.bitFill();
|
|
224
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
225
|
-
var operador = this.
|
|
225
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.BIT_AND)) {
|
|
226
|
+
var operador = this.simbolos[this.atual - 1];
|
|
226
227
|
var direito = this.bitFill();
|
|
227
228
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
228
229
|
}
|
|
@@ -230,8 +231,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
230
231
|
};
|
|
231
232
|
AvaliadorSintatico.prototype.bitOu = function () {
|
|
232
233
|
var expressao = this.bitE();
|
|
233
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
234
|
-
var operador = this.
|
|
234
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.BIT_OR, delegua_1.default.BIT_XOR)) {
|
|
235
|
+
var operador = this.simbolos[this.atual - 1];
|
|
235
236
|
var direito = this.bitE();
|
|
236
237
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
237
238
|
}
|
|
@@ -239,8 +240,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
239
240
|
};
|
|
240
241
|
AvaliadorSintatico.prototype.comparar = function () {
|
|
241
242
|
var expressao = this.bitOu();
|
|
242
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
243
|
-
var operador = this.
|
|
243
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.MAIOR, delegua_1.default.MAIOR_IGUAL, delegua_1.default.MENOR, delegua_1.default.MENOR_IGUAL)) {
|
|
244
|
+
var operador = this.simbolos[this.atual - 1];
|
|
244
245
|
var direito = this.bitOu();
|
|
245
246
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
246
247
|
}
|
|
@@ -248,8 +249,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
248
249
|
};
|
|
249
250
|
AvaliadorSintatico.prototype.comparacaoIgualdade = function () {
|
|
250
251
|
var expressao = this.comparar();
|
|
251
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
252
|
-
var operador = this.
|
|
252
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.DIFERENTE, delegua_1.default.IGUAL_IGUAL)) {
|
|
253
|
+
var operador = this.simbolos[this.atual - 1];
|
|
253
254
|
var direito = this.comparar();
|
|
254
255
|
expressao = new construtos_1.Binario(this.hashArquivo, expressao, operador, direito);
|
|
255
256
|
}
|
|
@@ -257,8 +258,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
257
258
|
};
|
|
258
259
|
AvaliadorSintatico.prototype.em = function () {
|
|
259
260
|
var expressao = this.comparacaoIgualdade();
|
|
260
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
261
|
-
var operador = this.
|
|
261
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.EM)) {
|
|
262
|
+
var operador = this.simbolos[this.atual - 1];
|
|
262
263
|
var direito = this.comparacaoIgualdade();
|
|
263
264
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
264
265
|
}
|
|
@@ -266,8 +267,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
266
267
|
};
|
|
267
268
|
AvaliadorSintatico.prototype.e = function () {
|
|
268
269
|
var expressao = this.em();
|
|
269
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
270
|
-
var operador = this.
|
|
270
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.E)) {
|
|
271
|
+
var operador = this.simbolos[this.atual - 1];
|
|
271
272
|
var direito = this.em();
|
|
272
273
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
273
274
|
}
|
|
@@ -275,8 +276,8 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
275
276
|
};
|
|
276
277
|
AvaliadorSintatico.prototype.ou = function () {
|
|
277
278
|
var expressao = this.e();
|
|
278
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
279
|
-
var operador = this.
|
|
279
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.OU)) {
|
|
280
|
+
var operador = this.simbolos[this.atual - 1];
|
|
280
281
|
var direito = this.e();
|
|
281
282
|
expressao = new construtos_1.Logico(this.hashArquivo, expressao, operador, direito);
|
|
282
283
|
}
|
|
@@ -290,16 +291,16 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
290
291
|
var expressao = this.ou();
|
|
291
292
|
if (expressao instanceof construtos_1.Binario &&
|
|
292
293
|
[
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
delegua_1.default.MAIS_IGUAL,
|
|
295
|
+
delegua_1.default.MENOS_IGUAL,
|
|
296
|
+
delegua_1.default.MULTIPLICACAO_IGUAL,
|
|
297
|
+
delegua_1.default.DIVISAO_IGUAL,
|
|
298
|
+
delegua_1.default.MODULO_IGUAL,
|
|
298
299
|
].includes(expressao.operador.tipo)) {
|
|
299
300
|
return new construtos_1.Atribuir(this.hashArquivo, expressao.esquerda.simbolo, expressao);
|
|
300
301
|
}
|
|
301
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
302
|
-
var igual = this.
|
|
302
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.IGUAL)) {
|
|
303
|
+
var igual = this.simbolos[this.atual - 1];
|
|
303
304
|
var valor = this.atribuir();
|
|
304
305
|
if (expressao instanceof construtos_1.Variavel) {
|
|
305
306
|
var simbolo = expressao.simbolo;
|
|
@@ -320,13 +321,13 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
320
321
|
return this.atribuir();
|
|
321
322
|
};
|
|
322
323
|
AvaliadorSintatico.prototype.declaracaoEscreva = function () {
|
|
323
|
-
var simboloAtual = this.
|
|
324
|
-
this.consumir(
|
|
324
|
+
var simboloAtual = this.simbolos[this.atual];
|
|
325
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' antes dos valores em escreva.");
|
|
325
326
|
var argumentos = [];
|
|
326
327
|
do {
|
|
327
328
|
argumentos.push(this.expressao());
|
|
328
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
329
|
-
this.consumir(
|
|
329
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.VIRGULA));
|
|
330
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após os valores em escreva.");
|
|
330
331
|
return new declaracoes_1.Escreva(Number(simboloAtual.linha), simboloAtual.hashArquivo, argumentos);
|
|
331
332
|
};
|
|
332
333
|
AvaliadorSintatico.prototype.declaracaoExpressao = function () {
|
|
@@ -335,23 +336,23 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
335
336
|
};
|
|
336
337
|
AvaliadorSintatico.prototype.blocoEscopo = function () {
|
|
337
338
|
var declaracoes = [];
|
|
338
|
-
while (!this.verificarTipoSimboloAtual(
|
|
339
|
+
while (!this.verificarTipoSimboloAtual(delegua_1.default.CHAVE_DIREITA) &&
|
|
339
340
|
!this.estaNoFinal()) {
|
|
340
341
|
declaracoes.push(this.declaracao());
|
|
341
342
|
}
|
|
342
|
-
this.consumir(
|
|
343
|
+
this.consumir(delegua_1.default.CHAVE_DIREITA, "Esperado '}' após o bloco.");
|
|
343
344
|
return declaracoes;
|
|
344
345
|
};
|
|
345
346
|
AvaliadorSintatico.prototype.declaracaoSe = function () {
|
|
346
|
-
this.consumir(
|
|
347
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'se'.");
|
|
347
348
|
var condicao = this.expressao();
|
|
348
|
-
this.consumir(
|
|
349
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após condição do se.");
|
|
349
350
|
var caminhoEntao = this.resolverDeclaracao();
|
|
350
351
|
var caminhosSeSenao = [];
|
|
351
|
-
while (this.verificarSeSimboloAtualEIgualA(
|
|
352
|
-
this.consumir(
|
|
352
|
+
while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.SENAOSE, delegua_1.default.SENÃOSE)) {
|
|
353
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'senaose' ou 'senãose'.");
|
|
353
354
|
var condicaoSeSenao = this.expressao();
|
|
354
|
-
this.consumir(
|
|
355
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após codição do 'senaose' ou 'senãose'.");
|
|
355
356
|
var caminho = this.resolverDeclaracao();
|
|
356
357
|
caminhosSeSenao.push({
|
|
357
358
|
condicao: condicaoSeSenao,
|
|
@@ -359,7 +360,7 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
359
360
|
});
|
|
360
361
|
}
|
|
361
362
|
var caminhoSenao = null;
|
|
362
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
363
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.SENAO, delegua_1.default.SENÃO)) {
|
|
363
364
|
caminhoSenao = this.resolverDeclaracao();
|
|
364
365
|
}
|
|
365
366
|
return new declaracoes_1.Se(condicao, caminhoEntao, caminhosSeSenao, caminhoSenao);
|
|
@@ -367,9 +368,9 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
367
368
|
AvaliadorSintatico.prototype.declaracaoEnquanto = function () {
|
|
368
369
|
try {
|
|
369
370
|
this.ciclos += 1;
|
|
370
|
-
this.consumir(
|
|
371
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'enquanto'.");
|
|
371
372
|
var condicao = this.expressao();
|
|
372
|
-
this.consumir(
|
|
373
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após condicional.");
|
|
373
374
|
var corpo = this.resolverDeclaracao();
|
|
374
375
|
return new declaracoes_1.Enquanto(condicao, corpo);
|
|
375
376
|
}
|
|
@@ -379,28 +380,28 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
379
380
|
};
|
|
380
381
|
AvaliadorSintatico.prototype.declaracaoPara = function () {
|
|
381
382
|
try {
|
|
382
|
-
var simboloPara = this.
|
|
383
|
+
var simboloPara = this.simbolos[this.atual - 1];
|
|
383
384
|
this.ciclos += 1;
|
|
384
|
-
this.consumir(
|
|
385
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'para'.");
|
|
385
386
|
var inicializador = void 0;
|
|
386
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
387
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PONTO_E_VIRGULA)) {
|
|
387
388
|
inicializador = null;
|
|
388
389
|
}
|
|
389
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
390
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.VARIAVEL)) {
|
|
390
391
|
inicializador = this.declaracaoDeVariavel();
|
|
391
392
|
}
|
|
392
393
|
else {
|
|
393
394
|
inicializador = this.declaracaoExpressao();
|
|
394
395
|
}
|
|
395
396
|
var condicao = null;
|
|
396
|
-
if (!this.verificarTipoSimboloAtual(
|
|
397
|
+
if (!this.verificarTipoSimboloAtual(delegua_1.default.PONTO_E_VIRGULA)) {
|
|
397
398
|
condicao = this.expressao();
|
|
398
399
|
}
|
|
399
400
|
var incrementar = null;
|
|
400
|
-
if (!this.verificarTipoSimboloAtual(
|
|
401
|
+
if (!this.verificarTipoSimboloAtual(delegua_1.default.PARENTESE_DIREITO)) {
|
|
401
402
|
incrementar = this.expressao();
|
|
402
403
|
}
|
|
403
|
-
this.consumir(
|
|
404
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após cláusulas");
|
|
404
405
|
var corpo = this.resolverDeclaracao();
|
|
405
406
|
return new declaracoes_1.Para(this.hashArquivo, Number(simboloPara.linha), inicializador, condicao, incrementar, corpo);
|
|
406
407
|
}
|
|
@@ -410,20 +411,20 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
410
411
|
};
|
|
411
412
|
AvaliadorSintatico.prototype.declaracaoSustar = function () {
|
|
412
413
|
if (this.ciclos < 1) {
|
|
413
|
-
this.erro(this.
|
|
414
|
+
this.erro(this.simbolos[this.atual - 1], "'sustar' ou 'pausa' deve estar dentro de um laço de repetição.");
|
|
414
415
|
}
|
|
415
|
-
return new declaracoes_1.Sustar(this.
|
|
416
|
+
return new declaracoes_1.Sustar(this.simbolos[this.atual]);
|
|
416
417
|
};
|
|
417
418
|
AvaliadorSintatico.prototype.declaracaoContinua = function () {
|
|
418
419
|
if (this.ciclos < 1) {
|
|
419
|
-
this.erro(this.
|
|
420
|
+
this.erro(this.simbolos[this.atual - 1], "'continua' precisa estar em um laço de repetição.");
|
|
420
421
|
}
|
|
421
|
-
return new declaracoes_1.Continua(this.
|
|
422
|
+
return new declaracoes_1.Continua(this.simbolos[this.atual]);
|
|
422
423
|
};
|
|
423
424
|
AvaliadorSintatico.prototype.declaracaoRetorna = function () {
|
|
424
|
-
var simboloChave = this.
|
|
425
|
+
var simboloChave = this.simbolos[this.atual - 1];
|
|
425
426
|
var valor = null;
|
|
426
|
-
if (!this.verificarTipoSimboloAtual(
|
|
427
|
+
if (!this.verificarTipoSimboloAtual(delegua_1.default.PONTO_E_VIRGULA)) {
|
|
427
428
|
valor = this.expressao();
|
|
428
429
|
}
|
|
429
430
|
return new declaracoes_1.Retorna(simboloChave, valor);
|
|
@@ -431,46 +432,46 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
431
432
|
AvaliadorSintatico.prototype.declaracaoEscolha = function () {
|
|
432
433
|
try {
|
|
433
434
|
this.ciclos += 1;
|
|
434
|
-
this.consumir(
|
|
435
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '{' após 'escolha'.");
|
|
435
436
|
var condicao = this.expressao();
|
|
436
|
-
this.consumir(
|
|
437
|
-
this.consumir(
|
|
437
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado '}' após a condição de 'escolha'.");
|
|
438
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo do 'escolha'.");
|
|
438
439
|
var caminhos = [];
|
|
439
440
|
var caminhoPadrao = null;
|
|
440
|
-
while (!this.verificarSeSimboloAtualEIgualA(
|
|
441
|
+
while (!this.verificarSeSimboloAtualEIgualA(delegua_1.default.CHAVE_DIREITA) &&
|
|
441
442
|
!this.estaNoFinal()) {
|
|
442
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
443
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.CASO)) {
|
|
443
444
|
var caminhoCondicoes = [this.expressao()];
|
|
444
|
-
this.consumir(
|
|
445
|
-
while (this.verificarTipoSimboloAtual(
|
|
446
|
-
this.consumir(
|
|
445
|
+
this.consumir(delegua_1.default.DOIS_PONTOS, "Esperado ':' após o 'caso'.");
|
|
446
|
+
while (this.verificarTipoSimboloAtual(delegua_1.default.CASO)) {
|
|
447
|
+
this.consumir(delegua_1.default.CASO, null);
|
|
447
448
|
caminhoCondicoes.push(this.expressao());
|
|
448
|
-
this.consumir(
|
|
449
|
+
this.consumir(delegua_1.default.DOIS_PONTOS, "Esperado ':' após declaração do 'caso'.");
|
|
449
450
|
}
|
|
450
451
|
var declaracoes = [];
|
|
451
452
|
do {
|
|
452
453
|
declaracoes.push(this.resolverDeclaracao());
|
|
453
|
-
} while (!this.verificarTipoSimboloAtual(
|
|
454
|
-
!this.verificarTipoSimboloAtual(
|
|
455
|
-
!this.verificarTipoSimboloAtual(
|
|
454
|
+
} while (!this.verificarTipoSimboloAtual(delegua_1.default.CASO) &&
|
|
455
|
+
!this.verificarTipoSimboloAtual(delegua_1.default.PADRAO) &&
|
|
456
|
+
!this.verificarTipoSimboloAtual(delegua_1.default.CHAVE_DIREITA));
|
|
456
457
|
caminhos.push({
|
|
457
458
|
condicoes: caminhoCondicoes,
|
|
458
459
|
declaracoes: declaracoes,
|
|
459
460
|
});
|
|
460
461
|
}
|
|
461
|
-
else if (this.verificarSeSimboloAtualEIgualA(
|
|
462
|
+
else if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PADRAO)) {
|
|
462
463
|
if (caminhoPadrao !== null) {
|
|
463
|
-
var excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(this.
|
|
464
|
+
var excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(this.simbolos[this.atual], "Você só pode ter um 'padrao' em cada declaração de 'escolha'.");
|
|
464
465
|
this.erros.push(excecao);
|
|
465
466
|
throw excecao;
|
|
466
467
|
}
|
|
467
|
-
this.consumir(
|
|
468
|
+
this.consumir(delegua_1.default.DOIS_PONTOS, "Esperado ':' após declaração do 'padrao'.");
|
|
468
469
|
var declaracoes = [];
|
|
469
470
|
do {
|
|
470
471
|
declaracoes.push(this.resolverDeclaracao());
|
|
471
|
-
} while (!this.verificarTipoSimboloAtual(
|
|
472
|
-
!this.verificarTipoSimboloAtual(
|
|
473
|
-
!this.verificarTipoSimboloAtual(
|
|
472
|
+
} while (!this.verificarTipoSimboloAtual(delegua_1.default.CASO) &&
|
|
473
|
+
!this.verificarTipoSimboloAtual(delegua_1.default.PADRAO) &&
|
|
474
|
+
!this.verificarTipoSimboloAtual(delegua_1.default.CHAVE_DIREITA));
|
|
474
475
|
caminhoPadrao = {
|
|
475
476
|
declaracoes: declaracoes,
|
|
476
477
|
};
|
|
@@ -483,41 +484,41 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
483
484
|
}
|
|
484
485
|
};
|
|
485
486
|
AvaliadorSintatico.prototype.declaracaoImportar = function () {
|
|
486
|
-
this.consumir(
|
|
487
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' após declaração.");
|
|
487
488
|
var caminho = this.expressao();
|
|
488
|
-
var simboloFechamento = this.consumir(
|
|
489
|
+
var simboloFechamento = this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após declaração.");
|
|
489
490
|
return new declaracoes_1.Importar(caminho, simboloFechamento);
|
|
490
491
|
};
|
|
491
492
|
AvaliadorSintatico.prototype.declaracaoTente = function () {
|
|
492
|
-
var simboloTente = this.
|
|
493
|
-
this.consumir(
|
|
493
|
+
var simboloTente = this.simbolos[this.atual - 1];
|
|
494
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'tente'.");
|
|
494
495
|
var blocoTente = this.blocoEscopo();
|
|
495
496
|
var blocoPegue = null;
|
|
496
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
497
|
-
this.consumir(
|
|
497
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PEGUE)) {
|
|
498
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'pegue'.");
|
|
498
499
|
blocoPegue = this.blocoEscopo();
|
|
499
500
|
}
|
|
500
501
|
var blocoSenao = null;
|
|
501
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
502
|
-
this.consumir(
|
|
502
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.SENAO, delegua_1.default.SENÃO)) {
|
|
503
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'pegue'.");
|
|
503
504
|
blocoSenao = this.blocoEscopo();
|
|
504
505
|
}
|
|
505
506
|
var blocoFinalmente = null;
|
|
506
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
507
|
-
this.consumir(
|
|
507
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.FINALMENTE)) {
|
|
508
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'pegue'.");
|
|
508
509
|
blocoFinalmente = this.blocoEscopo();
|
|
509
510
|
}
|
|
510
511
|
return new declaracoes_1.Tente(simboloTente.hashArquivo, Number(simboloTente.linha), blocoTente, blocoPegue, blocoSenao, blocoFinalmente);
|
|
511
512
|
};
|
|
512
513
|
AvaliadorSintatico.prototype.declaracaoFazer = function () {
|
|
513
|
-
var simboloFazer = this.
|
|
514
|
+
var simboloFazer = this.simbolos[this.atual - 1];
|
|
514
515
|
try {
|
|
515
516
|
this.ciclos += 1;
|
|
516
517
|
var caminhoFazer = this.resolverDeclaracao();
|
|
517
|
-
this.consumir(
|
|
518
|
-
this.consumir(
|
|
518
|
+
this.consumir(delegua_1.default.ENQUANTO, "Esperado declaração do 'enquanto' após o escopo do 'fazer'.");
|
|
519
|
+
this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' após declaração 'enquanto'.");
|
|
519
520
|
var condicaoEnquanto = this.expressao();
|
|
520
|
-
this.consumir(
|
|
521
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após declaração do 'enquanto'.");
|
|
521
522
|
return new declaracoes_1.Fazer(simboloFazer.hashArquivo, Number(simboloFazer.linha), caminhoFazer, condicaoEnquanto);
|
|
522
523
|
}
|
|
523
524
|
finally {
|
|
@@ -525,40 +526,40 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
525
526
|
}
|
|
526
527
|
};
|
|
527
528
|
AvaliadorSintatico.prototype.resolverDeclaracao = function () {
|
|
528
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
529
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.FAZER))
|
|
529
530
|
return this.declaracaoFazer();
|
|
530
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
531
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.TENTE))
|
|
531
532
|
return this.declaracaoTente();
|
|
532
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
533
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.ESCOLHA))
|
|
533
534
|
return this.declaracaoEscolha();
|
|
534
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
535
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.RETORNA))
|
|
535
536
|
return this.declaracaoRetorna();
|
|
536
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
537
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.CONTINUA))
|
|
537
538
|
return this.declaracaoContinua();
|
|
538
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
539
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PAUSA))
|
|
539
540
|
return this.declaracaoSustar();
|
|
540
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
541
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.PARA))
|
|
541
542
|
return this.declaracaoPara();
|
|
542
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
543
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.ENQUANTO))
|
|
543
544
|
return this.declaracaoEnquanto();
|
|
544
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
545
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.SE))
|
|
545
546
|
return this.declaracaoSe();
|
|
546
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
547
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.ESCREVA))
|
|
547
548
|
return this.declaracaoEscreva();
|
|
548
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
549
|
-
var simboloInicioBloco = this.
|
|
549
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.CHAVE_ESQUERDA)) {
|
|
550
|
+
var simboloInicioBloco = this.simbolos[this.atual - 1];
|
|
550
551
|
return new declaracoes_1.Bloco(simboloInicioBloco.hashArquivo, Number(simboloInicioBloco.linha), this.blocoEscopo());
|
|
551
552
|
}
|
|
552
|
-
var simboloAtual = this.
|
|
553
|
-
if (simboloAtual.tipo ===
|
|
553
|
+
var simboloAtual = this.simbolos[this.atual];
|
|
554
|
+
if (simboloAtual.tipo === delegua_1.default.IDENTIFICADOR) {
|
|
554
555
|
// Pela gramática, a seguinte situação não pode ocorrer:
|
|
555
556
|
// 1. O símbolo anterior ser um identificador; e
|
|
556
557
|
// 2. O símbolo anterior estar na mesma linha do identificador atual.
|
|
557
|
-
var simboloAnterior = this.
|
|
558
|
+
var simboloAnterior = this.simbolos[this.atual - 1];
|
|
558
559
|
if (!!simboloAnterior &&
|
|
559
|
-
simboloAnterior.tipo ===
|
|
560
|
+
simboloAnterior.tipo === delegua_1.default.IDENTIFICADOR &&
|
|
560
561
|
simboloAnterior.linha === simboloAtual.linha) {
|
|
561
|
-
this.erro(this.
|
|
562
|
+
this.erro(this.simbolos[this.atual], 'Não é permitido ter dois identificadores seguidos na mesma linha.');
|
|
562
563
|
}
|
|
563
564
|
}
|
|
564
565
|
return this.declaracaoExpressao();
|
|
@@ -568,81 +569,81 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
568
569
|
* @returns Um Construto do tipo Var.
|
|
569
570
|
*/
|
|
570
571
|
AvaliadorSintatico.prototype.declaracaoDeVariavel = function () {
|
|
571
|
-
var simbolo = this.consumir(
|
|
572
|
+
var simbolo = this.consumir(delegua_1.default.IDENTIFICADOR, 'Esperado nome de variável.');
|
|
572
573
|
var inicializador = null;
|
|
573
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
574
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.IGUAL)) {
|
|
574
575
|
inicializador = this.expressao();
|
|
575
576
|
}
|
|
576
577
|
return new declaracoes_1.Var(simbolo, inicializador);
|
|
577
578
|
};
|
|
578
579
|
AvaliadorSintatico.prototype.funcao = function (tipo) {
|
|
579
|
-
var simbolo = this.consumir(
|
|
580
|
+
var simbolo = this.consumir(delegua_1.default.IDENTIFICADOR, "Esperado nome ".concat(tipo, "."));
|
|
580
581
|
return new declaracoes_1.Funcao(simbolo, this.corpoDaFuncao(tipo));
|
|
581
582
|
};
|
|
582
583
|
AvaliadorSintatico.prototype.logicaComumParametros = function () {
|
|
583
584
|
var parametros = [];
|
|
584
585
|
do {
|
|
585
586
|
if (parametros.length >= 255) {
|
|
586
|
-
this.erro(this.
|
|
587
|
+
this.erro(this.simbolos[this.atual], 'Não pode haver mais de 255 parâmetros');
|
|
587
588
|
}
|
|
588
589
|
var parametro = {};
|
|
589
|
-
if (this.
|
|
590
|
-
this.consumir(
|
|
590
|
+
if (this.simbolos[this.atual].tipo === delegua_1.default.MULTIPLICACAO) {
|
|
591
|
+
this.consumir(delegua_1.default.MULTIPLICACAO, null);
|
|
591
592
|
parametro.tipo = 'estrela';
|
|
592
593
|
}
|
|
593
594
|
else {
|
|
594
595
|
parametro.tipo = 'padrao';
|
|
595
596
|
}
|
|
596
|
-
parametro.nome = this.consumir(
|
|
597
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
597
|
+
parametro.nome = this.consumir(delegua_1.default.IDENTIFICADOR, 'Esperado nome do parâmetro.');
|
|
598
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.IGUAL)) {
|
|
598
599
|
parametro.valorPadrao = this.primario();
|
|
599
600
|
}
|
|
600
601
|
parametros.push(parametro);
|
|
601
602
|
if (parametro.tipo === 'estrela')
|
|
602
603
|
break;
|
|
603
|
-
} while (this.verificarSeSimboloAtualEIgualA(
|
|
604
|
+
} while (this.verificarSeSimboloAtualEIgualA(delegua_1.default.VIRGULA));
|
|
604
605
|
return parametros;
|
|
605
606
|
};
|
|
606
607
|
AvaliadorSintatico.prototype.corpoDaFuncao = function (tipo) {
|
|
607
608
|
// O parêntese esquerdo é considerado o símbolo inicial para
|
|
608
609
|
// fins de pragma.
|
|
609
|
-
var parenteseEsquerdo = this.consumir(
|
|
610
|
+
var parenteseEsquerdo = this.consumir(delegua_1.default.PARENTESE_ESQUERDO, "Esperado '(' ap\u00F3s o nome ".concat(tipo, "."));
|
|
610
611
|
var parametros = [];
|
|
611
|
-
if (!this.verificarTipoSimboloAtual(
|
|
612
|
+
if (!this.verificarTipoSimboloAtual(delegua_1.default.PARENTESE_DIREITO)) {
|
|
612
613
|
parametros = this.logicaComumParametros();
|
|
613
614
|
}
|
|
614
|
-
this.consumir(
|
|
615
|
-
this.consumir(
|
|
615
|
+
this.consumir(delegua_1.default.PARENTESE_DIREITO, "Esperado ')' após parâmetros.");
|
|
616
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo do ".concat(tipo, "."));
|
|
616
617
|
var corpo = this.blocoEscopo();
|
|
617
618
|
return new construtos_1.Funcao(this.hashArquivo, Number(parenteseEsquerdo.linha), parametros, corpo);
|
|
618
619
|
};
|
|
619
620
|
AvaliadorSintatico.prototype.declaracaoDeClasse = function () {
|
|
620
|
-
var simbolo = this.consumir(
|
|
621
|
+
var simbolo = this.consumir(delegua_1.default.IDENTIFICADOR, 'Esperado nome da classe.');
|
|
621
622
|
var superClasse = null;
|
|
622
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
623
|
-
this.consumir(
|
|
624
|
-
superClasse = new construtos_1.Variavel(this.hashArquivo, this.
|
|
623
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.HERDA)) {
|
|
624
|
+
this.consumir(delegua_1.default.IDENTIFICADOR, 'Esperado nome da SuperClasse.');
|
|
625
|
+
superClasse = new construtos_1.Variavel(this.hashArquivo, this.simbolos[this.atual - 1]);
|
|
625
626
|
}
|
|
626
|
-
this.consumir(
|
|
627
|
+
this.consumir(delegua_1.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo da classe.");
|
|
627
628
|
var metodos = [];
|
|
628
|
-
while (!this.verificarTipoSimboloAtual(
|
|
629
|
+
while (!this.verificarTipoSimboloAtual(delegua_1.default.CHAVE_DIREITA) &&
|
|
629
630
|
!this.estaNoFinal()) {
|
|
630
631
|
metodos.push(this.funcao('método'));
|
|
631
632
|
}
|
|
632
|
-
this.consumir(
|
|
633
|
+
this.consumir(delegua_1.default.CHAVE_DIREITA, "Esperado '}' após o escopo da classe.");
|
|
633
634
|
return new declaracoes_1.Classe(simbolo, superClasse, metodos);
|
|
634
635
|
};
|
|
635
636
|
AvaliadorSintatico.prototype.declaracao = function () {
|
|
636
637
|
try {
|
|
637
|
-
if ((this.verificarTipoSimboloAtual(
|
|
638
|
-
this.verificarTipoSimboloAtual(
|
|
639
|
-
this.verificarTipoProximoSimbolo(
|
|
638
|
+
if ((this.verificarTipoSimboloAtual(delegua_1.default.FUNCAO) ||
|
|
639
|
+
this.verificarTipoSimboloAtual(delegua_1.default.FUNÇÃO)) &&
|
|
640
|
+
this.verificarTipoProximoSimbolo(delegua_1.default.IDENTIFICADOR)) {
|
|
640
641
|
this.avancarEDevolverAnterior();
|
|
641
642
|
return this.funcao('funcao');
|
|
642
643
|
}
|
|
643
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
644
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.VARIAVEL))
|
|
644
645
|
return this.declaracaoDeVariavel();
|
|
645
|
-
if (this.verificarSeSimboloAtualEIgualA(
|
|
646
|
+
if (this.verificarSeSimboloAtualEIgualA(delegua_1.default.CLASSE))
|
|
646
647
|
return this.declaracaoDeClasse();
|
|
647
648
|
return this.resolverDeclaracao();
|
|
648
649
|
}
|
|
@@ -659,19 +660,19 @@ var AvaliadorSintatico = /** @class */ (function () {
|
|
|
659
660
|
AvaliadorSintatico.prototype.sincronizar = function () {
|
|
660
661
|
this.avancarEDevolverAnterior();
|
|
661
662
|
while (!this.estaNoFinal()) {
|
|
662
|
-
var tipoSimboloAtual = this.
|
|
663
|
-
if (tipoSimboloAtual ===
|
|
663
|
+
var tipoSimboloAtual = this.simbolos[this.atual - 1].tipo;
|
|
664
|
+
if (tipoSimboloAtual === delegua_1.default.PONTO_E_VIRGULA)
|
|
664
665
|
return;
|
|
665
666
|
switch (tipoSimboloAtual) {
|
|
666
|
-
case
|
|
667
|
-
case
|
|
668
|
-
case
|
|
669
|
-
case
|
|
670
|
-
case
|
|
671
|
-
case
|
|
672
|
-
case
|
|
673
|
-
case
|
|
674
|
-
case
|
|
667
|
+
case delegua_1.default.CLASSE:
|
|
668
|
+
case delegua_1.default.FUNCAO:
|
|
669
|
+
case delegua_1.default.FUNÇÃO:
|
|
670
|
+
case delegua_1.default.VARIAVEL:
|
|
671
|
+
case delegua_1.default.PARA:
|
|
672
|
+
case delegua_1.default.SE:
|
|
673
|
+
case delegua_1.default.ENQUANTO:
|
|
674
|
+
case delegua_1.default.ESCREVA:
|
|
675
|
+
case delegua_1.default.RETORNA:
|
|
675
676
|
return;
|
|
676
677
|
}
|
|
677
678
|
this.avancarEDevolverAnterior();
|