@designliquido/delegua 0.7.6 → 0.8.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/bin/package.json +70 -65
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.d.ts +63 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js +180 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -0
- package/fontes/avaliador-sintatico/avaliador-sintatico.js +188 -188
- package/fontes/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts +34 -32
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js +154 -148
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.d.ts +7 -6
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js +144 -142
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.d.ts +48 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js +291 -0
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js.map +1 -0
- package/fontes/construtos/construto.d.ts +1 -0
- package/fontes/construtos/literal.d.ts +2 -2
- package/fontes/construtos/literal.js.map +1 -1
- package/fontes/construtos/super.d.ts +4 -4
- package/fontes/construtos/super.js.map +1 -1
- package/fontes/construtos/vetor.d.ts +3 -3
- package/fontes/construtos/vetor.js.map +1 -1
- package/fontes/declaracoes/bloco.d.ts +2 -2
- package/fontes/declaracoes/bloco.js.map +1 -1
- package/fontes/declaracoes/escolha.d.ts +5 -2
- package/fontes/declaracoes/escolha.js +6 -3
- package/fontes/declaracoes/escolha.js.map +1 -1
- package/fontes/declaracoes/escreva.d.ts +3 -3
- package/fontes/declaracoes/escreva.js.map +1 -1
- package/fontes/declaracoes/index.d.ts +1 -0
- package/fontes/declaracoes/index.js +1 -0
- package/fontes/declaracoes/index.js.map +1 -1
- package/fontes/declaracoes/leia.d.ts +12 -0
- package/fontes/declaracoes/leia.js +37 -0
- package/fontes/declaracoes/leia.js.map +1 -0
- package/fontes/declaracoes/var.d.ts +3 -2
- package/fontes/declaracoes/var.js.map +1 -1
- package/fontes/delegua.d.ts +2 -2
- package/fontes/delegua.js +37 -21
- package/fontes/delegua.js.map +1 -1
- package/fontes/interfaces/avaliador-sintatico-interface.d.ts +3 -5
- package/fontes/interfaces/interpretador-interface.d.ts +8 -7
- package/fontes/interfaces/lexador-interface.d.ts +2 -2
- package/fontes/interpretador/dialetos/egua-classico.d.ts +2 -1
- package/fontes/interpretador/dialetos/egua-classico.js +30 -27
- package/fontes/interpretador/dialetos/egua-classico.js.map +1 -1
- package/fontes/interpretador/interpretador.d.ts +9 -3
- package/fontes/interpretador/interpretador.js +38 -30
- package/fontes/interpretador/interpretador.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-egua-classico.js +35 -35
- package/fontes/lexador/dialetos/lexador-egua-classico.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-eguap.js +35 -35
- package/fontes/lexador/dialetos/lexador-eguap.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-visualg.d.ts +16 -0
- package/fontes/lexador/dialetos/lexador-visualg.js +225 -0
- package/fontes/lexador/dialetos/lexador-visualg.js.map +1 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.d.ts +26 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js +32 -0
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js.map +1 -0
- package/fontes/lexador/lexador-base-linha-unica.d.ts +33 -0
- package/fontes/lexador/lexador-base-linha-unica.js +92 -0
- package/fontes/lexador/lexador-base-linha-unica.js.map +1 -0
- package/fontes/lexador/lexador.d.ts +3 -3
- package/fontes/lexador/lexador.js +43 -43
- package/fontes/lexador/lexador.js.map +1 -1
- package/fontes/lexador/palavras-reservadas.js +33 -33
- package/fontes/lexador/palavras-reservadas.js.map +1 -1
- package/fontes/tipos/avaliador-sintatico-egua-e-eguap-classico-returno-tipo.d.ts +5 -0
- package/fontes/tipos/avaliador-sintatico-egua-e-eguap-classico-returno-tipo.js +3 -0
- package/fontes/tipos/avaliador-sintatico-egua-e-eguap-classico-returno-tipo.js.map +1 -0
- package/fontes/tipos-de-simbolos/comum.d.ts +18 -0
- package/fontes/tipos-de-simbolos/comum.js +20 -0
- package/fontes/tipos-de-simbolos/comum.js.map +1 -0
- package/fontes/{tipos-de-simbolos.d.ts → tipos-de-simbolos/delegua.d.ts} +0 -0
- package/fontes/{tipos-de-simbolos.js → tipos-de-simbolos/delegua.js} +1 -1
- package/fontes/tipos-de-simbolos/delegua.js.map +1 -0
- package/fontes/{lexador/dialetos/tipos-de-simbolos-eguap.d.ts → tipos-de-simbolos/eguap.d.ts} +0 -0
- package/fontes/{lexador/dialetos/tipos-de-simbolos-eguap.js → tipos-de-simbolos/eguap.js} +1 -1
- package/fontes/tipos-de-simbolos/eguap.js.map +1 -0
- package/fontes/tipos-de-simbolos/visualg.d.ts +47 -0
- package/fontes/tipos-de-simbolos/visualg.js +49 -0
- package/fontes/tipos-de-simbolos/visualg.js.map +1 -0
- package/package.json +70 -65
- package/testes/avaliador-sintatico.test.js.map +1 -1
- package/testes/egua-classico/avaliador-sintatico.test.js +4 -1
- package/testes/egua-classico/avaliador-sintatico.test.js.map +1 -1
- package/testes/lexador.test.js +45 -45
- package/testes/lexador.test.js.map +1 -1
- package/testes/visualg/avaliador-sintatico.test.d.ts +1 -0
- package/testes/visualg/avaliador-sintatico.test.js +113 -0
- package/testes/visualg/avaliador-sintatico.test.js.map +1 -0
- package/testes/visualg/lexador.test.d.ts +1 -0
- package/testes/visualg/lexador.test.js +67 -0
- package/testes/visualg/lexador.test.js.map +1 -0
- package/fontes/lexador/dialetos/tipos-de-simbolos-eguap.js.map +0 -1
- package/fontes/tipos-de-simbolos.js.map +0 -1
package/bin/package.json
CHANGED
|
@@ -1,70 +1,75 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/DesignLiquido/delegua.git"
|
|
21
|
-
},
|
|
22
|
-
"bin": {
|
|
23
|
-
"delegua": "./bin/delegua"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"egua",
|
|
27
|
-
"eguap",
|
|
28
|
-
"delegua"
|
|
29
|
-
],
|
|
30
|
-
"author": "Leonel Sanches da Silva",
|
|
31
|
-
"contributors": [
|
|
32
|
-
{
|
|
33
|
-
"name": "Leonel Sanches da Silva",
|
|
34
|
-
"url": "https://www.linkedin.com/in/leonelsanchesdasilva/"
|
|
2
|
+
"name": "@designliquido/delegua",
|
|
3
|
+
"version": "0.7.6",
|
|
4
|
+
"description": "Linguagem de programação simples e moderna usando português",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"empacotar": "rm -Rf ./dist && tsc && copyfiles -V ./bin/delegua ./bin/delegua.cmd ./dist && copyfiles -V ./package.json ./dist/bin && copyfiles -V ./README.md ./dist",
|
|
8
|
+
"lair": "ts-node index.ts",
|
|
9
|
+
"publicar-npm": "npm publish ./dist --access public",
|
|
10
|
+
"testes": "./bin/delegua-ts testes/exemplos/testes.egua",
|
|
11
|
+
"testes:delegua:bhaskara": "./bin/delegua-ts testes/exemplos/dialetos/egua-classico/bhaskara.egua",
|
|
12
|
+
"testes:delegua:fibonacci": "./bin/delegua-ts testes/exemplos/dialetos/egua-classico/fibonacci.egua",
|
|
13
|
+
"testes:egua-classico": "./bin/delegua-ts --dialeto egua testes/exemplos/dialetos/egua-classico/testes.egua",
|
|
14
|
+
"testes:servidor-depuracao": "ts-node ./fontes/depuracao/servidor-depuracao.ts",
|
|
15
|
+
"testes-unitarios": "jest --coverage",
|
|
16
|
+
"observar-testes-unitarios": "jest --watchAll",
|
|
17
|
+
"observar-testes-unitarios-com-coverage": "jest --coverage --watchAll"
|
|
35
18
|
},
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/DesignLiquido/delegua.git"
|
|
39
22
|
},
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
"bin": {
|
|
24
|
+
"delegua": "./bin/delegua"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"egua",
|
|
28
|
+
"eguap",
|
|
29
|
+
"delegua"
|
|
30
|
+
],
|
|
31
|
+
"author": "Leonel Sanches da Silva",
|
|
32
|
+
"contributors": [
|
|
33
|
+
{
|
|
34
|
+
"name": "Leonel Sanches da Silva",
|
|
35
|
+
"url": "https://www.linkedin.com/in/leonelsanchesdasilva/"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "Samuel Renan Gonçalves Vaz",
|
|
39
|
+
"url": "https://www.linkedin.com/in/samuel-renan-gon%C3%A7alves-vaz-b6b83a103/"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Alessandro Fuhr de Mello",
|
|
43
|
+
"url": "https://github.com/AlessandroFMello"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "Italo Brito Brandão",
|
|
47
|
+
"url": "https://github.com/ItaloCobains"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/DesignLiquido/delegua/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/DesignLiquido/delegua#readme",
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@babel/preset-env": "^7.12.1",
|
|
57
|
+
"@designliquido/delegua-estatistica": "^0.0.5",
|
|
58
|
+
"@designliquido/delegua-fisica": "^0.0.2",
|
|
59
|
+
"@designliquido/delegua-matematica": "^0.0.2",
|
|
60
|
+
"@designliquido/delegua-tempo": "^0.0.1",
|
|
61
|
+
"@types/jest": "^29.0.3",
|
|
62
|
+
"@types/node": "^17.0.13",
|
|
63
|
+
"copyfiles": "^2.4.1",
|
|
64
|
+
"jest": "^29.0.3",
|
|
65
|
+
"release-it": "^14.14.2",
|
|
66
|
+
"ts-jest": "^29.0.1",
|
|
67
|
+
"ts-node": "^10.9.1",
|
|
68
|
+
"typescript": "^4.6.3"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"browser-process-hrtime": "^1.0.0",
|
|
72
|
+
"chalk": "4.1.2",
|
|
73
|
+
"commander": "^8.3.0"
|
|
43
74
|
}
|
|
44
|
-
],
|
|
45
|
-
"license": "MIT",
|
|
46
|
-
"bugs": {
|
|
47
|
-
"url": "https://github.com/DesignLiquido/delegua/issues"
|
|
48
|
-
},
|
|
49
|
-
"homepage": "https://github.com/DesignLiquido/delegua#readme",
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@babel/preset-env": "^7.12.1",
|
|
52
|
-
"@designliquido/delegua-estatistica": "^0.0.5",
|
|
53
|
-
"@designliquido/delegua-fisica": "^0.0.2",
|
|
54
|
-
"@designliquido/delegua-matematica": "^0.0.2",
|
|
55
|
-
"@designliquido/delegua-tempo": "^0.0.1",
|
|
56
|
-
"@types/jest": "^29.0.3",
|
|
57
|
-
"@types/node": "^17.0.13",
|
|
58
|
-
"copyfiles": "^2.4.1",
|
|
59
|
-
"jest": "^29.0.3",
|
|
60
|
-
"release-it": "^14.14.2",
|
|
61
|
-
"ts-jest": "^29.0.1",
|
|
62
|
-
"ts-node": "^10.9.1",
|
|
63
|
-
"typescript": "^4.6.3"
|
|
64
|
-
},
|
|
65
|
-
"dependencies": {
|
|
66
|
-
"browser-process-hrtime": "^1.0.0",
|
|
67
|
-
"chalk": "4.1.2",
|
|
68
|
-
"commander": "^8.3.0"
|
|
69
|
-
}
|
|
70
75
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Construto, Funcao } from '../construtos';
|
|
2
|
+
import { Escreva, Expressao, Se, Enquanto, Para, Sustar, Continua, Retorna, Escolha, Importar, Tente, Fazer, Var, Funcao as FuncaoDeclaracao, Classe, Declaracao } from '../declaracoes';
|
|
3
|
+
import { AvaliadorSintaticoInterface, SimboloInterface } from '../interfaces';
|
|
4
|
+
import { RetornoLexador, RetornoAvaliadorSintatico } from '../interfaces/retornos';
|
|
5
|
+
import { ErroAvaliadorSintatico } from './erro-avaliador-sintatico';
|
|
6
|
+
/**
|
|
7
|
+
* O Avaliador Sintático Base é uma tentativa de mapear métodos em comum
|
|
8
|
+
* entre todos os outros Avaliadores Sintáticos. Depende de um dicionário
|
|
9
|
+
* de tipos de símbolos comuns entre todos os dialetos.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class AvaliadorSintaticoBase implements AvaliadorSintaticoInterface {
|
|
12
|
+
simbolos: SimboloInterface[];
|
|
13
|
+
erros: ErroAvaliadorSintatico[];
|
|
14
|
+
atual: number;
|
|
15
|
+
ciclos: number;
|
|
16
|
+
consumir(tipo: string, mensagemDeErro: string): SimboloInterface;
|
|
17
|
+
erro(simbolo: SimboloInterface, mensagemDeErro: string): ErroAvaliadorSintatico;
|
|
18
|
+
verificarTipoSimboloAtual(tipo: string): boolean;
|
|
19
|
+
verificarTipoProximoSimbolo(tipo: string): boolean;
|
|
20
|
+
estaNoFinal(): boolean;
|
|
21
|
+
avancarEDevolverAnterior(): SimboloInterface;
|
|
22
|
+
verificarSeSimboloAtualEIgualA(...argumentos: string[]): boolean;
|
|
23
|
+
abstract primario(): Construto;
|
|
24
|
+
finalizarChamada(entidadeChamada: Construto): Construto;
|
|
25
|
+
abstract chamar(): Construto;
|
|
26
|
+
unario(): Construto;
|
|
27
|
+
exponenciacao(): Construto;
|
|
28
|
+
multiplicar(): Construto;
|
|
29
|
+
adicaoOuSubtracao(): Construto;
|
|
30
|
+
bitFill(): Construto;
|
|
31
|
+
bitE(): Construto;
|
|
32
|
+
bitOu(): Construto;
|
|
33
|
+
comparar(): Construto;
|
|
34
|
+
comparacaoIgualdade(): Construto;
|
|
35
|
+
em(): Construto;
|
|
36
|
+
e(): Construto;
|
|
37
|
+
ou(): Construto;
|
|
38
|
+
/**
|
|
39
|
+
* `atribuir()` deve chamar `ou()` na implementação.
|
|
40
|
+
*/
|
|
41
|
+
abstract atribuir(): Construto;
|
|
42
|
+
expressao(): Construto;
|
|
43
|
+
abstract declaracaoEscreva(): Escreva;
|
|
44
|
+
declaracaoExpressao(): Expressao;
|
|
45
|
+
abstract blocoEscopo(): Declaracao[];
|
|
46
|
+
declaracaoSe(): Se;
|
|
47
|
+
abstract declaracaoEnquanto(): Enquanto;
|
|
48
|
+
abstract declaracaoPara(): Para;
|
|
49
|
+
declaracaoSustar(): Sustar;
|
|
50
|
+
declaracaoContinua(): Continua;
|
|
51
|
+
declaracaoRetorna(): Retorna;
|
|
52
|
+
abstract declaracaoEscolha(): Escolha;
|
|
53
|
+
declaracaoImportar(): Importar;
|
|
54
|
+
declaracaoTente(): Tente;
|
|
55
|
+
abstract declaracaoFazer(): Fazer;
|
|
56
|
+
resolverDeclaracao(): void;
|
|
57
|
+
declaracaoDeVariavel(): Var;
|
|
58
|
+
funcao(tipo: string): FuncaoDeclaracao;
|
|
59
|
+
abstract corpoDaFuncao(tipo: string): Funcao;
|
|
60
|
+
declaracaoDeClasse(): Classe;
|
|
61
|
+
abstract declaracao(): Declaracao;
|
|
62
|
+
abstract analisar(retornoLexador: RetornoLexador, hashArquivo?: number): RetornoAvaliadorSintatico;
|
|
63
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AvaliadorSintaticoBase = void 0;
|
|
7
|
+
var construtos_1 = require("../construtos");
|
|
8
|
+
var declaracoes_1 = require("../declaracoes");
|
|
9
|
+
var erro_avaliador_sintatico_1 = require("./erro-avaliador-sintatico");
|
|
10
|
+
var comum_1 = __importDefault(require("../tipos-de-simbolos/comum"));
|
|
11
|
+
/**
|
|
12
|
+
* O Avaliador Sintático Base é uma tentativa de mapear métodos em comum
|
|
13
|
+
* entre todos os outros Avaliadores Sintáticos. Depende de um dicionário
|
|
14
|
+
* de tipos de símbolos comuns entre todos os dialetos.
|
|
15
|
+
*/
|
|
16
|
+
var AvaliadorSintaticoBase = /** @class */ (function () {
|
|
17
|
+
function AvaliadorSintaticoBase() {
|
|
18
|
+
}
|
|
19
|
+
AvaliadorSintaticoBase.prototype.consumir = function (tipo, mensagemDeErro) {
|
|
20
|
+
if (this.verificarTipoSimboloAtual(tipo))
|
|
21
|
+
return this.avancarEDevolverAnterior();
|
|
22
|
+
throw this.erro(this.simbolos[this.atual], mensagemDeErro);
|
|
23
|
+
};
|
|
24
|
+
AvaliadorSintaticoBase.prototype.erro = function (simbolo, mensagemDeErro) {
|
|
25
|
+
var excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(simbolo, mensagemDeErro);
|
|
26
|
+
this.erros.push(excecao);
|
|
27
|
+
return excecao;
|
|
28
|
+
};
|
|
29
|
+
AvaliadorSintaticoBase.prototype.verificarTipoSimboloAtual = function (tipo) {
|
|
30
|
+
if (this.estaNoFinal())
|
|
31
|
+
return false;
|
|
32
|
+
return this.simbolos[this.atual].tipo === tipo;
|
|
33
|
+
};
|
|
34
|
+
AvaliadorSintaticoBase.prototype.verificarTipoProximoSimbolo = function (tipo) {
|
|
35
|
+
return this.simbolos[this.atual + 1].tipo === tipo;
|
|
36
|
+
};
|
|
37
|
+
AvaliadorSintaticoBase.prototype.estaNoFinal = function () {
|
|
38
|
+
return this.atual === this.simbolos.length;
|
|
39
|
+
};
|
|
40
|
+
AvaliadorSintaticoBase.prototype.avancarEDevolverAnterior = function () {
|
|
41
|
+
if (!this.estaNoFinal())
|
|
42
|
+
this.atual += 1;
|
|
43
|
+
return this.simbolos[this.atual - 1];
|
|
44
|
+
};
|
|
45
|
+
AvaliadorSintaticoBase.prototype.verificarSeSimboloAtualEIgualA = function () {
|
|
46
|
+
var argumentos = [];
|
|
47
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
48
|
+
argumentos[_i] = arguments[_i];
|
|
49
|
+
}
|
|
50
|
+
for (var i = 0; i < argumentos.length; i++) {
|
|
51
|
+
var tipoAtual = argumentos[i];
|
|
52
|
+
if (this.verificarTipoSimboloAtual(tipoAtual)) {
|
|
53
|
+
this.avancarEDevolverAnterior();
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
AvaliadorSintaticoBase.prototype.finalizarChamada = function (entidadeChamada) {
|
|
60
|
+
throw new Error('Método não implementado.');
|
|
61
|
+
};
|
|
62
|
+
AvaliadorSintaticoBase.prototype.unario = function () {
|
|
63
|
+
if (this.verificarSeSimboloAtualEIgualA(comum_1.default.NEGACAO, comum_1.default.SUBTRACAO)) {
|
|
64
|
+
var operador = this.simbolos[this.atual - 1];
|
|
65
|
+
var direito = this.unario();
|
|
66
|
+
return new construtos_1.Unario(-1, operador, direito);
|
|
67
|
+
}
|
|
68
|
+
return this.chamar();
|
|
69
|
+
};
|
|
70
|
+
AvaliadorSintaticoBase.prototype.exponenciacao = function () {
|
|
71
|
+
throw new Error('Método não implementado.');
|
|
72
|
+
};
|
|
73
|
+
AvaliadorSintaticoBase.prototype.multiplicar = function () {
|
|
74
|
+
var expressao = this.unario();
|
|
75
|
+
while (this.verificarSeSimboloAtualEIgualA(comum_1.default.DIVISAO, comum_1.default.MULTIPLICACAO, comum_1.default.MODULO)) {
|
|
76
|
+
var operador = this.simbolos[this.atual - 1];
|
|
77
|
+
var direito = this.unario();
|
|
78
|
+
expressao = new construtos_1.Binario(-1, expressao, operador, direito);
|
|
79
|
+
}
|
|
80
|
+
return expressao;
|
|
81
|
+
};
|
|
82
|
+
AvaliadorSintaticoBase.prototype.adicaoOuSubtracao = function () {
|
|
83
|
+
var expressao = this.multiplicar();
|
|
84
|
+
while (this.verificarSeSimboloAtualEIgualA(comum_1.default.SUBTRACAO, comum_1.default.ADICAO)) {
|
|
85
|
+
var operador = this.simbolos[this.atual - 1];
|
|
86
|
+
var direito = this.multiplicar();
|
|
87
|
+
expressao = new construtos_1.Binario(-1, expressao, operador, direito);
|
|
88
|
+
}
|
|
89
|
+
return expressao;
|
|
90
|
+
};
|
|
91
|
+
AvaliadorSintaticoBase.prototype.bitFill = function () {
|
|
92
|
+
throw new Error('Método não implementado.');
|
|
93
|
+
};
|
|
94
|
+
AvaliadorSintaticoBase.prototype.bitE = function () {
|
|
95
|
+
throw new Error('Método não implementado.');
|
|
96
|
+
};
|
|
97
|
+
AvaliadorSintaticoBase.prototype.bitOu = function () {
|
|
98
|
+
throw new Error('Método não implementado.');
|
|
99
|
+
};
|
|
100
|
+
AvaliadorSintaticoBase.prototype.comparar = function () {
|
|
101
|
+
var expressao = this.adicaoOuSubtracao();
|
|
102
|
+
while (this.verificarSeSimboloAtualEIgualA(comum_1.default.MAIOR, comum_1.default.MAIOR_IGUAL, comum_1.default.MENOR, comum_1.default.MENOR_IGUAL)) {
|
|
103
|
+
var operador = this.simbolos[this.atual - 1];
|
|
104
|
+
var direito = this.adicaoOuSubtracao();
|
|
105
|
+
expressao = new construtos_1.Binario(-1, expressao, operador, direito);
|
|
106
|
+
}
|
|
107
|
+
return expressao;
|
|
108
|
+
};
|
|
109
|
+
AvaliadorSintaticoBase.prototype.comparacaoIgualdade = function () {
|
|
110
|
+
var expressao = this.comparar();
|
|
111
|
+
while (this.verificarSeSimboloAtualEIgualA(comum_1.default.DIFERENTE, comum_1.default.IGUAL)) {
|
|
112
|
+
var operador = this.simbolos[this.atual - 1];
|
|
113
|
+
var direito = this.comparar();
|
|
114
|
+
expressao = new construtos_1.Binario(-1, expressao, operador, direito);
|
|
115
|
+
}
|
|
116
|
+
return expressao;
|
|
117
|
+
};
|
|
118
|
+
AvaliadorSintaticoBase.prototype.em = function () {
|
|
119
|
+
throw new Error('Método não implementado.');
|
|
120
|
+
};
|
|
121
|
+
AvaliadorSintaticoBase.prototype.e = function () {
|
|
122
|
+
var expressao = this.comparacaoIgualdade();
|
|
123
|
+
while (this.verificarSeSimboloAtualEIgualA(comum_1.default.E)) {
|
|
124
|
+
var operador = this.simbolos[this.atual - 1];
|
|
125
|
+
var direito = this.comparacaoIgualdade();
|
|
126
|
+
expressao = new construtos_1.Logico(-1, expressao, operador, direito);
|
|
127
|
+
}
|
|
128
|
+
return expressao;
|
|
129
|
+
};
|
|
130
|
+
AvaliadorSintaticoBase.prototype.ou = function () {
|
|
131
|
+
var expressao = this.e();
|
|
132
|
+
while (this.verificarSeSimboloAtualEIgualA(comum_1.default.OU)) {
|
|
133
|
+
var operador = this.simbolos[this.atual - 1];
|
|
134
|
+
var direito = this.e();
|
|
135
|
+
expressao = new construtos_1.Logico(-1, expressao, operador, direito);
|
|
136
|
+
}
|
|
137
|
+
return expressao;
|
|
138
|
+
};
|
|
139
|
+
AvaliadorSintaticoBase.prototype.expressao = function () {
|
|
140
|
+
return this.atribuir();
|
|
141
|
+
};
|
|
142
|
+
AvaliadorSintaticoBase.prototype.declaracaoExpressao = function () {
|
|
143
|
+
throw new Error('Método não implementado.');
|
|
144
|
+
};
|
|
145
|
+
AvaliadorSintaticoBase.prototype.declaracaoSe = function () {
|
|
146
|
+
throw new Error('Método não implementado.');
|
|
147
|
+
};
|
|
148
|
+
AvaliadorSintaticoBase.prototype.declaracaoSustar = function () {
|
|
149
|
+
throw new Error('Método não implementado.');
|
|
150
|
+
};
|
|
151
|
+
AvaliadorSintaticoBase.prototype.declaracaoContinua = function () {
|
|
152
|
+
throw new Error('Método não implementado.');
|
|
153
|
+
};
|
|
154
|
+
AvaliadorSintaticoBase.prototype.declaracaoRetorna = function () {
|
|
155
|
+
throw new Error('Método não implementado.');
|
|
156
|
+
};
|
|
157
|
+
AvaliadorSintaticoBase.prototype.declaracaoImportar = function () {
|
|
158
|
+
throw new Error('Método não implementado.');
|
|
159
|
+
};
|
|
160
|
+
AvaliadorSintaticoBase.prototype.declaracaoTente = function () {
|
|
161
|
+
throw new Error('Método não implementado.');
|
|
162
|
+
};
|
|
163
|
+
AvaliadorSintaticoBase.prototype.resolverDeclaracao = function () {
|
|
164
|
+
throw new Error('Método não implementado.');
|
|
165
|
+
};
|
|
166
|
+
AvaliadorSintaticoBase.prototype.declaracaoDeVariavel = function () {
|
|
167
|
+
throw new Error('Método não implementado.');
|
|
168
|
+
};
|
|
169
|
+
AvaliadorSintaticoBase.prototype.funcao = function (tipo) {
|
|
170
|
+
var simboloFuncao = this.avancarEDevolverAnterior();
|
|
171
|
+
var nomeFuncao = this.consumir(comum_1.default.IDENTIFICADOR, "Esperado nome ".concat(tipo, "."));
|
|
172
|
+
return new declaracoes_1.Funcao(nomeFuncao, this.corpoDaFuncao(tipo));
|
|
173
|
+
};
|
|
174
|
+
AvaliadorSintaticoBase.prototype.declaracaoDeClasse = function () {
|
|
175
|
+
throw new Error('Método não implementado.');
|
|
176
|
+
};
|
|
177
|
+
return AvaliadorSintaticoBase;
|
|
178
|
+
}());
|
|
179
|
+
exports.AvaliadorSintaticoBase = AvaliadorSintaticoBase;
|
|
180
|
+
//# sourceMappingURL=avaliador-sintatico-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avaliador-sintatico-base.js","sourceRoot":"","sources":["../../../fontes/avaliador-sintatico/avaliador-sintatico-base.ts"],"names":[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