@designliquido/delegua 0.0.2 → 0.1.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/.github/CONTRIBUTING.md +37 -0
- package/.github/workflows/principal.yml +3 -1
- package/.release-it.json +2 -1
- package/.vscode/launch.json +43 -8
- package/README.md +9 -1
- package/bin/delegua +2 -2
- package/bin/delegua.cmd +1 -1
- package/index.ts +29 -0
- package/package.json +9 -4
- package/src/ambiente.ts +56 -0
- package/src/avaliador-sintatico/dialetos/egua-classico.ts +983 -0
- package/src/avaliador-sintatico/dialetos/index.ts +1 -0
- package/src/avaliador-sintatico/index.ts +983 -0
- package/src/avaliador-sintatico/parser-error.ts +1 -0
- package/src/{lib/globalLib.js → bibliotecas/bibliotecaGlobal.ts} +34 -34
- package/src/{lib/importStdlib.js → bibliotecas/importarBiblioteca.ts} +9 -9
- package/src/construtos/assign-subscript.ts +19 -0
- package/src/construtos/atribuir.ts +17 -0
- package/src/construtos/binario.ts +19 -0
- package/src/construtos/call.ts +19 -0
- package/src/construtos/conjunto.ts +19 -0
- package/src/construtos/dicionario.ts +17 -0
- package/src/construtos/expr.ts +3 -0
- package/src/construtos/funcao.ts +17 -0
- package/src/construtos/get.ts +17 -0
- package/src/construtos/grouping.ts +15 -0
- package/src/construtos/index.ts +18 -0
- package/src/construtos/isto.ts +15 -0
- package/src/construtos/literal.ts +15 -0
- package/src/construtos/logical.ts +19 -0
- package/src/construtos/subscript.ts +19 -0
- package/src/construtos/super.ts +17 -0
- package/src/construtos/unario.ts +17 -0
- package/src/construtos/variavel.ts +15 -0
- package/src/construtos/vetor.ts +15 -0
- package/src/{stmt.js → declaracoes/index.ts} +79 -51
- package/src/delegua.ts +156 -0
- package/src/estruturas/callable.ts +11 -0
- package/src/estruturas/{classe.js → classe.ts} +11 -7
- package/src/estruturas/{funcaoPadrao.js → funcao-padrao.ts} +8 -4
- package/src/estruturas/funcao.ts +70 -0
- package/src/estruturas/index.ts +6 -0
- package/src/estruturas/{instancia.js → instancia.ts} +12 -9
- package/src/estruturas/modulo.ts +11 -0
- package/src/excecoes/break-exception.ts +1 -0
- package/src/excecoes/continue-exception.ts +1 -0
- package/src/excecoes/erro-em-tempo-de-execucao.ts +11 -0
- package/src/excecoes/index.ts +4 -0
- package/src/excecoes/return-exception.ts +10 -0
- package/src/interfaces/avaliador-sintatico-interface.ts +58 -0
- package/src/interfaces/index.ts +6 -0
- package/src/interfaces/interpretador-interface.ts +52 -0
- package/src/interfaces/lexador-interface.ts +24 -0
- package/src/interfaces/pilha-interface.ts +7 -0
- package/src/interfaces/resolvedor-interface.ts +49 -0
- package/src/interfaces/simbolo-interface.ts +6 -0
- package/src/interpretador/dialetos/egua-classico.ts +825 -0
- package/src/interpretador/dialetos/index.ts +1 -0
- package/src/interpretador/index.ts +825 -0
- package/src/lexador/dialetos/egua-classico.ts +333 -0
- package/src/lexador/dialetos/index.ts +1 -0
- package/src/{lexer.js → lexador/index.ts} +38 -21
- package/src/resolvedor/Pilha.ts +29 -0
- package/src/resolvedor/ResolverError.ts +8 -0
- package/src/resolvedor/dialetos/egua-classico.ts +412 -0
- package/src/resolvedor/dialetos/index.ts +1 -0
- package/src/{resolver.js → resolvedor/index.ts} +101 -114
- package/src/{tiposDeSimbolos.js → tiposDeSimbolos.ts} +21 -22
- package/src/web.ts +75 -0
- package/tsconfig.json +11 -0
- package/indice.js +0 -14
- package/src/ambiente.js +0 -53
- package/src/delegua.js +0 -102
- package/src/erro.js +0 -18
- package/src/estruturas/callable.js +0 -5
- package/src/estruturas/funcao.js +0 -62
- package/src/estruturas/modulo.js +0 -9
- package/src/expr.js +0 -228
- package/src/interpretador.js +0 -802
- package/src/parser.js +0 -822
- package/src/web.js +0 -70
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class ErroAvaliador extends Error {}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ErroEmTempoDeExecucao } from "../excecoes";
|
|
2
|
+
import { DeleguaFuncao } from "../estruturas/funcao";
|
|
3
|
+
import { DeleguaInstancia } from "../estruturas/instancia";
|
|
4
|
+
import { FuncaoPadrao } from "../estruturas/funcao-padrao";
|
|
5
|
+
import { DeleguaClasse } from "../estruturas/classe";
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export default function (interpretador: any, global: any) {
|
|
9
9
|
// Retorna um número aleatório entre 0 e 1.
|
|
10
|
-
|
|
10
|
+
global.definirVariavel(
|
|
11
11
|
"aleatorio",
|
|
12
12
|
new FuncaoPadrao(1, function () {
|
|
13
13
|
return Math.random();
|
|
@@ -15,25 +15,25 @@ module.exports = function (interpretador, globals) {
|
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
// Retorna um número aleatório de acordo com o parâmetro passado.
|
|
18
|
-
//
|
|
19
|
-
|
|
18
|
+
// Mínimo(inclusivo) - Máximo(exclusivo)
|
|
19
|
+
global.definirVariavel(
|
|
20
20
|
"aleatorioEntre",
|
|
21
|
-
new FuncaoPadrao(1, function (
|
|
22
|
-
if (typeof
|
|
21
|
+
new FuncaoPadrao(1, function (minimo: number, maximo: number) {
|
|
22
|
+
if (typeof minimo !== 'number' || typeof maximo !== 'number') {
|
|
23
23
|
throw new ErroEmTempoDeExecucao(
|
|
24
24
|
this.simbolo,
|
|
25
25
|
"Os dois parâmetros devem ser do tipo número."
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return Math.floor(Math.random() * (
|
|
29
|
+
return Math.floor(Math.random() * (maximo - minimo)) + minimo;
|
|
30
30
|
})
|
|
31
|
-
);
|
|
31
|
+
);
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
global.definirVariavel(
|
|
34
34
|
"inteiro",
|
|
35
|
-
new FuncaoPadrao(1, function (valor) {
|
|
36
|
-
if (valor
|
|
35
|
+
new FuncaoPadrao(1, function (valor: any) {
|
|
36
|
+
if (!valor) {
|
|
37
37
|
throw new ErroEmTempoDeExecucao(
|
|
38
38
|
this.simbolo,
|
|
39
39
|
"Somente números podem passar para inteiro."
|
|
@@ -51,9 +51,9 @@ module.exports = function (interpretador, globals) {
|
|
|
51
51
|
})
|
|
52
52
|
);
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
global.definirVariavel(
|
|
55
55
|
"mapear",
|
|
56
|
-
new FuncaoPadrao(1, function (array, callback) {
|
|
56
|
+
new FuncaoPadrao(1, function (array: any, callback: any) {
|
|
57
57
|
if (!Array.isArray(array)) {
|
|
58
58
|
throw new ErroEmTempoDeExecucao(
|
|
59
59
|
this.simbolo,
|
|
@@ -81,10 +81,10 @@ module.exports = function (interpretador, globals) {
|
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
global.definirVariavel(
|
|
85
85
|
"ordenar",
|
|
86
|
-
new FuncaoPadrao(1, function (
|
|
87
|
-
if (Array.isArray(
|
|
86
|
+
new FuncaoPadrao(1, function (objeto: Array<any>) {
|
|
87
|
+
if (!Array.isArray(objeto)) {
|
|
88
88
|
throw new ErroEmTempoDeExecucao(
|
|
89
89
|
this.simbolo,
|
|
90
90
|
"Valor Inválido. Objeto inserido não é um vetor."
|
|
@@ -92,23 +92,23 @@ module.exports = function (interpretador, globals) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
let trocado;
|
|
95
|
-
let
|
|
95
|
+
let tamanho = objeto.length;
|
|
96
96
|
do {
|
|
97
97
|
trocado = false;
|
|
98
|
-
for (var i = 0; i <
|
|
99
|
-
if (
|
|
100
|
-
[
|
|
98
|
+
for (var i = 0; i < tamanho - 1; i++) {
|
|
99
|
+
if (objeto[i] > objeto[i + 1]) {
|
|
100
|
+
[objeto[i], objeto[i + 1]] = [objeto[i + 1], objeto[i]];
|
|
101
101
|
trocado = true;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
} while (trocado);
|
|
105
|
-
return
|
|
105
|
+
return objeto;
|
|
106
106
|
})
|
|
107
107
|
);
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
global.definirVariavel(
|
|
110
110
|
"real",
|
|
111
|
-
new FuncaoPadrao(1, function (valor) {
|
|
111
|
+
new FuncaoPadrao(1, function (valor: any) {
|
|
112
112
|
if (!/^-{0,1}\d+$/.test(valor) && !/^\d+\.\d+$/.test(valor))
|
|
113
113
|
throw new ErroEmTempoDeExecucao(
|
|
114
114
|
this.simbolo,
|
|
@@ -118,9 +118,9 @@ module.exports = function (interpretador, globals) {
|
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
global.definirVariavel(
|
|
122
122
|
"tamanho",
|
|
123
|
-
new FuncaoPadrao(1, function (objeto) {
|
|
123
|
+
new FuncaoPadrao(1, function (objeto: any) {
|
|
124
124
|
if (!isNaN(objeto)) {
|
|
125
125
|
throw new ErroEmTempoDeExecucao(
|
|
126
126
|
this.simbolo,
|
|
@@ -158,14 +158,14 @@ module.exports = function (interpretador, globals) {
|
|
|
158
158
|
})
|
|
159
159
|
);
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
global.definirVariavel(
|
|
162
162
|
"texto",
|
|
163
|
-
new FuncaoPadrao(1, function (valor) {
|
|
163
|
+
new FuncaoPadrao(1, function (valor: any) {
|
|
164
164
|
return `${valor}`;
|
|
165
165
|
})
|
|
166
166
|
);
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
global.definirVariavel("exports", {});
|
|
169
169
|
|
|
170
|
-
return
|
|
170
|
+
return global;
|
|
171
171
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ErroEmTempoDeExecucao } from "../excecoes";
|
|
2
|
+
import { FuncaoPadrao } from "../estruturas/funcao-padrao";
|
|
3
|
+
import { DeleguaModulo } from "../estruturas/modulo";
|
|
4
|
+
|
|
5
|
+
const carregarModulo = function (nomeDoModulo: any, caminhoDoModulo: any) {
|
|
6
|
+
let dadosDoModulo: any;
|
|
4
7
|
|
|
5
|
-
const carregarModulo = function (nomeDoModulo, caminhoDoModulo) {
|
|
6
|
-
let dadosDoModulo;
|
|
7
8
|
try {
|
|
8
9
|
dadosDoModulo = require(caminhoDoModulo);
|
|
9
10
|
} catch (erro) {
|
|
10
11
|
throw new ErroEmTempoDeExecucao(nomeDoModulo, `Biblioteca ${nomeDoModulo} não encontrada para importação.`);
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
|
|
13
14
|
let novoModulo = new DeleguaModulo(nomeDoModulo);
|
|
14
15
|
|
|
15
16
|
let chaves = Object.keys(dadosDoModulo);
|
|
@@ -26,7 +27,6 @@ const carregarModulo = function (nomeDoModulo, caminhoDoModulo) {
|
|
|
26
27
|
return novoModulo;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
//TODO:Samuel: Precisa testar ainda.
|
|
30
|
+
export default function (nome: any) {
|
|
31
31
|
return carregarModulo(nome, nome);
|
|
32
|
-
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class AssignSubscript extends Expr {
|
|
5
|
+
objeto: any;
|
|
6
|
+
valor: any;
|
|
7
|
+
indice: any;
|
|
8
|
+
|
|
9
|
+
constructor(objeto: any, indice: any, valor: any) {
|
|
10
|
+
super();
|
|
11
|
+
this.objeto = objeto;
|
|
12
|
+
this.indice = indice;
|
|
13
|
+
this.valor = valor;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
aceitar(visitor: any) {
|
|
17
|
+
return visitor.visitAssignsubscriptExpr(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Atribuir extends Expr {
|
|
5
|
+
nome: any;
|
|
6
|
+
valor: any;
|
|
7
|
+
|
|
8
|
+
constructor(nome: any, valor: any) {
|
|
9
|
+
super();
|
|
10
|
+
this.nome = nome;
|
|
11
|
+
this.valor = valor;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
aceitar(visitor: any) {
|
|
15
|
+
return visitor.visitAssignExpr(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Binario extends Expr {
|
|
5
|
+
esquerda: any;
|
|
6
|
+
operador: any;
|
|
7
|
+
direita: any;
|
|
8
|
+
|
|
9
|
+
constructor(esquerda: any, operador: any, direita: any) {
|
|
10
|
+
super();
|
|
11
|
+
this.esquerda = esquerda;
|
|
12
|
+
this.operador = operador;
|
|
13
|
+
this.direita = direita;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
aceitar(visitor: any) {
|
|
17
|
+
return visitor.visitBinaryExpr(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Call extends Expr {
|
|
5
|
+
callee: any;
|
|
6
|
+
argumentos: any;
|
|
7
|
+
parentese: any;
|
|
8
|
+
|
|
9
|
+
constructor(callee: any, parentese: any, argumentos: any) {
|
|
10
|
+
super();
|
|
11
|
+
this.callee = callee;
|
|
12
|
+
this.parentese = parentese;
|
|
13
|
+
this.argumentos = argumentos;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
aceitar(visitor: any) {
|
|
17
|
+
return visitor.visitCallExpr(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Conjunto extends Expr {
|
|
5
|
+
objeto: any;
|
|
6
|
+
nome: any;
|
|
7
|
+
valor: any;
|
|
8
|
+
|
|
9
|
+
constructor(objeto: any, nome: any, valor: any) {
|
|
10
|
+
super();
|
|
11
|
+
this.objeto = objeto;
|
|
12
|
+
this.nome = nome;
|
|
13
|
+
this.valor = valor;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
aceitar(visitor: any) {
|
|
17
|
+
return visitor.visitSetExpr(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Dicionario extends Expr {
|
|
5
|
+
chaves: any;
|
|
6
|
+
valores: any;
|
|
7
|
+
|
|
8
|
+
constructor(chaves: any, valores: any) {
|
|
9
|
+
super();
|
|
10
|
+
this.chaves = chaves;
|
|
11
|
+
this.valores = valores;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
aceitar(visitor: any) {
|
|
15
|
+
return visitor.visitDictionaryExpr(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Funcao extends Expr {
|
|
5
|
+
parametros: any;
|
|
6
|
+
corpo: any;
|
|
7
|
+
|
|
8
|
+
constructor(parametros: any, corpo: any) {
|
|
9
|
+
super();
|
|
10
|
+
this.parametros = parametros;
|
|
11
|
+
this.corpo = corpo;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
aceitar(visitor: any) {
|
|
15
|
+
return visitor.visitFunctionExpr(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Get extends Expr {
|
|
5
|
+
objeto: any;
|
|
6
|
+
nome: any;
|
|
7
|
+
|
|
8
|
+
constructor(objeto: any, nome: any) {
|
|
9
|
+
super();
|
|
10
|
+
this.objeto = objeto;
|
|
11
|
+
this.nome = nome;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
aceitar(visitor: any) {
|
|
15
|
+
return visitor.visitGetExpr(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Grouping extends Expr {
|
|
5
|
+
expressao: any;
|
|
6
|
+
|
|
7
|
+
constructor(expressao: any) {
|
|
8
|
+
super();
|
|
9
|
+
this.expressao = expressao;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
aceitar(visitor: any) {
|
|
13
|
+
return visitor.visitGroupingExpr(this);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./assign-subscript";
|
|
2
|
+
export * from "./atribuir";
|
|
3
|
+
export * from "./binario";
|
|
4
|
+
export * from "./call";
|
|
5
|
+
export * from "./conjunto";
|
|
6
|
+
export * from "./dicionario";
|
|
7
|
+
export * from "./expr";
|
|
8
|
+
export * from "./funcao";
|
|
9
|
+
export * from "./get";
|
|
10
|
+
export * from "./grouping";
|
|
11
|
+
export * from "./isto";
|
|
12
|
+
export * from "./literal";
|
|
13
|
+
export * from "./logical";
|
|
14
|
+
export * from "./subscript";
|
|
15
|
+
export * from "./super";
|
|
16
|
+
export * from "./unario";
|
|
17
|
+
export * from "./variavel";
|
|
18
|
+
export * from "./vetor";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Isto extends Expr {
|
|
5
|
+
palavraChave: any;
|
|
6
|
+
|
|
7
|
+
constructor(palavraChave?: any) {
|
|
8
|
+
super();
|
|
9
|
+
this.palavraChave = palavraChave;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
aceitar(visitor: any) {
|
|
13
|
+
return visitor.visitThisExpr(this);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Logical extends Expr {
|
|
5
|
+
esquerda: any;
|
|
6
|
+
operador: any;
|
|
7
|
+
direita: any;
|
|
8
|
+
|
|
9
|
+
constructor(esquerda: any, operador: any, direita: any) {
|
|
10
|
+
super();
|
|
11
|
+
this.esquerda = esquerda;
|
|
12
|
+
this.operador = operador;
|
|
13
|
+
this.direita = direita;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
aceitar(visitor: any) {
|
|
17
|
+
return visitor.visitLogicalExpr(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Subscript extends Expr {
|
|
5
|
+
callee: any;
|
|
6
|
+
closeBracket: any;
|
|
7
|
+
indice: any;
|
|
8
|
+
|
|
9
|
+
constructor(callee: any, indice: any, closeBracket: any) {
|
|
10
|
+
super();
|
|
11
|
+
this.callee = callee;
|
|
12
|
+
this.indice = indice;
|
|
13
|
+
this.closeBracket = closeBracket;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
aceitar(visitor: any) {
|
|
17
|
+
return visitor.visitSubscriptExpr(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Super extends Expr {
|
|
5
|
+
palavraChave: any;
|
|
6
|
+
metodo: any;
|
|
7
|
+
|
|
8
|
+
constructor(palavraChave: any, metodo: any) {
|
|
9
|
+
super();
|
|
10
|
+
this.palavraChave = palavraChave;
|
|
11
|
+
this.metodo = metodo;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
aceitar(visitor: any) {
|
|
15
|
+
return visitor.visitSuperExpr(this);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Expr } from "./expr";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class Unario extends Expr {
|
|
5
|
+
operador: any;
|
|
6
|
+
direita: any;
|
|
7
|
+
|
|
8
|
+
constructor(operador: any, direita: any) {
|
|
9
|
+
super();
|
|
10
|
+
this.operador = operador;
|
|
11
|
+
this.direita = direita;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
aceitar(visitor: any) {
|
|
15
|
+
return visitor.visitUnaryExpr(this);
|
|
16
|
+
}
|
|
17
|
+
}
|