@designliquido/delegua 0.0.2 → 0.1.3

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.
Files changed (146) hide show
  1. package/README.md +9 -1
  2. package/bin/delegua +1 -1
  3. package/bin/delegua.cmd +1 -1
  4. package/bin/package.json +51 -0
  5. package/index.js +27 -0
  6. package/index.js.map +1 -0
  7. package/package.json +10 -5
  8. package/src/ambiente.js +34 -38
  9. package/src/ambiente.js.map +1 -0
  10. package/src/avaliador-sintatico/dialetos/egua-classico.js +635 -0
  11. package/src/avaliador-sintatico/dialetos/egua-classico.js.map +1 -0
  12. package/src/avaliador-sintatico/dialetos/index.js +14 -0
  13. package/src/avaliador-sintatico/dialetos/index.js.map +1 -0
  14. package/src/avaliador-sintatico/index.js +635 -0
  15. package/src/avaliador-sintatico/index.js.map +1 -0
  16. package/src/avaliador-sintatico/parser-error.js +27 -0
  17. package/src/avaliador-sintatico/parser-error.js.map +1 -0
  18. package/src/bibliotecas/bibliotecaGlobal.js +97 -0
  19. package/src/bibliotecas/bibliotecaGlobal.js.map +1 -0
  20. package/src/bibliotecas/importarBiblioteca.js +32 -0
  21. package/src/bibliotecas/importarBiblioteca.js.map +1 -0
  22. package/src/construtos/assign-subscript.js +35 -0
  23. package/src/construtos/assign-subscript.js.map +1 -0
  24. package/src/construtos/atribuir.js +34 -0
  25. package/src/construtos/atribuir.js.map +1 -0
  26. package/src/construtos/binario.js +35 -0
  27. package/src/construtos/binario.js.map +1 -0
  28. package/src/construtos/call.js +35 -0
  29. package/src/construtos/call.js.map +1 -0
  30. package/src/construtos/conjunto.js +35 -0
  31. package/src/construtos/conjunto.js.map +1 -0
  32. package/src/construtos/dicionario.js +34 -0
  33. package/src/construtos/dicionario.js.map +1 -0
  34. package/src/construtos/expr.js +11 -0
  35. package/src/construtos/expr.js.map +1 -0
  36. package/src/construtos/funcao.js +34 -0
  37. package/src/construtos/funcao.js.map +1 -0
  38. package/src/construtos/get.js +34 -0
  39. package/src/construtos/get.js.map +1 -0
  40. package/src/construtos/grouping.js +33 -0
  41. package/src/construtos/grouping.js.map +1 -0
  42. package/src/construtos/index.js +31 -0
  43. package/src/construtos/index.js.map +1 -0
  44. package/src/construtos/isto.js +33 -0
  45. package/src/construtos/isto.js.map +1 -0
  46. package/src/construtos/literal.js +33 -0
  47. package/src/construtos/literal.js.map +1 -0
  48. package/src/construtos/logical.js +35 -0
  49. package/src/construtos/logical.js.map +1 -0
  50. package/src/construtos/subscript.js +35 -0
  51. package/src/construtos/subscript.js.map +1 -0
  52. package/src/construtos/super.js +34 -0
  53. package/src/construtos/super.js.map +1 -0
  54. package/src/construtos/unario.js +34 -0
  55. package/src/construtos/unario.js.map +1 -0
  56. package/src/construtos/variavel.js +33 -0
  57. package/src/construtos/variavel.js.map +1 -0
  58. package/src/construtos/vetor.js +33 -0
  59. package/src/construtos/vetor.js.map +1 -0
  60. package/src/declaracoes/index.js +249 -0
  61. package/src/declaracoes/index.js.map +1 -0
  62. package/src/delegua.js +110 -83
  63. package/src/delegua.js.map +1 -0
  64. package/src/estruturas/callable.js +15 -4
  65. package/src/estruturas/callable.js.map +1 -0
  66. package/src/estruturas/classe.js +44 -30
  67. package/src/estruturas/classe.js.map +1 -0
  68. package/src/estruturas/funcao-padrao.js +38 -0
  69. package/src/estruturas/funcao-padrao.js.map +1 -0
  70. package/src/estruturas/funcao.js +71 -52
  71. package/src/estruturas/funcao.js.map +1 -0
  72. package/src/estruturas/index.js +19 -0
  73. package/src/estruturas/index.js.map +1 -0
  74. package/src/estruturas/instancia.js +23 -22
  75. package/src/estruturas/instancia.js.map +1 -0
  76. package/src/estruturas/modulo.js +14 -8
  77. package/src/estruturas/modulo.js.map +1 -0
  78. package/src/excecoes/break-exception.js +27 -0
  79. package/src/excecoes/break-exception.js.map +1 -0
  80. package/src/excecoes/continue-exception.js +27 -0
  81. package/src/excecoes/continue-exception.js.map +1 -0
  82. package/src/excecoes/erro-em-tempo-de-execucao.js +31 -0
  83. package/src/excecoes/erro-em-tempo-de-execucao.js.map +1 -0
  84. package/src/excecoes/index.js +17 -0
  85. package/src/excecoes/index.js.map +1 -0
  86. package/src/excecoes/return-exception.js +30 -0
  87. package/src/excecoes/return-exception.js.map +1 -0
  88. package/src/interfaces/avaliador-sintatico-interface.js +3 -0
  89. package/src/interfaces/avaliador-sintatico-interface.js.map +1 -0
  90. package/src/interfaces/index.js +19 -0
  91. package/src/interfaces/index.js.map +1 -0
  92. package/src/interfaces/interpretador-interface.js +3 -0
  93. package/src/interfaces/interpretador-interface.js.map +1 -0
  94. package/src/interfaces/lexador-interface.js +3 -0
  95. package/src/interfaces/lexador-interface.js.map +1 -0
  96. package/src/interfaces/pilha-interface.js +3 -0
  97. package/src/interfaces/pilha-interface.js.map +1 -0
  98. package/src/interfaces/resolvedor-interface.js +3 -0
  99. package/src/interfaces/resolvedor-interface.js.map +1 -0
  100. package/src/interfaces/simbolo-interface.js +3 -0
  101. package/src/interfaces/simbolo-interface.js.map +1 -0
  102. package/src/interpretador/dialetos/egua-classico.js +656 -0
  103. package/src/interpretador/dialetos/egua-classico.js.map +1 -0
  104. package/src/interpretador/dialetos/index.js +14 -0
  105. package/src/interpretador/dialetos/index.js.map +1 -0
  106. package/src/interpretador/index.js +665 -0
  107. package/src/interpretador/index.js.map +1 -0
  108. package/src/lexador/dialetos/egua-classico.js +287 -0
  109. package/src/lexador/dialetos/egua-classico.js.map +1 -0
  110. package/src/lexador/dialetos/index.js +14 -0
  111. package/src/lexador/dialetos/index.js.map +1 -0
  112. package/src/lexador/index.js +287 -0
  113. package/src/lexador/index.js.map +1 -0
  114. package/src/resolvedor/Pilha.js +27 -0
  115. package/src/resolvedor/Pilha.js.map +1 -0
  116. package/src/resolvedor/ResolverError.js +29 -0
  117. package/src/resolvedor/ResolverError.js.map +1 -0
  118. package/src/resolvedor/dialetos/egua-classico.js +331 -0
  119. package/src/resolvedor/dialetos/egua-classico.js.map +1 -0
  120. package/src/resolvedor/dialetos/index.js +14 -0
  121. package/src/resolvedor/dialetos/index.js.map +1 -0
  122. package/src/resolvedor/index.js +331 -0
  123. package/src/resolvedor/index.js.map +1 -0
  124. package/src/tiposDeSimbolos.js +25 -23
  125. package/src/tiposDeSimbolos.js.map +1 -0
  126. package/src/web.js +64 -68
  127. package/src/web.js.map +1 -0
  128. package/.github/CONTRIBUTING.md +0 -0
  129. package/.github/workflows/principal.yml +0 -20
  130. package/.release-it.json +0 -8
  131. package/.vscode/launch.json +0 -29
  132. package/.vscode/settings.json +0 -3
  133. package/LICENSE +0 -21
  134. package/babel.config.js +0 -1
  135. package/indice.js +0 -14
  136. package/src/erro.js +0 -18
  137. package/src/estruturas/funcaoPadrao.js +0 -18
  138. package/src/expr.js +0 -228
  139. package/src/interpretador.js +0 -802
  140. package/src/lexer.js +0 -316
  141. package/src/lib/globalLib.js +0 -171
  142. package/src/lib/importStdlib.js +0 -32
  143. package/src/parser.js +0 -822
  144. package/src/resolver.js +0 -425
  145. package/src/stmt.js +0 -215
  146. package/testes/testes.egua +0 -630
package/src/delegua.js CHANGED
@@ -1,102 +1,129 @@
1
- const Lexer = require("./lexer.js");
2
- const Parser = require("./parser.js");
3
- const Resolver = require("./resolver.js");
4
- const Interpretador = require("./interpretador.js");
5
- const tiposDeSimbolos = require("./tiposDeSimbolos.js");
6
- const fs = require("fs");
7
- const caminho = require("path");
8
- const readline = require("readline");
9
-
10
- module.exports.Delegua = class Delegua {
11
- constructor(nomeArquivo) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Delegua = void 0;
4
+ var fs = require("fs");
5
+ var caminho = require("path");
6
+ var readline = require("readline");
7
+ var lexador_1 = require("./lexador");
8
+ var avaliador_sintatico_1 = require("./avaliador-sintatico");
9
+ var resolvedor_1 = require("./resolvedor");
10
+ var interpretador_1 = require("./interpretador");
11
+ var tiposDeSimbolos_1 = require("./tiposDeSimbolos");
12
+ var excecoes_1 = require("./excecoes");
13
+ var egua_classico_1 = require("./interpretador/dialetos/egua-classico");
14
+ var egua_classico_2 = require("./resolvedor/dialetos/egua-classico");
15
+ var egua_classico_3 = require("./avaliador-sintatico/dialetos/egua-classico");
16
+ var egua_classico_4 = require("./lexador/dialetos/egua-classico");
17
+ var Delegua = /** @class */ (function () {
18
+ function Delegua(dialeto, nomeArquivo) {
19
+ if (dialeto === void 0) { dialeto = 'delegua'; }
12
20
  this.nomeArquivo = nomeArquivo;
13
-
14
21
  this.teveErro = false;
15
22
  this.teveErroEmTempoDeExecucao = false;
23
+ this.dialeto = dialeto;
24
+ switch (this.dialeto) {
25
+ case 'egua':
26
+ this.interpretador = new egua_classico_1.InterpretadorEguaClassico(this, process.cwd());
27
+ this.lexador = new egua_classico_4.LexerEguaClassico(this);
28
+ this.avaliadorSintatico = new egua_classico_3.ParserEguaClassico(this);
29
+ this.resolvedor = new egua_classico_2.ResolverEguaClassico(this, this.interpretador);
30
+ console.log('Usando dialeto: Égua');
31
+ break;
32
+ case 'eguac':
33
+ this.interpretador = new interpretador_1.Interpretador(this, process.cwd());
34
+ this.lexador = new lexador_1.Lexer(this);
35
+ this.avaliadorSintatico = new avaliador_sintatico_1.Parser(this);
36
+ this.resolvedor = new resolvedor_1.Resolver(this, this.interpretador);
37
+ console.log('Usando dialeto: ÉguaC');
38
+ break;
39
+ case 'eguap':
40
+ this.interpretador = new interpretador_1.Interpretador(this, process.cwd());
41
+ this.lexador = new lexador_1.Lexer(this);
42
+ this.avaliadorSintatico = new avaliador_sintatico_1.Parser(this);
43
+ this.resolvedor = new resolvedor_1.Resolver(this, this.interpretador);
44
+ console.log('Usando dialeto: ÉguaP');
45
+ break;
46
+ default:
47
+ this.interpretador = new interpretador_1.Interpretador(this, process.cwd());
48
+ this.lexador = new lexador_1.Lexer(this);
49
+ this.avaliadorSintatico = new avaliador_sintatico_1.Parser(this);
50
+ this.resolvedor = new resolvedor_1.Resolver(this, this.interpretador);
51
+ console.log('Usando dialeto: padrão');
52
+ break;
53
+ }
16
54
  }
17
-
18
- runPrompt() {
19
- const interpretador = new Interpretador(this, process.cwd(), undefined);
20
- console.log("Console da Linguagem Delégua v0.0.1");
21
- const leiaLinha = readline.createInterface({
55
+ Delegua.prototype.versao = function () {
56
+ return JSON.parse(fs.readFileSync('./package.json', { encoding: 'utf8' })).version || '';
57
+ };
58
+ Delegua.prototype.iniciarDelegua = function () {
59
+ var _this = this;
60
+ var interpretador = new interpretador_1.Interpretador(this, process.cwd());
61
+ console.log("Console da Linguagem Del\u00E9gua v".concat(this.versao()));
62
+ var leiaLinha = readline.createInterface({
22
63
  input: process.stdin,
23
64
  output: process.stdout,
24
65
  prompt: "\ndelegua> "
25
66
  });
26
-
27
67
  leiaLinha.prompt();
28
-
29
- leiaLinha.on("line", linha => {
30
- this.teveErro = false;
31
- this.teveErroEmTempoDeExecucao = false;
32
-
33
- this.run(linha, interpretador);
68
+ leiaLinha.on("line", function (linha) {
69
+ _this.teveErro = false;
70
+ _this.teveErroEmTempoDeExecucao = false;
71
+ _this.run(linha);
34
72
  leiaLinha.prompt();
35
73
  });
36
- }
37
-
38
- runfile(nomeArquivo) {
74
+ };
75
+ Delegua.prototype.carregarArquivo = function (nomeArquivo) {
39
76
  this.nomeArquivo = caminho.basename(nomeArquivo);
40
- const interpretador = new Interpretador(this, process.cwd());
41
-
42
- const dadosDoArquivo = fs.readFileSync(nomeArquivo).toString();
43
- this.run(dadosDoArquivo, interpretador);
44
-
45
- if (this.teveErro) process.exit(65);
46
- if (this.teveErroEmTempoDeExecucao) process.exit(70);
47
- }
48
-
49
- run(codigo, interpretador) {
50
- const lexer = new Lexer(codigo, this);
51
- const simbolos = lexer.scan();
52
-
53
- if (this.teveErro === true) return;
54
-
55
- const analisar = new Parser(simbolos, this);
56
- const declaracoes = analisar.analisar();
57
-
58
- if (this.teveErro === true) return;
59
-
60
- const resolver = new Resolver(interpretador, this);
61
- resolver.resolver(declaracoes);
62
-
63
- if (this.teveErro === true) return;
64
-
65
- interpretador.interpretar(declaracoes);
66
- }
67
-
68
- reportar(linha, onde, mensagem) {
77
+ var dadosDoArquivo = fs.readFileSync(nomeArquivo).toString();
78
+ this.run(dadosDoArquivo);
79
+ if (this.teveErro)
80
+ process.exit(65);
81
+ if (this.teveErroEmTempoDeExecucao)
82
+ process.exit(70);
83
+ };
84
+ Delegua.prototype.run = function (codigo) {
85
+ var simbolos = this.lexador.scan(codigo);
86
+ if (this.teveErro === true)
87
+ return;
88
+ var declaracoes = this.avaliadorSintatico.analisar(simbolos);
89
+ if (this.teveErro === true)
90
+ return;
91
+ this.resolvedor.resolver(declaracoes);
92
+ if (this.teveErro === true)
93
+ return;
94
+ this.interpretador.interpretar(declaracoes);
95
+ };
96
+ Delegua.prototype.reportar = function (linha, onde, mensagem) {
69
97
  if (this.nomeArquivo)
70
- console.error(
71
- `[Arquivo: ${this.nomeArquivo}] [Linha: ${linha}] Erro${onde}: ${mensagem}`
72
- );
73
- else console.error(`[Linha: ${linha}] Erro${onde}: ${mensagem}`);
98
+ console.error("[Arquivo: ".concat(this.nomeArquivo, "] [Linha: ").concat(linha, "] Erro").concat(onde, ": ").concat(mensagem));
99
+ else
100
+ console.error("[Linha: ".concat(linha, "] Erro").concat(onde, ": ").concat(mensagem));
74
101
  this.teveErro = true;
75
- }
76
-
77
- erro(simbolo, mensagemDeErro) {
78
- if (simbolo.tipo === tiposDeSimbolos.EOF) {
102
+ };
103
+ Delegua.prototype.erro = function (simbolo, mensagemDeErro) {
104
+ if (simbolo.tipo === tiposDeSimbolos_1.default.EOF) {
79
105
  this.reportar(simbolo.line, " no final", mensagemDeErro);
80
- } else {
81
- this.reportar(simbolo.line, ` no '${simbolo.lexeme}'`, mensagemDeErro);
82
106
  }
83
- }
84
-
85
- lexerError(linha, caractere, mensagem) {
86
- this.reportar(linha, ` no '${caractere}'`, mensagem);
87
- }
88
-
89
- erroEmTempoDeExecucao(erro) {
90
- const linha = erro.simbolo.linha;
91
- if (erro.simbolo && linha) {
107
+ else {
108
+ this.reportar(simbolo.line, " no '".concat(simbolo.lexema, "'"), mensagemDeErro);
109
+ }
110
+ };
111
+ Delegua.prototype.lexerError = function (linha, caractere, mensagem) {
112
+ this.reportar(linha, " no '".concat(caractere, "'"), mensagem);
113
+ };
114
+ Delegua.prototype.erroEmTempoDeExecucao = function (erro) {
115
+ if (erro & erro.simbolo && erro.simbolo.linha) {
92
116
  if (this.nomeArquivo)
93
- console.error(
94
- `Erro: [Arquivo: ${this.nomeArquivo}] [Linha: ${erro.simbolo.linha}] ${erro.mensagem}`
95
- );
96
- else console.error(`Erro: [Linha: ${erro.simbolo.linha}] ${erro.mensagem}`);
97
- } else {
98
- console.error(`Erro: ${erro.mensagem}`);
117
+ console.error("Erro: [Arquivo: ".concat(this.nomeArquivo, "] [Linha: ").concat(erro.simbolo.linha, "] ").concat(erro.mensagem));
118
+ else
119
+ console.error("Erro: [Linha: ".concat(erro.simbolo.linha, "] ").concat(erro.mensagem));
120
+ }
121
+ else if (!(erro instanceof excecoes_1.ReturnException)) { // TODO: Ao se livrar de ReturnException, remover isto.
122
+ console.error("Erro: ".concat(erro.mensagem));
99
123
  }
100
124
  this.teveErroEmTempoDeExecucao = true;
101
- }
102
- };
125
+ };
126
+ return Delegua;
127
+ }());
128
+ exports.Delegua = Delegua;
129
+ //# sourceMappingURL=delegua.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegua.js","sourceRoot":"","sources":["../../src/delegua.ts"],"names":[],"mappings":";;;AAAA,uBAAyB;AACzB,8BAAgC;AAChC,mCAAqC;AAErC,qCAAkC;AAClC,6DAA+C;AAC/C,2CAAwC;AACxC,iDAAgD;AAChD,qDAAgD;AAEhD,uCAA6C;AAG7C,wEAAmF;AACnF,qEAA2E;AAC3E,8EAAkF;AAClF,kEAAqE;AAErE;IAWI,iBAAY,OAA2B,EAAE,WAAoB;QAAjD,wBAAA,EAAA,mBAA2B;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAA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AC,CAAC;SAC3C;QAED,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAC1C,CAAC;IACL,cAAC;AAAD,CAAC,AAtID,IAsIC;AAtIY,0BAAO"}
@@ -1,5 +1,16 @@
1
- module.exports = class Callable {
2
- aridade() {
3
- return this.valorAridade;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Callable = void 0;
4
+ var Callable = /** @class */ (function () {
5
+ function Callable() {
4
6
  }
5
- };
7
+ Callable.prototype.aridade = function () {
8
+ return this.valorAridade;
9
+ };
10
+ Callable.prototype.chamar = function (interpretador, argumentos, simbolo) {
11
+ throw new Error("Este método não deveria ser chamado.");
12
+ };
13
+ return Callable;
14
+ }());
15
+ exports.Callable = Callable;
16
+ //# sourceMappingURL=callable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callable.js","sourceRoot":"","sources":["../../../src/estruturas/callable.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAUA,CAAC;IAPG,0BAAO,GAAP;QACI,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,yBAAM,GAAN,UAAO,aAAmB,EAAE,UAAgB,EAAE,OAAa;QACvD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC5D,CAAC;IACL,eAAC;AAAD,CAAC,AAVD,IAUC;AAVY,4BAAQ"}
@@ -1,43 +1,57 @@
1
- const Callable = require("./callable.js");
2
- const DeleguaInstancia = require("./instancia.js");
3
-
4
- module.exports = class DeleguaClasse extends Callable {
5
- constructor(nome, superClasse, metodos) {
6
- super();
7
- this.nome = nome;
8
- this.superClasse = superClasse;
9
- this.metodos = metodos;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DeleguaClasse = void 0;
19
+ var callable_1 = require("./callable");
20
+ var instancia_1 = require("./instancia");
21
+ var DeleguaClasse = /** @class */ (function (_super) {
22
+ __extends(DeleguaClasse, _super);
23
+ function DeleguaClasse(nome, superClasse, metodos) {
24
+ var _this = _super.call(this) || this;
25
+ _this.nome = nome;
26
+ _this.superClasse = superClasse;
27
+ _this.metodos = metodos;
28
+ return _this;
10
29
  }
11
-
12
- encontrarMetodo(nome) {
30
+ DeleguaClasse.prototype.encontrarMetodo = function (nome) {
13
31
  if (this.metodos.hasOwnProperty(nome)) {
14
32
  return this.metodos[nome];
15
33
  }
16
-
17
34
  if (this.superClasse !== null) {
18
35
  return this.superClasse.encontrarMetodo(nome);
19
36
  }
20
-
21
37
  return undefined;
22
- }
23
-
24
- toString() {
25
- return `<classe ${this.nome}>`;
26
- }
27
-
28
- aridade() {
29
- let inicializador = this.encontrarMetodo("construtor");
38
+ };
39
+ DeleguaClasse.prototype.toString = function () {
40
+ return "<classe ".concat(this.nome, ">");
41
+ };
42
+ DeleguaClasse.prototype.aridade = function () {
43
+ var inicializador = this.encontrarMetodo("construtor");
30
44
  return inicializador ? inicializador.aridade() : 0;
31
- }
32
-
33
- call(interpretador, argumentos) {
34
- let instancia = new DeleguaInstancia(this);
35
-
36
- let inicializador = this.encontrarMetodo("construtor");
45
+ };
46
+ DeleguaClasse.prototype.chamar = function (interpretador, argumentos) {
47
+ var instancia = new instancia_1.DeleguaInstancia(this);
48
+ var inicializador = this.encontrarMetodo("construtor");
37
49
  if (inicializador) {
38
50
  inicializador.bind(instancia).call(interpretador, argumentos);
39
51
  }
40
-
41
52
  return instancia;
42
- }
43
- };
53
+ };
54
+ return DeleguaClasse;
55
+ }(callable_1.Callable));
56
+ exports.DeleguaClasse = DeleguaClasse;
57
+ //# sourceMappingURL=classe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classe.js","sourceRoot":"","sources":["../../../src/estruturas/classe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAsC;AACtC,yCAA+C;AAE/C;IAAmC,iCAAQ;IAKvC,uBAAY,IAAU,EAAE,WAAiB,EAAE,OAAa;QAAxD,YACI,iBAAO,SAIV;QAHG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,KAAI,CAAC,OAAO,GAAG,OAAO,CAAC;;IAC3B,CAAC;IAED,uCAAe,GAAf,UAAgB,IAAS;QACrB,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,gCAAQ,GAAR;QACI,OAAO,kBAAW,IAAI,CAAC,IAAI,MAAG,CAAC;IACnC,CAAC;IAED,+BAAO,GAAP;QACI,IAAI,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACvD,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,8BAAM,GAAN,UAAO,aAAkB,EAAE,UAAe;QACtC,IAAI,SAAS,GAAG,IAAI,4BAAgB,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,aAAa,EAAE;YACf,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;SACjE;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IACL,oBAAC;AAAD,CAAC,AA3CD,CAAmC,mBAAQ,GA2C1C;AA3CY,sCAAa"}
@@ -0,0 +1,38 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.FuncaoPadrao = void 0;
19
+ var callable_1 = require("./callable");
20
+ var FuncaoPadrao = /** @class */ (function (_super) {
21
+ __extends(FuncaoPadrao, _super);
22
+ function FuncaoPadrao(valorAridade, funcao) {
23
+ var _this = _super.call(this) || this;
24
+ _this.valorAridade = valorAridade;
25
+ _this.funcao = funcao;
26
+ return _this;
27
+ }
28
+ FuncaoPadrao.prototype.chamar = function (interpretador, argumentos, simbolo) {
29
+ this.simbolo = simbolo;
30
+ return this.funcao.apply(this, argumentos);
31
+ };
32
+ FuncaoPadrao.prototype.toString = function () {
33
+ return "<função>";
34
+ };
35
+ return FuncaoPadrao;
36
+ }(callable_1.Callable));
37
+ exports.FuncaoPadrao = FuncaoPadrao;
38
+ //# sourceMappingURL=funcao-padrao.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"funcao-padrao.js","sourceRoot":"","sources":["../../../src/estruturas/funcao-padrao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAsC;AAEtC;IAAkC,gCAAQ;IAKtC,sBAAY,YAAY,EAAE,MAAM;QAAhC,YACI,iBAAO,SAGV;QAFG,KAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACzB,CAAC;IAED,6BAAM,GAAN,UAAO,aAAkB,EAAE,UAAe,EAAE,OAAY;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED,+BAAQ,GAAR;QACI,OAAO,UAAU,CAAC;IACtB,CAAC;IACL,mBAAC;AAAD,CAAC,AAnBD,CAAkC,mBAAQ,GAmBzC;AAnBY,oCAAY"}
@@ -1,62 +1,81 @@
1
- const Callable = require("./callable.js");
2
- const Ambiente = require("../ambiente.js");
3
- const ReturnExpection = require("../erro.js").ReturnException;
4
-
5
- module.exports = class DeleguaFuncao extends Callable {
6
- constructor(nome, declaracao, closure, eInicializador = false) {
7
- super();
8
- this.nome = nome;
9
- this.declaracao = declaracao;
10
- this.closure = closure;
11
- this.eInicializador = eInicializador;
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DeleguaFuncao = void 0;
19
+ var callable_1 = require("./callable");
20
+ var ambiente_1 = require("../ambiente");
21
+ var excecoes_1 = require("../excecoes");
22
+ var DeleguaFuncao = /** @class */ (function (_super) {
23
+ __extends(DeleguaFuncao, _super);
24
+ function DeleguaFuncao(nome, declaracao, closure, eInicializador) {
25
+ if (eInicializador === void 0) { eInicializador = false; }
26
+ var _this = _super.call(this) || this;
27
+ _this.nome = nome;
28
+ _this.declaracao = declaracao;
29
+ _this.closure = closure;
30
+ _this.eInicializador = eInicializador;
31
+ return _this;
12
32
  }
13
-
14
- aridade() {
15
- return this.declaracao.parametros.length;
16
- }
17
-
18
- toString() {
19
- if (this.nome === null) return "<função>";
20
- return `<função ${this.nome}>`;
21
- }
22
-
23
- call(interpretador, argumentos) {
24
- let ambiente = new Ambiente(this.closure);
25
- let parametros = this.declaracao.parametros;
26
- for (let i = 0; i < parametros.length; i++) {
27
- const param = parametros[i];
28
-
29
- const nome = param["nome"].lexeme;
30
- let valor = argumentos[i];
31
- if (argumentos[i] === null) {
32
- valor = param["padrao"] ? param["padrao"].valor : null;
33
+ DeleguaFuncao.prototype.aridade = function () {
34
+ var _a, _b;
35
+ return ((_b = (_a = this.declaracao) === null || _a === void 0 ? void 0 : _a.parametros) === null || _b === void 0 ? void 0 : _b.length) || 0;
36
+ };
37
+ DeleguaFuncao.prototype.toString = function () {
38
+ if (this.nome === null)
39
+ return "<função>";
40
+ return "<fun\u00E7\u00E3o ".concat(this.nome, ">");
41
+ };
42
+ DeleguaFuncao.prototype.chamar = function (interpretador, argumentos) {
43
+ var ambiente = new ambiente_1.Ambiente(this.closure);
44
+ var parametros = this.declaracao.parametros;
45
+ if (parametros && parametros.length) {
46
+ for (var i = 0; i < parametros.length; i++) {
47
+ var param = parametros[i];
48
+ var nome = param["nome"].lexema;
49
+ var valor = argumentos[i];
50
+ if (argumentos[i] === null) {
51
+ valor = param["padrao"] ? param["padrao"].valor : null;
52
+ }
53
+ ambiente.definirVariavel(nome, valor);
33
54
  }
34
- ambiente.definirVariavel(nome, valor);
35
55
  }
36
-
37
56
  try {
38
- interpretador.executeBlock(this.declaracao.corpo, ambiente);
39
- } catch (erro) {
40
- if (erro instanceof ReturnExpection) {
41
- if (this.eInicializador) return this.closure.obterVariavelEm(0, "isto");
57
+ interpretador.executeBlock(this.declaracao.funcao, ambiente);
58
+ }
59
+ catch (erro) {
60
+ if (erro instanceof excecoes_1.ReturnException) {
61
+ if (this.eInicializador)
62
+ return this.closure.obterVariavelEm(0, "isto");
42
63
  return erro.valor;
43
- } else {
64
+ }
65
+ else {
44
66
  throw erro;
45
67
  }
46
68
  }
47
-
48
- if (this.eInicializador) return this.closure.obterVariavelEm(0, "isto");
69
+ if (this.eInicializador)
70
+ return this.closure.obterVariavelEm(0, "isto");
49
71
  return null;
50
- }
51
-
52
- bind(instancia) {
53
- let ambiente = new Ambiente(this.closure);
72
+ };
73
+ DeleguaFuncao.prototype.bind = function (instancia) {
74
+ var ambiente = new ambiente_1.Ambiente(this.closure);
54
75
  ambiente.definirVariavel("isto", instancia);
55
- return new DeleguaFuncao(
56
- this.nome,
57
- this.declaracao,
58
- ambiente,
59
- this.eInicializador
60
- );
61
- }
62
- };
76
+ return new DeleguaFuncao(this.nome, this.declaracao, ambiente, this.eInicializador);
77
+ };
78
+ return DeleguaFuncao;
79
+ }(callable_1.Callable));
80
+ exports.DeleguaFuncao = DeleguaFuncao;
81
+ //# sourceMappingURL=funcao.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"funcao.js","sourceRoot":"","sources":["../../../src/estruturas/funcao.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAAsC;AACtC,wCAAuC;AACvC,wCAA8C;AAE9C;IAAmC,iCAAQ;IAMvC,uBAAY,IAAS,EAA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iBAC1D;gBACD,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aACzC;SACJ;QAED,IAAI;YACA,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SAChE;QAAC,OAAO,IAAI,EAAE;YACX,IAAI,IAAI,YAAY,0BAAe,EAAE;gBACjC,IAAI,IAAI,CAAC,cAAc;oBAAE,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,KAAK,CAAC;aACrB;iBAAM;gBACH,MAAM,IAAI,CAAC;aACd;SACJ;QAED,IAAI,IAAI,CAAC,cAAc;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4BAAI,GAAJ,UAAK,SAAc;QACf,IAAI,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC5C,OAAO,IAAI,aAAa,CACpB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,UAAU,EACf,QAAQ,EACR,IAAI,CAAC,cAAc,CACtB,CAAC;IACN,CAAC;IACL,oBAAC;AAAD,CAAC,AAjED,CAAmC,mBAAQ,GAiE1C;AAjEY,sCAAa"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./callable"), exports);
14
+ __exportStar(require("./classe"), exports);
15
+ __exportStar(require("./funcao-padrao"), exports);
16
+ __exportStar(require("./funcao"), exports);
17
+ __exportStar(require("./instancia"), exports);
18
+ __exportStar(require("./modulo"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/estruturas/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,2CAAyB;AACzB,kDAAgC;AAChC,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB"}
@@ -1,27 +1,28 @@
1
- const ErroEmTempoDeExecucao = require("../erro.js").ErroEmTempoDeExecucao;
2
-
3
- module.exports = class DeleguaInstancia {
4
- constructor(criarClasse) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleguaInstancia = void 0;
4
+ var excecoes_1 = require("../excecoes");
5
+ var DeleguaInstancia = /** @class */ (function () {
6
+ function DeleguaInstancia(criarClasse) {
5
7
  this.criarClasse = criarClasse;
6
8
  this.campos = {};
7
9
  }
8
-
9
- get(nome) {
10
- if (this.campos.hasOwnProperty(nome.lexeme)) {
11
- return this.campos[nome.lexeme];
10
+ DeleguaInstancia.prototype.get = function (nome) {
11
+ if (this.campos.hasOwnProperty(nome.lexema)) {
12
+ return this.campos[nome.lexema];
12
13
  }
13
-
14
- let metodo = this.criarClasse.encontrarMetodo(nome.lexeme);
15
- if (metodo) return metodo.bind(this);
16
-
17
- throw new ErroEmTempoDeExecucao(nome, "Método indefinido não recuperado.");
18
- }
19
-
20
- set(nome, valor) {
21
- this.campos[nome.lexeme] = valor;
22
- }
23
-
24
- toString() {
14
+ var metodo = this.criarClasse.encontrarMetodo(nome.lexema);
15
+ if (metodo)
16
+ return metodo.bind(this);
17
+ throw new excecoes_1.ErroEmTempoDeExecucao(nome, "Método indefinido não recuperado.");
18
+ };
19
+ DeleguaInstancia.prototype.set = function (nome, valor) {
20
+ this.campos[nome.lexema] = valor;
21
+ };
22
+ DeleguaInstancia.prototype.toString = function () {
25
23
  return "<Objeto " + this.criarClasse.nome + ">";
26
- }
27
- };
24
+ };
25
+ return DeleguaInstancia;
26
+ }());
27
+ exports.DeleguaInstancia = DeleguaInstancia;
28
+ //# sourceMappingURL=instancia.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instancia.js","sourceRoot":"","sources":["../../../src/estruturas/instancia.ts"],"names":[],"mappings":";;;AAAA,wCAAoD;AAEpD;IAII,0BAAY,WAAW;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,8BAAG,GAAH,UAAI,IAAS;QACT,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACzC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACnC;QAED,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErC,MAAM,IAAI,gCAAqB,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC;IAC/E,CAAC;IAED,8BAAG,GAAH,UAAI,IAAS,EAAE,KAAU;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACrC,CAAC;IAED,mCAAQ,GAAR;QACI,OAAO,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,GAAG,CAAC;IACpD,CAAC;IACL,uBAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,4CAAgB"}
@@ -1,9 +1,15 @@
1
- module.exports = class DeleguaModulo {
2
- constructor(nome) {
3
- if (nome !== undefined) this.nome = nome;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleguaModulo = void 0;
4
+ var DeleguaModulo = /** @class */ (function () {
5
+ function DeleguaModulo(nome) {
6
+ if (nome)
7
+ this.nome = nome;
4
8
  }
5
-
6
- toString() {
7
- return this.nome ? `<modulo ${this.nome}>` : "<modulo>";
8
- }
9
- };
9
+ DeleguaModulo.prototype.toString = function () {
10
+ return this.nome ? "<modulo ".concat(this.nome, ">") : "<modulo>";
11
+ };
12
+ return DeleguaModulo;
13
+ }());
14
+ exports.DeleguaModulo = DeleguaModulo;
15
+ //# sourceMappingURL=modulo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modulo.js","sourceRoot":"","sources":["../../../src/estruturas/modulo.ts"],"names":[],"mappings":";;;AAAA;IAGI,uBAAY,IAAa;QACrB,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,gCAAQ,GAAR;QACI,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAW,IAAI,CAAC,IAAI,MAAG,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5D,CAAC;IACL,oBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,sCAAa"}