@designliquido/delegua-node 0.6.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -80
- package/bin/delegua +2 -2
- package/bin/package.json +36 -36
- package/execucao.d.ts +1 -1
- package/execucao.js +42 -42
- package/fontes/delegua.d.ts +86 -86
- package/fontes/delegua.js +371 -371
- package/fontes/depuracao/index.d.ts +1 -1
- package/fontes/depuracao/index.js +17 -17
- package/fontes/depuracao/servidor-depuracao.d.ts +42 -42
- package/fontes/depuracao/servidor-depuracao.js +300 -300
- package/fontes/importador/importador.d.ts +27 -27
- package/fontes/importador/importador.js +90 -90
- package/fontes/importador/index.d.ts +2 -2
- package/fontes/importador/index.js +18 -18
- package/fontes/importador/retorno-importador.d.ts +9 -9
- package/fontes/importador/retorno-importador.js +2 -2
- package/fontes/interfaces/delegua-interface.d.ts +24 -24
- package/fontes/interfaces/delegua-interface.js +2 -2
- package/fontes/interfaces/importador-interface.d.ts +8 -8
- package/fontes/interfaces/importador-interface.js +2 -2
- package/fontes/interfaces/index.d.ts +2 -2
- package/fontes/interfaces/index.js +18 -18
- package/fontes/interpretador/dialetos/interpretador-visualg-com-depuracao-importacao.d.ts +14 -14
- package/fontes/interpretador/dialetos/interpretador-visualg-com-depuracao-importacao.js +76 -76
- package/fontes/interpretador/index.d.ts +1 -1
- package/fontes/interpretador/index.js +17 -17
- package/fontes/interpretador/interpretador-com-depuracao-importacao.d.ts +14 -14
- package/fontes/interpretador/interpretador-com-depuracao-importacao.js +76 -76
- package/fontes/interpretador/interpretador.d.ts +18 -18
- package/fontes/interpretador/interpretador.js +80 -80
- package/fontes/interpretador/mecanismo-importacao-bibliotecas.d.ts +2 -2
- package/fontes/interpretador/mecanismo-importacao-bibliotecas.js +131 -131
- package/package.json +36 -36
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { AvaliadorSintaticoInterface, LexadorInterface } from '@designliquido/delegua/fontes/interfaces';
|
|
2
|
-
import { RetornoImportador } from './retorno-importador';
|
|
3
|
-
import { ImportadorInterface } from '../interfaces';
|
|
4
|
-
/**
|
|
5
|
-
* O Importador é responsável por manusear arquivos. Coordena as fases de lexação, avaliação sintática,
|
|
6
|
-
* cataloga informações do arquivo no núcleo da linguagem (através das referências `arquivosAbertos` e
|
|
7
|
-
* `conteudoArquivosAbertos`) e aponta erros caso ocorram.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare class Importador implements ImportadorInterface {
|
|
11
|
-
diretorioBase: string;
|
|
12
|
-
lexador: LexadorInterface;
|
|
13
|
-
avaliadorSintatico: AvaliadorSintaticoInterface;
|
|
14
|
-
arquivosAbertos: {
|
|
15
|
-
[identificador: string]: string;
|
|
16
|
-
};
|
|
17
|
-
conteudoArquivosAbertos: {
|
|
18
|
-
[identificador: string]: string[];
|
|
19
|
-
};
|
|
20
|
-
depuracao: boolean;
|
|
21
|
-
constructor(lexador: LexadorInterface, avaliadorSintatico: AvaliadorSintaticoInterface, arquivosAbertos: {
|
|
22
|
-
[identificador: string]: string;
|
|
23
|
-
}, conteudoArquivosAbertos: {
|
|
24
|
-
[identificador: string]: string[];
|
|
25
|
-
}, depuracao: boolean);
|
|
26
|
-
importar(caminhoRelativoArquivo: string, importacaoInicial?: boolean, traduzirJavaScriptParaDelegua?: boolean): RetornoImportador;
|
|
27
|
-
}
|
|
1
|
+
import { AvaliadorSintaticoInterface, LexadorInterface } from '@designliquido/delegua/fontes/interfaces';
|
|
2
|
+
import { RetornoImportador } from './retorno-importador';
|
|
3
|
+
import { ImportadorInterface } from '../interfaces';
|
|
4
|
+
/**
|
|
5
|
+
* O Importador é responsável por manusear arquivos. Coordena as fases de lexação, avaliação sintática,
|
|
6
|
+
* cataloga informações do arquivo no núcleo da linguagem (através das referências `arquivosAbertos` e
|
|
7
|
+
* `conteudoArquivosAbertos`) e aponta erros caso ocorram.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class Importador implements ImportadorInterface {
|
|
11
|
+
diretorioBase: string;
|
|
12
|
+
lexador: LexadorInterface;
|
|
13
|
+
avaliadorSintatico: AvaliadorSintaticoInterface;
|
|
14
|
+
arquivosAbertos: {
|
|
15
|
+
[identificador: string]: string;
|
|
16
|
+
};
|
|
17
|
+
conteudoArquivosAbertos: {
|
|
18
|
+
[identificador: string]: string[];
|
|
19
|
+
};
|
|
20
|
+
depuracao: boolean;
|
|
21
|
+
constructor(lexador: LexadorInterface, avaliadorSintatico: AvaliadorSintaticoInterface, arquivosAbertos: {
|
|
22
|
+
[identificador: string]: string;
|
|
23
|
+
}, conteudoArquivosAbertos: {
|
|
24
|
+
[identificador: string]: string[];
|
|
25
|
+
}, depuracao: boolean);
|
|
26
|
+
importar(caminhoRelativoArquivo: string, importacaoInicial?: boolean, traduzirJavaScriptParaDelegua?: boolean): RetornoImportador;
|
|
27
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.Importador = void 0;
|
|
30
|
-
const sistemaArquivos = __importStar(require("fs"));
|
|
31
|
-
const caminho = __importStar(require("path"));
|
|
32
|
-
const sistemaOperacional = __importStar(require("os"));
|
|
33
|
-
const cyrb53_1 = __importDefault(require("@designliquido/delegua/fontes/depuracao/cyrb53"));
|
|
34
|
-
/**
|
|
35
|
-
* O Importador é responsável por manusear arquivos. Coordena as fases de lexação, avaliação sintática,
|
|
36
|
-
* cataloga informações do arquivo no núcleo da linguagem (através das referências `arquivosAbertos` e
|
|
37
|
-
* `conteudoArquivosAbertos`) e aponta erros caso ocorram.
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
class Importador {
|
|
41
|
-
constructor(lexador, avaliadorSintatico, arquivosAbertos, conteudoArquivosAbertos, depuracao) {
|
|
42
|
-
this.diretorioBase = process.cwd();
|
|
43
|
-
this.lexador = lexador;
|
|
44
|
-
this.avaliadorSintatico = avaliadorSintatico;
|
|
45
|
-
this.arquivosAbertos = arquivosAbertos;
|
|
46
|
-
this.conteudoArquivosAbertos = conteudoArquivosAbertos;
|
|
47
|
-
this.depuracao = depuracao;
|
|
48
|
-
}
|
|
49
|
-
importar(caminhoRelativoArquivo, importacaoInicial = false, traduzirJavaScriptParaDelegua = false) {
|
|
50
|
-
const nomeArquivo = caminho.basename(caminhoRelativoArquivo);
|
|
51
|
-
let caminhoAbsolutoArquivo = caminho.resolve(this.diretorioBase, caminhoRelativoArquivo);
|
|
52
|
-
if (importacaoInicial) {
|
|
53
|
-
caminhoAbsolutoArquivo = caminho.resolve(caminhoRelativoArquivo);
|
|
54
|
-
}
|
|
55
|
-
const hashArquivo = (0, cyrb53_1.default)(caminhoAbsolutoArquivo.toLowerCase());
|
|
56
|
-
if (!sistemaArquivos.existsSync(nomeArquivo)) {
|
|
57
|
-
// TODO: Terminar.
|
|
58
|
-
/* throw new ErroEmTempoDeExecucao(
|
|
59
|
-
declaracao.simboloFechamento,
|
|
60
|
-
'Não foi possível encontrar arquivo importado.',
|
|
61
|
-
declaracao.linha
|
|
62
|
-
); */
|
|
63
|
-
}
|
|
64
|
-
const dadosDoArquivo = sistemaArquivos.readFileSync(caminhoAbsolutoArquivo);
|
|
65
|
-
const conteudoDoArquivo = dadosDoArquivo.toString().replace(sistemaOperacional.EOL, '\n').split('\n');
|
|
66
|
-
if (traduzirJavaScriptParaDelegua) {
|
|
67
|
-
return {
|
|
68
|
-
conteudoArquivo: conteudoDoArquivo,
|
|
69
|
-
nomeArquivo,
|
|
70
|
-
hashArquivo,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
for (let linha = 0; linha < conteudoDoArquivo.length; linha++) {
|
|
74
|
-
conteudoDoArquivo[linha] += '\0';
|
|
75
|
-
}
|
|
76
|
-
const retornoLexador = this.lexador.mapear(conteudoDoArquivo, hashArquivo);
|
|
77
|
-
const retornoAvaliadorSintatico = this.avaliadorSintatico.analisar(retornoLexador, hashArquivo);
|
|
78
|
-
this.arquivosAbertos[hashArquivo] = caminho.resolve(caminhoRelativoArquivo);
|
|
79
|
-
if (this.depuracao) {
|
|
80
|
-
this.conteudoArquivosAbertos[hashArquivo] = conteudoDoArquivo;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
nomeArquivo,
|
|
84
|
-
hashArquivo,
|
|
85
|
-
retornoLexador,
|
|
86
|
-
retornoAvaliadorSintatico,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.Importador = Importador;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Importador = void 0;
|
|
30
|
+
const sistemaArquivos = __importStar(require("fs"));
|
|
31
|
+
const caminho = __importStar(require("path"));
|
|
32
|
+
const sistemaOperacional = __importStar(require("os"));
|
|
33
|
+
const cyrb53_1 = __importDefault(require("@designliquido/delegua/fontes/depuracao/cyrb53"));
|
|
34
|
+
/**
|
|
35
|
+
* O Importador é responsável por manusear arquivos. Coordena as fases de lexação, avaliação sintática,
|
|
36
|
+
* cataloga informações do arquivo no núcleo da linguagem (através das referências `arquivosAbertos` e
|
|
37
|
+
* `conteudoArquivosAbertos`) e aponta erros caso ocorram.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
class Importador {
|
|
41
|
+
constructor(lexador, avaliadorSintatico, arquivosAbertos, conteudoArquivosAbertos, depuracao) {
|
|
42
|
+
this.diretorioBase = process.cwd();
|
|
43
|
+
this.lexador = lexador;
|
|
44
|
+
this.avaliadorSintatico = avaliadorSintatico;
|
|
45
|
+
this.arquivosAbertos = arquivosAbertos;
|
|
46
|
+
this.conteudoArquivosAbertos = conteudoArquivosAbertos;
|
|
47
|
+
this.depuracao = depuracao;
|
|
48
|
+
}
|
|
49
|
+
importar(caminhoRelativoArquivo, importacaoInicial = false, traduzirJavaScriptParaDelegua = false) {
|
|
50
|
+
const nomeArquivo = caminho.basename(caminhoRelativoArquivo);
|
|
51
|
+
let caminhoAbsolutoArquivo = caminho.resolve(this.diretorioBase, caminhoRelativoArquivo);
|
|
52
|
+
if (importacaoInicial) {
|
|
53
|
+
caminhoAbsolutoArquivo = caminho.resolve(caminhoRelativoArquivo);
|
|
54
|
+
}
|
|
55
|
+
const hashArquivo = (0, cyrb53_1.default)(caminhoAbsolutoArquivo.toLowerCase());
|
|
56
|
+
if (!sistemaArquivos.existsSync(nomeArquivo)) {
|
|
57
|
+
// TODO: Terminar.
|
|
58
|
+
/* throw new ErroEmTempoDeExecucao(
|
|
59
|
+
declaracao.simboloFechamento,
|
|
60
|
+
'Não foi possível encontrar arquivo importado.',
|
|
61
|
+
declaracao.linha
|
|
62
|
+
); */
|
|
63
|
+
}
|
|
64
|
+
const dadosDoArquivo = sistemaArquivos.readFileSync(caminhoAbsolutoArquivo);
|
|
65
|
+
const conteudoDoArquivo = dadosDoArquivo.toString().replace(sistemaOperacional.EOL, '\n').split('\n');
|
|
66
|
+
if (traduzirJavaScriptParaDelegua) {
|
|
67
|
+
return {
|
|
68
|
+
conteudoArquivo: conteudoDoArquivo,
|
|
69
|
+
nomeArquivo,
|
|
70
|
+
hashArquivo,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
for (let linha = 0; linha < conteudoDoArquivo.length; linha++) {
|
|
74
|
+
conteudoDoArquivo[linha] += '\0';
|
|
75
|
+
}
|
|
76
|
+
const retornoLexador = this.lexador.mapear(conteudoDoArquivo, hashArquivo);
|
|
77
|
+
const retornoAvaliadorSintatico = this.avaliadorSintatico.analisar(retornoLexador, hashArquivo);
|
|
78
|
+
this.arquivosAbertos[hashArquivo] = caminho.resolve(caminhoRelativoArquivo);
|
|
79
|
+
if (this.depuracao) {
|
|
80
|
+
this.conteudoArquivosAbertos[hashArquivo] = conteudoDoArquivo;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
nomeArquivo,
|
|
84
|
+
hashArquivo,
|
|
85
|
+
retornoLexador,
|
|
86
|
+
retornoAvaliadorSintatico,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Importador = Importador;
|
|
91
91
|
//# sourceMappingURL=importador.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './importador';
|
|
2
|
-
export * from './retorno-importador';
|
|
1
|
+
export * from './importador';
|
|
2
|
+
export * from './retorno-importador';
|
|
@@ -1,19 +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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./importador"), exports);
|
|
18
|
-
__exportStar(require("./retorno-importador"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./importador"), exports);
|
|
18
|
+
__exportStar(require("./retorno-importador"), exports);
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RetornoAvaliadorSintatico } from '@designliquido/delegua/fontes/interfaces/retornos/retorno-avaliador-sintatico';
|
|
2
|
-
import { RetornoLexador } from '@designliquido/delegua/fontes/interfaces/retornos/retorno-lexador';
|
|
3
|
-
export interface RetornoImportador {
|
|
4
|
-
conteudoArquivo: string[];
|
|
5
|
-
nomeArquivo: string;
|
|
6
|
-
hashArquivo: number;
|
|
7
|
-
retornoLexador: RetornoLexador;
|
|
8
|
-
retornoAvaliadorSintatico: RetornoAvaliadorSintatico;
|
|
9
|
-
}
|
|
1
|
+
import { RetornoAvaliadorSintatico } from '@designliquido/delegua/fontes/interfaces/retornos/retorno-avaliador-sintatico';
|
|
2
|
+
import { RetornoLexador } from '@designliquido/delegua/fontes/interfaces/retornos/retorno-lexador';
|
|
3
|
+
export interface RetornoImportador {
|
|
4
|
+
conteudoArquivo: string[];
|
|
5
|
+
nomeArquivo: string;
|
|
6
|
+
hashArquivo: number;
|
|
7
|
+
retornoLexador: RetornoLexador;
|
|
8
|
+
retornoAvaliadorSintatico: RetornoAvaliadorSintatico;
|
|
9
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=retorno-importador.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { RetornoImportador } from '../importador';
|
|
2
|
-
import { AvaliadorSintaticoInterface, InterpretadorComDepuracaoInterface, InterpretadorInterface, LexadorInterface, RetornoExecucaoInterface, SimboloInterface } from '@designliquido/delegua/fontes/interfaces';
|
|
3
|
-
import { ImportadorInterface } from './importador-interface';
|
|
4
|
-
export interface DeleguaInterface {
|
|
5
|
-
dialeto: string;
|
|
6
|
-
arquivosAbertos: {
|
|
7
|
-
[identificador: string]: string;
|
|
8
|
-
};
|
|
9
|
-
conteudoArquivosAbertos: {
|
|
10
|
-
[identificador: string]: string[];
|
|
11
|
-
};
|
|
12
|
-
funcaoDeRetorno: Function;
|
|
13
|
-
interpretador: InterpretadorInterface | InterpretadorComDepuracaoInterface;
|
|
14
|
-
lexador: LexadorInterface;
|
|
15
|
-
avaliadorSintatico: AvaliadorSintaticoInterface;
|
|
16
|
-
importador: ImportadorInterface;
|
|
17
|
-
versao(): string;
|
|
18
|
-
carregarArquivo(caminhoRelativoArquivo: string): void;
|
|
19
|
-
executar(retornoImportador: RetornoImportador): Promise<RetornoExecucaoInterface>;
|
|
20
|
-
executarUmaLinha(linha: string): Promise<RetornoExecucaoInterface>;
|
|
21
|
-
reportar(linha: number, onde: any, mensagem: string): void;
|
|
22
|
-
erro(simbolo: SimboloInterface, mensagemDeErro: string): void;
|
|
23
|
-
erroEmTempoDeExecucao(erro: any): void;
|
|
24
|
-
}
|
|
1
|
+
import { RetornoImportador } from '../importador';
|
|
2
|
+
import { AvaliadorSintaticoInterface, InterpretadorComDepuracaoInterface, InterpretadorInterface, LexadorInterface, RetornoExecucaoInterface, SimboloInterface } from '@designliquido/delegua/fontes/interfaces';
|
|
3
|
+
import { ImportadorInterface } from './importador-interface';
|
|
4
|
+
export interface DeleguaInterface {
|
|
5
|
+
dialeto: string;
|
|
6
|
+
arquivosAbertos: {
|
|
7
|
+
[identificador: string]: string;
|
|
8
|
+
};
|
|
9
|
+
conteudoArquivosAbertos: {
|
|
10
|
+
[identificador: string]: string[];
|
|
11
|
+
};
|
|
12
|
+
funcaoDeRetorno: Function;
|
|
13
|
+
interpretador: InterpretadorInterface | InterpretadorComDepuracaoInterface;
|
|
14
|
+
lexador: LexadorInterface;
|
|
15
|
+
avaliadorSintatico: AvaliadorSintaticoInterface;
|
|
16
|
+
importador: ImportadorInterface;
|
|
17
|
+
versao(): string;
|
|
18
|
+
carregarArquivo(caminhoRelativoArquivo: string): void;
|
|
19
|
+
executar(retornoImportador: RetornoImportador): Promise<RetornoExecucaoInterface>;
|
|
20
|
+
executarUmaLinha(linha: string): Promise<RetornoExecucaoInterface>;
|
|
21
|
+
reportar(linha: number, onde: any, mensagem: string): void;
|
|
22
|
+
erro(simbolo: SimboloInterface, mensagemDeErro: string): void;
|
|
23
|
+
erroEmTempoDeExecucao(erro: any): void;
|
|
24
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=delegua-interface.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RetornoImportador } from '../importador';
|
|
2
|
-
export interface ImportadorInterface {
|
|
3
|
-
diretorioBase: string;
|
|
4
|
-
conteudoArquivosAbertos: {
|
|
5
|
-
[identificador: string]: string[];
|
|
6
|
-
};
|
|
7
|
-
importar(caminhoRelativoArquivo: string, importacaoInicial: boolean, traduzirJavaScriptParaDelegua: boolean): RetornoImportador;
|
|
8
|
-
}
|
|
1
|
+
import { RetornoImportador } from '../importador';
|
|
2
|
+
export interface ImportadorInterface {
|
|
3
|
+
diretorioBase: string;
|
|
4
|
+
conteudoArquivosAbertos: {
|
|
5
|
+
[identificador: string]: string[];
|
|
6
|
+
};
|
|
7
|
+
importar(caminhoRelativoArquivo: string, importacaoInicial: boolean, traduzirJavaScriptParaDelegua: boolean): RetornoImportador;
|
|
8
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=importador-interface.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './delegua-interface';
|
|
2
|
-
export * from './importador-interface';
|
|
1
|
+
export * from './delegua-interface';
|
|
2
|
+
export * from './importador-interface';
|
|
@@ -1,19 +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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./delegua-interface"), exports);
|
|
18
|
-
__exportStar(require("./importador-interface"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./delegua-interface"), exports);
|
|
18
|
+
__exportStar(require("./importador-interface"), exports);
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Importar } from "@designliquido/delegua/fontes/declaracoes";
|
|
2
|
-
import { DeleguaModulo } from "@designliquido/delegua/fontes/estruturas";
|
|
3
|
-
import { InterpretadorVisuAlgComDepuracao } from "@designliquido/delegua/fontes/interpretador/dialetos";
|
|
4
|
-
import { ImportadorInterface } from "../../interfaces";
|
|
5
|
-
export declare class InterpretadorVisuAlgComDepuracaoImportacao extends InterpretadorVisuAlgComDepuracao {
|
|
6
|
-
importador: ImportadorInterface;
|
|
7
|
-
constructor(importador: ImportadorInterface, diretorioBase: string, funcaoDeRetorno: Function);
|
|
8
|
-
/**
|
|
9
|
-
* Importa um arquivo como módulo.
|
|
10
|
-
* @param declaracao A declaração de importação.
|
|
11
|
-
* @returns Ou um `DeleguaModulo`, ou um dicionário de funções.
|
|
12
|
-
*/
|
|
13
|
-
visitarDeclaracaoImportar(declaracao: Importar): Promise<DeleguaModulo>;
|
|
14
|
-
}
|
|
1
|
+
import { Importar } from "@designliquido/delegua/fontes/declaracoes";
|
|
2
|
+
import { DeleguaModulo } from "@designliquido/delegua/fontes/estruturas";
|
|
3
|
+
import { InterpretadorVisuAlgComDepuracao } from "@designliquido/delegua/fontes/interpretador/dialetos";
|
|
4
|
+
import { ImportadorInterface } from "../../interfaces";
|
|
5
|
+
export declare class InterpretadorVisuAlgComDepuracaoImportacao extends InterpretadorVisuAlgComDepuracao {
|
|
6
|
+
importador: ImportadorInterface;
|
|
7
|
+
constructor(importador: ImportadorInterface, diretorioBase: string, funcaoDeRetorno: Function);
|
|
8
|
+
/**
|
|
9
|
+
* Importa um arquivo como módulo.
|
|
10
|
+
* @param declaracao A declaração de importação.
|
|
11
|
+
* @returns Ou um `DeleguaModulo`, ou um dicionário de funções.
|
|
12
|
+
*/
|
|
13
|
+
visitarDeclaracaoImportar(declaracao: Importar): Promise<DeleguaModulo>;
|
|
14
|
+
}
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.InterpretadorVisuAlgComDepuracaoImportacao = void 0;
|
|
30
|
-
const caminho = __importStar(require("node:path"));
|
|
31
|
-
const estruturas_1 = require("@designliquido/delegua/fontes/estruturas");
|
|
32
|
-
const dialetos_1 = require("@designliquido/delegua/fontes/interpretador/dialetos");
|
|
33
|
-
const mecanismo_importacao_bibliotecas_1 = __importDefault(require("../mecanismo-importacao-bibliotecas"));
|
|
34
|
-
class InterpretadorVisuAlgComDepuracaoImportacao extends dialetos_1.InterpretadorVisuAlgComDepuracao {
|
|
35
|
-
constructor(importador, diretorioBase, funcaoDeRetorno) {
|
|
36
|
-
super(diretorioBase, funcaoDeRetorno);
|
|
37
|
-
this.importador = importador;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Importa um arquivo como módulo.
|
|
41
|
-
* @param declaracao A declaração de importação.
|
|
42
|
-
* @returns Ou um `DeleguaModulo`, ou um dicionário de funções.
|
|
43
|
-
*/
|
|
44
|
-
async visitarDeclaracaoImportar(declaracao) {
|
|
45
|
-
const caminhoRelativo = await this.avaliar(declaracao.caminho);
|
|
46
|
-
const caminhoTotal = caminho.join(this.diretorioBase, caminhoRelativo);
|
|
47
|
-
const nomeArquivo = caminho.basename(caminhoTotal);
|
|
48
|
-
if (!caminhoTotal.endsWith('.delegua')) {
|
|
49
|
-
try {
|
|
50
|
-
return await (0, mecanismo_importacao_bibliotecas_1.default)(caminhoRelativo);
|
|
51
|
-
}
|
|
52
|
-
catch (erro) {
|
|
53
|
-
this.erros.push(erro);
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const conteudoImportacao = this.importador.importar(caminhoRelativo, false, false);
|
|
58
|
-
const retornoInterpretador = await this.interpretar(conteudoImportacao.retornoAvaliadorSintatico.declaracoes, true);
|
|
59
|
-
const funcoesChamaveis = this.pilhaEscoposExecucao.obterTodasDeleguaFuncao();
|
|
60
|
-
const declaracoesClasse = this.pilhaEscoposExecucao.obterTodasDeclaracaoClasse();
|
|
61
|
-
if (declaracoesClasse.hasOwnProperty('super')) {
|
|
62
|
-
delete declaracoesClasse['super'];
|
|
63
|
-
}
|
|
64
|
-
const novoModulo = new estruturas_1.DeleguaModulo();
|
|
65
|
-
const chavesFuncoesChamaveis = Object.keys(funcoesChamaveis);
|
|
66
|
-
for (let i = 0; i < chavesFuncoesChamaveis.length; i++) {
|
|
67
|
-
novoModulo.componentes[chavesFuncoesChamaveis[i]] = funcoesChamaveis[chavesFuncoesChamaveis[i]];
|
|
68
|
-
}
|
|
69
|
-
const chavesDeclaracoesClasse = Object.keys(declaracoesClasse);
|
|
70
|
-
for (let i = 0; i < chavesDeclaracoesClasse.length; i++) {
|
|
71
|
-
novoModulo.componentes[chavesDeclaracoesClasse[i]] = declaracoesClasse[chavesDeclaracoesClasse[i]];
|
|
72
|
-
}
|
|
73
|
-
return novoModulo;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.InterpretadorVisuAlgComDepuracaoImportacao = InterpretadorVisuAlgComDepuracaoImportacao;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.InterpretadorVisuAlgComDepuracaoImportacao = void 0;
|
|
30
|
+
const caminho = __importStar(require("node:path"));
|
|
31
|
+
const estruturas_1 = require("@designliquido/delegua/fontes/estruturas");
|
|
32
|
+
const dialetos_1 = require("@designliquido/delegua/fontes/interpretador/dialetos");
|
|
33
|
+
const mecanismo_importacao_bibliotecas_1 = __importDefault(require("../mecanismo-importacao-bibliotecas"));
|
|
34
|
+
class InterpretadorVisuAlgComDepuracaoImportacao extends dialetos_1.InterpretadorVisuAlgComDepuracao {
|
|
35
|
+
constructor(importador, diretorioBase, funcaoDeRetorno) {
|
|
36
|
+
super(diretorioBase, funcaoDeRetorno);
|
|
37
|
+
this.importador = importador;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Importa um arquivo como módulo.
|
|
41
|
+
* @param declaracao A declaração de importação.
|
|
42
|
+
* @returns Ou um `DeleguaModulo`, ou um dicionário de funções.
|
|
43
|
+
*/
|
|
44
|
+
async visitarDeclaracaoImportar(declaracao) {
|
|
45
|
+
const caminhoRelativo = await this.avaliar(declaracao.caminho);
|
|
46
|
+
const caminhoTotal = caminho.join(this.diretorioBase, caminhoRelativo);
|
|
47
|
+
const nomeArquivo = caminho.basename(caminhoTotal);
|
|
48
|
+
if (!caminhoTotal.endsWith('.delegua')) {
|
|
49
|
+
try {
|
|
50
|
+
return await (0, mecanismo_importacao_bibliotecas_1.default)(caminhoRelativo);
|
|
51
|
+
}
|
|
52
|
+
catch (erro) {
|
|
53
|
+
this.erros.push(erro);
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const conteudoImportacao = this.importador.importar(caminhoRelativo, false, false);
|
|
58
|
+
const retornoInterpretador = await this.interpretar(conteudoImportacao.retornoAvaliadorSintatico.declaracoes, true);
|
|
59
|
+
const funcoesChamaveis = this.pilhaEscoposExecucao.obterTodasDeleguaFuncao();
|
|
60
|
+
const declaracoesClasse = this.pilhaEscoposExecucao.obterTodasDeclaracaoClasse();
|
|
61
|
+
if (declaracoesClasse.hasOwnProperty('super')) {
|
|
62
|
+
delete declaracoesClasse['super'];
|
|
63
|
+
}
|
|
64
|
+
const novoModulo = new estruturas_1.DeleguaModulo();
|
|
65
|
+
const chavesFuncoesChamaveis = Object.keys(funcoesChamaveis);
|
|
66
|
+
for (let i = 0; i < chavesFuncoesChamaveis.length; i++) {
|
|
67
|
+
novoModulo.componentes[chavesFuncoesChamaveis[i]] = funcoesChamaveis[chavesFuncoesChamaveis[i]];
|
|
68
|
+
}
|
|
69
|
+
const chavesDeclaracoesClasse = Object.keys(declaracoesClasse);
|
|
70
|
+
for (let i = 0; i < chavesDeclaracoesClasse.length; i++) {
|
|
71
|
+
novoModulo.componentes[chavesDeclaracoesClasse[i]] = declaracoesClasse[chavesDeclaracoesClasse[i]];
|
|
72
|
+
}
|
|
73
|
+
return novoModulo;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.InterpretadorVisuAlgComDepuracaoImportacao = InterpretadorVisuAlgComDepuracaoImportacao;
|
|
77
77
|
//# sourceMappingURL=interpretador-visualg-com-depuracao-importacao.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './interpretador';
|
|
1
|
+
export * from './interpretador';
|