@designliquido/delegua 0.9.2 → 0.9.4
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/delegua +1 -1
- package/bin/delegua.cmd +1 -1
- package/bin/package.json +3 -3
- package/coverage/lcov-report/sorter.js +4 -4
- package/coverage/lcov-report/sorter.js.map +1 -1
- package/execucao.d.ts +1 -0
- package/execucao.js +29 -0
- package/execucao.js.map +1 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.d.ts +1 -1
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js +108 -105
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -1
- package/fontes/avaliador-sintatico/avaliador-sintatico.d.ts +1 -1
- package/fontes/avaliador-sintatico/avaliador-sintatico.js +244 -256
- package/fontes/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-birl.d.ts +20 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-birl.js +68 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-birl.js.map +1 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js +227 -236
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.d.ts +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js +247 -257
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.d.ts +3 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js +192 -131
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js.map +1 -1
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.js +6 -24
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.js.map +1 -1
- package/fontes/bibliotecas/biblioteca-global.js +206 -367
- package/fontes/bibliotecas/biblioteca-global.js.map +1 -1
- package/fontes/bibliotecas/importar-biblioteca.js +28 -29
- package/fontes/bibliotecas/importar-biblioteca.js.map +1 -1
- package/fontes/bibliotecas/primitivas-texto.js +9 -22
- package/fontes/bibliotecas/primitivas-texto.js.map +1 -1
- package/fontes/bibliotecas/primitivas-vetor.js +12 -14
- package/fontes/bibliotecas/primitivas-vetor.js.map +1 -1
- package/fontes/construtos/acesso-indice-variavel.js +6 -50
- package/fontes/construtos/acesso-indice-variavel.js.map +1 -1
- package/fontes/construtos/acesso-metodo.js +6 -50
- package/fontes/construtos/acesso-metodo.js.map +1 -1
- package/fontes/construtos/agrupamento.js +6 -50
- package/fontes/construtos/agrupamento.js.map +1 -1
- package/fontes/construtos/atribuicao-sobrescrita.js +6 -50
- package/fontes/construtos/atribuicao-sobrescrita.js.map +1 -1
- package/fontes/construtos/atribuir.js +6 -50
- package/fontes/construtos/atribuir.js.map +1 -1
- package/fontes/construtos/binario.js +6 -50
- package/fontes/construtos/binario.js.map +1 -1
- package/fontes/construtos/chamada.js +6 -50
- package/fontes/construtos/chamada.js.map +1 -1
- package/fontes/construtos/definir-valor.js +6 -50
- package/fontes/construtos/definir-valor.js.map +1 -1
- package/fontes/construtos/dicionario.js +6 -50
- package/fontes/construtos/dicionario.js.map +1 -1
- package/fontes/construtos/funcao.d.ts +2 -2
- package/fontes/construtos/funcao.js +6 -47
- package/fontes/construtos/funcao.js.map +1 -1
- package/fontes/construtos/isto.js +6 -47
- package/fontes/construtos/isto.js.map +1 -1
- package/fontes/construtos/literal.js +6 -47
- package/fontes/construtos/literal.js.map +1 -1
- package/fontes/construtos/logico.js +6 -50
- package/fontes/construtos/logico.js.map +1 -1
- package/fontes/construtos/super.js +6 -47
- package/fontes/construtos/super.js.map +1 -1
- package/fontes/construtos/unario.js +6 -50
- package/fontes/construtos/unario.js.map +1 -1
- package/fontes/construtos/variavel.js +6 -47
- package/fontes/construtos/variavel.js.map +1 -1
- package/fontes/construtos/vetor.js +6 -50
- package/fontes/construtos/vetor.js.map +1 -1
- package/fontes/declaracoes/bloco.js +9 -70
- package/fontes/declaracoes/bloco.js.map +1 -1
- package/fontes/declaracoes/classe.js +11 -72
- package/fontes/declaracoes/classe.js.map +1 -1
- package/fontes/declaracoes/continua.js +8 -65
- package/fontes/declaracoes/continua.js.map +1 -1
- package/fontes/declaracoes/declaracao.js +6 -47
- package/fontes/declaracoes/declaracao.js.map +1 -1
- package/fontes/declaracoes/enquanto.js +10 -71
- package/fontes/declaracoes/enquanto.js.map +1 -1
- package/fontes/declaracoes/escolha.js +11 -72
- package/fontes/declaracoes/escolha.js.map +1 -1
- package/fontes/declaracoes/escreva.js +9 -70
- package/fontes/declaracoes/escreva.js.map +1 -1
- package/fontes/declaracoes/expressao.js +9 -70
- package/fontes/declaracoes/expressao.js.map +1 -1
- package/fontes/declaracoes/fazer.js +10 -71
- package/fontes/declaracoes/fazer.js.map +1 -1
- package/fontes/declaracoes/funcao.js +10 -68
- package/fontes/declaracoes/funcao.js.map +1 -1
- package/fontes/declaracoes/importar.js +10 -71
- package/fontes/declaracoes/importar.js.map +1 -1
- package/fontes/declaracoes/leia.js +9 -70
- package/fontes/declaracoes/leia.js.map +1 -1
- package/fontes/declaracoes/para.js +12 -73
- package/fontes/declaracoes/para.js.map +1 -1
- package/fontes/declaracoes/retorna.js +10 -71
- package/fontes/declaracoes/retorna.js.map +1 -1
- package/fontes/declaracoes/se.js +12 -73
- package/fontes/declaracoes/se.js.map +1 -1
- package/fontes/declaracoes/sustar.js +8 -65
- package/fontes/declaracoes/sustar.js.map +1 -1
- package/fontes/declaracoes/tente.js +12 -73
- package/fontes/declaracoes/tente.js.map +1 -1
- package/fontes/declaracoes/var.js +10 -71
- package/fontes/declaracoes/var.js.map +1 -1
- package/fontes/delegua.js +125 -206
- package/fontes/delegua.js.map +1 -1
- package/fontes/depuracao/cyrb53.js +3 -4
- package/fontes/depuracao/cyrb53.js.map +1 -1
- package/fontes/depuracao/servidor-depuracao.js +125 -209
- package/fontes/depuracao/servidor-depuracao.js.map +1 -1
- package/fontes/espaco-variaveis.js +3 -4
- package/fontes/espaco-variaveis.js.map +1 -1
- package/fontes/estruturas/chamavel.js +6 -9
- package/fontes/estruturas/chamavel.js.map +1 -1
- package/fontes/estruturas/classe-padrao.js +17 -35
- package/fontes/estruturas/classe-padrao.js.map +1 -1
- package/fontes/estruturas/delegua-classe.d.ts +2 -2
- package/fontes/estruturas/delegua-classe.js +21 -39
- package/fontes/estruturas/delegua-classe.js.map +1 -1
- package/fontes/estruturas/delegua-funcao.js +48 -114
- package/fontes/estruturas/delegua-funcao.js.map +1 -1
- package/fontes/estruturas/funcao-padrao.js +13 -75
- package/fontes/estruturas/funcao-padrao.js.map +1 -1
- package/fontes/estruturas/metodo-primitiva.js +11 -39
- package/fontes/estruturas/metodo-primitiva.js.map +1 -1
- package/fontes/estruturas/modulo.js +6 -7
- package/fontes/estruturas/modulo.js.map +1 -1
- package/fontes/estruturas/objeto-delegua-classe.d.ts +3 -3
- package/fontes/estruturas/objeto-delegua-classe.js +12 -13
- package/fontes/estruturas/objeto-delegua-classe.js.map +1 -1
- package/fontes/estruturas/objeto-padrao.js +9 -11
- package/fontes/estruturas/objeto-padrao.js.map +1 -1
- package/fontes/excecoes/erro-em-tempo-de-execucao.js +8 -26
- package/fontes/excecoes/erro-em-tempo-de-execucao.js.map +1 -1
- package/fontes/importador/importador.js +21 -22
- package/fontes/importador/importador.js.map +1 -1
- package/fontes/interfaces/avaliador-sintatico-interface.d.ts +1 -1
- package/fontes/interfaces/parametro-interface.d.ts +1 -1
- package/fontes/interpretador/dialetos/egua-classico.js +592 -1019
- package/fontes/interpretador/dialetos/egua-classico.js.map +1 -1
- package/fontes/interpretador/inferenciador.js +1 -1
- package/fontes/interpretador/inferenciador.js.map +1 -1
- package/fontes/interpretador/interpretador-com-depuracao.js +186 -336
- package/fontes/interpretador/interpretador-com-depuracao.js.map +1 -1
- package/fontes/interpretador/interpretador.js +706 -1175
- package/fontes/interpretador/interpretador.js.map +1 -1
- package/fontes/interpretador/pilha-escopos-execucao.js +52 -57
- package/fontes/interpretador/pilha-escopos-execucao.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-birl.d.ts +6 -19
- package/fontes/lexador/dialetos/lexador-birl.js +157 -49
- package/fontes/lexador/dialetos/lexador-birl.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-egua-classico.js +43 -46
- package/fontes/lexador/dialetos/lexador-egua-classico.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-eguap.js +59 -63
- package/fontes/lexador/dialetos/lexador-eguap.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-visualg.js +45 -54
- package/fontes/lexador/dialetos/lexador-visualg.js.map +1 -1
- package/fontes/lexador/dialetos/palavras-reservadas/birl.d.ts +14 -1
- package/fontes/lexador/dialetos/palavras-reservadas/birl.js +18 -1
- package/fontes/lexador/dialetos/palavras-reservadas/birl.js.map +1 -1
- package/fontes/lexador/dialetos/palavras-reservadas/egua-classico.js +1 -1
- package/fontes/lexador/dialetos/palavras-reservadas/egua-classico.js.map +1 -1
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.d.ts +24 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js +25 -1
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js.map +1 -1
- package/fontes/lexador/lexador-base-linha-unica.d.ts +1 -1
- package/fontes/lexador/lexador-base-linha-unica.js +28 -29
- package/fontes/lexador/lexador-base-linha-unica.js.map +1 -1
- package/fontes/lexador/lexador.js +53 -57
- package/fontes/lexador/lexador.js.map +1 -1
- package/fontes/lexador/palavras-reservadas.js +1 -1
- package/fontes/lexador/palavras-reservadas.js.map +1 -1
- package/fontes/lexador/simbolo.js +5 -6
- package/fontes/lexador/simbolo.js.map +1 -1
- package/fontes/quebras/index.js +11 -42
- package/fontes/quebras/index.js.map +1 -1
- package/fontes/resolvedor/dialetos/egua-classico.js +143 -144
- package/fontes/resolvedor/dialetos/egua-classico.js.map +1 -1
- package/fontes/resolvedor/erro-resolvedor.js +6 -24
- package/fontes/resolvedor/erro-resolvedor.js.map +1 -1
- package/fontes/resolvedor/pilha-escopos.js +11 -12
- package/fontes/resolvedor/pilha-escopos.js.map +1 -1
- package/fontes/tipos-de-simbolos/birl.d.ts +7 -0
- package/fontes/tipos-de-simbolos/birl.js +20 -12
- package/fontes/tipos-de-simbolos/birl.js.map +1 -1
- package/fontes/tipos-de-simbolos/comum.d.ts +2 -0
- package/fontes/tipos-de-simbolos/comum.js +2 -0
- package/fontes/tipos-de-simbolos/comum.js.map +1 -1
- package/fontes/tipos-de-simbolos/visualg.d.ts +9 -0
- package/fontes/tipos-de-simbolos/visualg.js +9 -0
- package/fontes/tipos-de-simbolos/visualg.js.map +1 -1
- package/index.d.ts +5 -1
- package/index.js +18 -25
- package/index.js.map +1 -1
- package/jest.config.js +9 -47
- package/jest.config.js.map +1 -1
- package/package.json +3 -3
- package/testes/__mocks__/estatistica.js +1 -1
- package/testes/__mocks__/estatistica.js.map +1 -1
- package/testes/__mocks__/fisica.js +1 -1
- package/testes/__mocks__/fisica.js.map +1 -1
- package/testes/__mocks__/matematica.js +1 -1
- package/testes/__mocks__/matematica.js.map +1 -1
- package/testes/avaliador-sintatico.test.js +27 -27
- package/testes/avaliador-sintatico.test.js.map +1 -1
- package/testes/biblioteca-global.test.js +197 -440
- package/testes/biblioteca-global.test.js.map +1 -1
- package/testes/birl/avaliador-sintatico.test.d.ts +1 -0
- package/testes/birl/avaliador-sintatico.test.js +18 -0
- package/testes/birl/avaliador-sintatico.test.js.map +1 -0
- package/testes/birl/lexador.test.d.ts +1 -0
- package/testes/birl/lexador.test.js +31 -0
- package/testes/birl/lexador.test.js.map +1 -0
- package/testes/delegua.test.js +7 -7
- package/testes/delegua.test.js.map +1 -1
- package/testes/egua-classico/avaliador-sintatico.test.js +14 -14
- package/testes/egua-classico/avaliador-sintatico.test.js.map +1 -1
- package/testes/egua-classico/delegua.test.js +5 -5
- package/testes/egua-classico/delegua.test.js.map +1 -1
- package/testes/egua-classico/interpretador.test.js +180 -396
- package/testes/egua-classico/interpretador.test.js.map +1 -1
- package/testes/egua-classico/lexador.test.js +23 -23
- package/testes/egua-classico/lexador.test.js.map +1 -1
- package/testes/egua-classico/resolvedor.test.js +12 -12
- package/testes/egua-classico/resolvedor.test.js.map +1 -1
- package/testes/eguap/avaliador-sintatico.test.js +11 -11
- package/testes/eguap/avaliador-sintatico.test.js.map +1 -1
- package/testes/eguap/interpretador.test.js +189 -405
- package/testes/eguap/interpretador.test.js.map +1 -1
- package/testes/eguap/lexador.test.js +18 -18
- package/testes/eguap/lexador.test.js.map +1 -1
- package/testes/interpretador.test.js +431 -908
- package/testes/interpretador.test.js.map +1 -1
- package/testes/lexador.test.js +42 -42
- package/testes/lexador.test.js.map +1 -1
- package/testes/visualg/avaliador-sintatico.test.js +23 -23
- package/testes/visualg/avaliador-sintatico.test.js.map +1 -1
- package/testes/visualg/interpretador.test.js +16 -61
- package/testes/visualg/interpretador.test.js.map +1 -1
- package/testes/visualg/lexador.test.js +15 -15
- package/testes/visualg/lexador.test.js.map +1 -1
|
@@ -1,44 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ClassePadrao = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const chamavel_1 = require("./chamavel");
|
|
5
|
+
const objeto_padrao_1 = require("./objeto-padrao");
|
|
21
6
|
/**
|
|
22
7
|
* Classe de importação de classes de bibliotecas do JavaScript.
|
|
23
8
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_this.metodos = {};
|
|
31
|
-
return _this;
|
|
9
|
+
class ClassePadrao extends chamavel_1.Chamavel {
|
|
10
|
+
constructor(nome, funcaoDeClasse) {
|
|
11
|
+
super();
|
|
12
|
+
this.nome = nome;
|
|
13
|
+
this.funcaoDeClasse = funcaoDeClasse;
|
|
14
|
+
this.metodos = {};
|
|
32
15
|
}
|
|
33
|
-
|
|
16
|
+
encontrarMetodo(nome) {
|
|
34
17
|
if (this.metodos.hasOwnProperty(nome)) {
|
|
35
18
|
return this.metodos[nome];
|
|
36
19
|
}
|
|
37
20
|
return undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
}
|
|
21
|
+
}
|
|
22
|
+
paraTexto() {
|
|
23
|
+
return `<classe-padrão ${this.nome}>`;
|
|
24
|
+
}
|
|
42
25
|
/**
|
|
43
26
|
* Para o caso de uma classe padrão, chamá-la na verdade é
|
|
44
27
|
* invocar o construtor e adicionar no corpo de propriedades
|
|
@@ -46,13 +29,12 @@ var ClassePadrao = /** @class */ (function (_super) {
|
|
|
46
29
|
* @param argumentos
|
|
47
30
|
* @param simbolo
|
|
48
31
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
chamar(argumentos, simbolo) {
|
|
33
|
+
const novoObjeto = new objeto_padrao_1.ObjetoPadrao(this.nome);
|
|
51
34
|
this.funcaoDeClasse.apply(novoObjeto, argumentos);
|
|
52
35
|
Object.assign(novoObjeto, this.metodos);
|
|
53
36
|
return novoObjeto;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}(chamavel_1.Chamavel));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
57
39
|
exports.ClassePadrao = ClassePadrao;
|
|
58
40
|
//# sourceMappingURL=classe-padrao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classe-padrao.js","sourceRoot":"","sources":["../../../fontes/estruturas/classe-padrao.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"classe-padrao.js","sourceRoot":"","sources":["../../../fontes/estruturas/classe-padrao.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,mDAA+C;AAE/C;;GAEG;AACH,MAAa,YAAa,SAAQ,mBAAQ;IAKtC,YAAY,IAAY,EAAE,cAAwB;QAC9C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,eAAe,CAAC,IAAY;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;YACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC7B;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,SAAS;QACL,OAAO,kBAAkB,IAAI,CAAC,IAAI,GAAG,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAiB,EAAE,OAAY;QAClC,MAAM,UAAU,GAAiB,IAAI,4BAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AArCD,oCAqCC"}
|
|
@@ -11,6 +11,6 @@ export declare class DeleguaClasse extends Chamavel {
|
|
|
11
11
|
constructor(nome?: string, superClasse?: any, metodos?: any);
|
|
12
12
|
encontrarMetodo(nome: string): DeleguaFuncao;
|
|
13
13
|
paraTexto(): string;
|
|
14
|
-
aridade():
|
|
15
|
-
chamar(interpretador: InterpretadorInterface, argumentos: any): ObjetoDeleguaClasse;
|
|
14
|
+
aridade(): number;
|
|
15
|
+
chamar(interpretador: InterpretadorInterface, argumentos: any[]): ObjetoDeleguaClasse;
|
|
16
16
|
}
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.DeleguaClasse = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_this.metodos = metodos;
|
|
28
|
-
return _this;
|
|
4
|
+
const chamavel_1 = require("./chamavel");
|
|
5
|
+
const objeto_delegua_classe_1 = require("./objeto-delegua-classe");
|
|
6
|
+
class DeleguaClasse extends chamavel_1.Chamavel {
|
|
7
|
+
constructor(nome, superClasse, metodos) {
|
|
8
|
+
super();
|
|
9
|
+
this.nome = nome;
|
|
10
|
+
this.superClasse = superClasse;
|
|
11
|
+
this.metodos = metodos;
|
|
29
12
|
}
|
|
30
|
-
|
|
13
|
+
encontrarMetodo(nome) {
|
|
31
14
|
if (this.metodos.hasOwnProperty(nome)) {
|
|
32
15
|
return this.metodos[nome];
|
|
33
16
|
}
|
|
@@ -35,25 +18,24 @@ var DeleguaClasse = /** @class */ (function (_super) {
|
|
|
35
18
|
return this.superClasse.encontrarMetodo(nome);
|
|
36
19
|
}
|
|
37
20
|
return undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
21
|
+
}
|
|
22
|
+
paraTexto() {
|
|
23
|
+
return `<classe ${this.nome}>`;
|
|
24
|
+
}
|
|
25
|
+
aridade() {
|
|
26
|
+
const inicializador = this.encontrarMetodo('construtor');
|
|
44
27
|
return inicializador ? inicializador.aridade() : 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
}
|
|
29
|
+
chamar(interpretador, argumentos) {
|
|
30
|
+
const instancia = new objeto_delegua_classe_1.ObjetoDeleguaClasse(this);
|
|
31
|
+
const inicializador = this.encontrarMetodo('construtor');
|
|
49
32
|
if (inicializador) {
|
|
50
33
|
inicializador
|
|
51
34
|
.definirInstancia(instancia)
|
|
52
35
|
.chamar(interpretador, argumentos);
|
|
53
36
|
}
|
|
54
37
|
return instancia;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}(chamavel_1.Chamavel));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
58
40
|
exports.DeleguaClasse = DeleguaClasse;
|
|
59
41
|
//# sourceMappingURL=delegua-classe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegua-classe.js","sourceRoot":"","sources":["../../../fontes/estruturas/delegua-classe.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delegua-classe.js","sourceRoot":"","sources":["../../../fontes/estruturas/delegua-classe.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAEtC,mEAA8D;AAE9D,MAAa,aAAc,SAAQ,mBAAQ;IAKvC,YAAY,IAAa,EAAE,WAAiB,EAAE,OAAa;QACvD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,eAAe,CAAC,IAAY;QACxB,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;YACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC7B;QAED,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE;YAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;SACjD;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,SAAS;QACL,OAAO,WAAW,IAAI,CAAC,IAAI,GAAG,CAAC;IACnC,CAAC;IAED,OAAO;QACH,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACzD,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CACF,aAAqC,EACrC,UAAiB;QAEjB,MAAM,SAAS,GAAG,IAAI,2CAAmB,CAAC,IAAI,CAAC,CAAC;QAEhD,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,aAAa,EAAE;YACf,aAAa;iBACR,gBAAgB,CAAC,SAAS,CAAC;iBAC3B,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;SAC1C;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAhDD,sCAgDC"}
|
|
@@ -1,126 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.DeleguaFuncao = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_this.declaracao = declaracao;
|
|
66
|
-
_this.instancia = instancia;
|
|
67
|
-
_this.eInicializador = eInicializador;
|
|
68
|
-
return _this;
|
|
4
|
+
const chamavel_1 = require("./chamavel");
|
|
5
|
+
const espaco_variaveis_1 = require("../espaco-variaveis");
|
|
6
|
+
const quebras_1 = require("../quebras");
|
|
7
|
+
class DeleguaFuncao extends chamavel_1.Chamavel {
|
|
8
|
+
constructor(nome, declaracao, instancia = undefined, eInicializador = false) {
|
|
9
|
+
super();
|
|
10
|
+
this.nome = nome;
|
|
11
|
+
this.declaracao = declaracao;
|
|
12
|
+
this.instancia = instancia;
|
|
13
|
+
this.eInicializador = eInicializador;
|
|
69
14
|
}
|
|
70
|
-
|
|
15
|
+
aridade() {
|
|
71
16
|
var _a, _b;
|
|
72
17
|
return ((_b = (_a = this.declaracao) === null || _a === void 0 ? void 0 : _a.parametros) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
18
|
+
}
|
|
19
|
+
paraTexto() {
|
|
75
20
|
if (this.nome === null)
|
|
76
21
|
return '<função>';
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
valor = argumentos[i];
|
|
92
|
-
if (argumentos[i] === null) {
|
|
93
|
-
valor = parametro['padrao']
|
|
94
|
-
? parametro['padrao'].valor
|
|
95
|
-
: null;
|
|
96
|
-
}
|
|
97
|
-
ambiente.valores[nome] = valor;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (this.instancia !== undefined) {
|
|
101
|
-
ambiente.valores['isto'] = {
|
|
102
|
-
valor: this.instancia,
|
|
103
|
-
tipo: 'objeto',
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return [4 /*yield*/, interpretador.executarBloco(this.declaracao.corpo, ambiente)];
|
|
107
|
-
case 1:
|
|
108
|
-
retornoBloco = _a.sent();
|
|
109
|
-
if (retornoBloco instanceof quebras_1.RetornoQuebra) {
|
|
110
|
-
return [2 /*return*/, retornoBloco.valor];
|
|
111
|
-
}
|
|
112
|
-
if (this.eInicializador) {
|
|
113
|
-
return [2 /*return*/, this.instancia];
|
|
114
|
-
}
|
|
115
|
-
return [2 /*return*/, retornoBloco];
|
|
22
|
+
return `<função ${this.nome}>`;
|
|
23
|
+
}
|
|
24
|
+
async chamar(interpretador, argumentos) {
|
|
25
|
+
const ambiente = new espaco_variaveis_1.EspacoVariaveis();
|
|
26
|
+
const parametros = this.declaracao.parametros;
|
|
27
|
+
if (parametros && parametros.length) {
|
|
28
|
+
for (let i = 0; i < parametros.length; i++) {
|
|
29
|
+
const parametro = parametros[i];
|
|
30
|
+
const nome = parametro['nome'].lexema;
|
|
31
|
+
let valor = argumentos[i];
|
|
32
|
+
if (argumentos[i] === null) {
|
|
33
|
+
valor = parametro['padrao']
|
|
34
|
+
? parametro['padrao'].valor
|
|
35
|
+
: null;
|
|
116
36
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
37
|
+
ambiente.valores[nome] = valor;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (this.instancia !== undefined) {
|
|
41
|
+
ambiente.valores['isto'] = {
|
|
42
|
+
valor: this.instancia,
|
|
43
|
+
tipo: 'objeto',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const retornoBloco = await interpretador.executarBloco(this.declaracao.corpo, ambiente);
|
|
47
|
+
if (retornoBloco instanceof quebras_1.RetornoQuebra) {
|
|
48
|
+
return retornoBloco.valor;
|
|
49
|
+
}
|
|
50
|
+
if (this.eInicializador) {
|
|
51
|
+
return this.instancia;
|
|
52
|
+
}
|
|
53
|
+
return retornoBloco;
|
|
54
|
+
}
|
|
55
|
+
definirInstancia(instancia) {
|
|
121
56
|
return new DeleguaFuncao(this.nome, this.declaracao, instancia, this.eInicializador);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
}(chamavel_1.Chamavel));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
125
59
|
exports.DeleguaFuncao = DeleguaFuncao;
|
|
126
60
|
//# sourceMappingURL=delegua-funcao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegua-funcao.js","sourceRoot":"","sources":["../../../fontes/estruturas/delegua-funcao.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delegua-funcao.js","sourceRoot":"","sources":["../../../fontes/estruturas/delegua-funcao.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,0DAAsD;AAGtD,wCAA2C;AAI3C,MAAa,aAAc,SAAQ,mBAAQ;IAMvC,YACI,IAAY,EACZ,UAA2B,EAC3B,YAAiC,SAAS,EAC1C,cAAc,GAAG,KAAK;QAEtB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAED,OAAO;;QACH,OAAO,CAAA,MAAA,MAAA,IAAI,CAAC,UAAU,0CAAE,UAAU,0CAAE,MAAM,KAAI,CAAC,CAAC;IACpD,CAAC;IAED,SAAS;QACL,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,UAAU,CAAC;QAC1C,OAAO,WAAW,IAAI,CAAC,IAAI,GAAG,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,aAAqC,EAAE,UAAe;QAC/D,MAAM,QAAQ,GAAG,IAAI,kCAAe,EAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAE9C,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,EAAE;YACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACxC,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;gBAEhC,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;gBACtC,IAAI,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;oBACxB,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC;wBACvB,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,KAAK;wBAC3B,CAAC,CAAC,IAAI,CAAC;iBACd;gBAED,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;aAClC;SACJ;QAED,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;YAC9B,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;gBACvB,KAAK,EAAE,IAAI,CAAC,SAAS;gBACrB,IAAI,EAAE,QAAQ;aACjB,CAAC;SACL;QAED,MAAM,YAAY,GAAQ,MAAM,aAAa,CAAC,aAAa,CACvD,IAAI,CAAC,UAAU,CAAC,KAAK,EACrB,QAAQ,CACX,CAAC;QACF,IAAI,YAAY,YAAY,uBAAa,EAAE;YACvC,OAAO,YAAY,CAAC,KAAK,CAAC;SAC7B;QAED,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,OAAO,IAAI,CAAC,SAAS,CAAC;SACzB;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;IAED,gBAAgB,CAAC,SAA8B;QAC3C,OAAO,IAAI,aAAa,CACpB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,UAAU,EACf,SAAS,EACT,IAAI,CAAC,cAAc,CACtB,CAAC;IACN,CAAC;CACJ;AA9ED,sCA8EC"}
|
|
@@ -1,85 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
3
|
exports.FuncaoPadrao = void 0;
|
|
55
|
-
|
|
4
|
+
const chamavel_1 = require("./chamavel");
|
|
56
5
|
/**
|
|
57
6
|
* Uma `FuncaoPadrao` normalmente é uma função em JavaScript.
|
|
58
7
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
8
|
+
class FuncaoPadrao extends chamavel_1.Chamavel {
|
|
9
|
+
constructor(valorAridade, funcao) {
|
|
10
|
+
super();
|
|
11
|
+
this.valorAridade = valorAridade;
|
|
12
|
+
this.funcao = funcao;
|
|
13
|
+
}
|
|
14
|
+
async chamar(argumentos, simbolo) {
|
|
15
|
+
this.simbolo = simbolo;
|
|
16
|
+
return await this.funcao.apply(this, argumentos);
|
|
66
17
|
}
|
|
67
|
-
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
return __generator(this, function (_a) {
|
|
70
|
-
switch (_a.label) {
|
|
71
|
-
case 0:
|
|
72
|
-
this.simbolo = simbolo;
|
|
73
|
-
return [4 /*yield*/, this.funcao.apply(this, argumentos)];
|
|
74
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
FuncaoPadrao.prototype.paraTexto = function () {
|
|
18
|
+
paraTexto() {
|
|
80
19
|
return '<função>';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}(chamavel_1.Chamavel));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
84
22
|
exports.FuncaoPadrao = FuncaoPadrao;
|
|
85
23
|
//# sourceMappingURL=funcao-padrao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funcao-padrao.js","sourceRoot":"","sources":["../../../fontes/estruturas/funcao-padrao.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"funcao-padrao.js","sourceRoot":"","sources":["../../../fontes/estruturas/funcao-padrao.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC;;GAEG;AACH,MAAa,YAAa,SAAQ,mBAAQ;IAKtC,YAAY,YAAoB,EAAE,MAAgB;QAC9C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAiB,EAAE,OAAY;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;IAED,SAAS;QACL,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAnBD,oCAmBC"}
|
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
-
if (ar || !(i in from)) {
|
|
20
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
-
ar[i] = from[i];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
-
};
|
|
26
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
3
|
exports.MetodoPrimitiva = void 0;
|
|
28
|
-
|
|
4
|
+
const chamavel_1 = require("./chamavel");
|
|
29
5
|
/**
|
|
30
6
|
* Classe de método de primitiva.
|
|
31
7
|
* Exemplos:
|
|
@@ -36,20 +12,16 @@ var chamavel_1 = require("./chamavel");
|
|
|
36
12
|
* A aridade é sempre a quantidade de argumentos do método menos um porque o
|
|
37
13
|
* primeiro parâmetro é sempre a referência para a primitiva.
|
|
38
14
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
15
|
+
class MetodoPrimitiva extends chamavel_1.Chamavel {
|
|
16
|
+
constructor(primitiva, metodo) {
|
|
17
|
+
super();
|
|
18
|
+
this.primitiva = primitiva;
|
|
19
|
+
this.metodo = metodo;
|
|
20
|
+
this.valorAridade = metodo.length - 1;
|
|
21
|
+
}
|
|
22
|
+
chamar(argumentos = []) {
|
|
23
|
+
return this.metodo(this.primitiva, ...argumentos);
|
|
47
24
|
}
|
|
48
|
-
|
|
49
|
-
if (argumentos === void 0) { argumentos = []; }
|
|
50
|
-
return this.metodo.apply(this, __spreadArray([this.primitiva], argumentos, false));
|
|
51
|
-
};
|
|
52
|
-
return MetodoPrimitiva;
|
|
53
|
-
}(chamavel_1.Chamavel));
|
|
25
|
+
}
|
|
54
26
|
exports.MetodoPrimitiva = MetodoPrimitiva;
|
|
55
27
|
//# sourceMappingURL=metodo-primitiva.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metodo-primitiva.js","sourceRoot":"","sources":["../../../fontes/estruturas/metodo-primitiva.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metodo-primitiva.js","sourceRoot":"","sources":["../../../fontes/estruturas/metodo-primitiva.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC;;;;;;;;;GASG;AACH,MAAa,eAAgB,SAAQ,mBAAQ;IAIzC,YAAY,SAAc,EAAE,MAAgB;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,aAAoB,EAAE;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,UAAU,CAAC,CAAC;IACtD,CAAC;CACJ;AAdD,0CAcC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleguaModulo = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class DeleguaModulo {
|
|
5
|
+
constructor(nome) {
|
|
6
6
|
this.nome = nome || '';
|
|
7
7
|
this.componentes = {};
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
return this.nome ?
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
}());
|
|
9
|
+
toString() {
|
|
10
|
+
return this.nome ? `<modulo ${this.nome}>` : '<modulo>';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
14
13
|
exports.DeleguaModulo = DeleguaModulo;
|
|
15
14
|
//# sourceMappingURL=modulo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modulo.js","sourceRoot":"","sources":["../../../fontes/estruturas/modulo.ts"],"names":[],"mappings":";;;AAEA;
|
|
1
|
+
{"version":3,"file":"modulo.js","sourceRoot":"","sources":["../../../fontes/estruturas/modulo.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAItB,YAAY,IAAa;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5D,CAAC;CACJ;AAZD,sCAYC"}
|
|
@@ -3,8 +3,8 @@ import { DeleguaClasse } from './delegua-classe';
|
|
|
3
3
|
export declare class ObjetoDeleguaClasse {
|
|
4
4
|
classe: DeleguaClasse;
|
|
5
5
|
campos: any;
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
constructor(classe: any);
|
|
7
|
+
obter(simbolo: SimboloInterface): any;
|
|
8
|
+
definir(simbolo: SimboloInterface, valor: any): void;
|
|
9
9
|
toString(): string;
|
|
10
10
|
}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjetoDeleguaClasse = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.classe =
|
|
4
|
+
const excecoes_1 = require("../excecoes");
|
|
5
|
+
class ObjetoDeleguaClasse {
|
|
6
|
+
constructor(classe) {
|
|
7
|
+
this.classe = classe;
|
|
8
8
|
this.campos = {};
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
obter(simbolo) {
|
|
11
11
|
if (this.campos.hasOwnProperty(simbolo.lexema)) {
|
|
12
12
|
return this.campos[simbolo.lexema];
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
const metodo = this.classe.encontrarMetodo(simbolo.lexema);
|
|
15
15
|
if (metodo)
|
|
16
16
|
return metodo.definirInstancia(this);
|
|
17
17
|
throw new excecoes_1.ErroEmTempoDeExecucao(simbolo, 'Método indefinido não recuperado.');
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
definir(simbolo, valor) {
|
|
20
20
|
this.campos[simbolo.lexema] = valor;
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
23
|
return '<Objeto ' + this.classe.nome + '>';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
}());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
27
26
|
exports.ObjetoDeleguaClasse = ObjetoDeleguaClasse;
|
|
28
27
|
//# sourceMappingURL=objeto-delegua-classe.js.map
|