@designliquido/delegua
Advanced tools
Comparing version 0.3.1 to 0.3.2
{ | ||
"name": "@designliquido/delegua", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Linguagem de programação simples e moderna usando português", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
@@ -557,2 +557,13 @@ "use strict"; | ||
return new declaracoes_1.Bloco(this.blocoEscopo()); | ||
var simboloAtual = this.simboloAtual(); | ||
if (simboloAtual.tipo === tipos_de_simbolos_1.default.IDENTIFICADOR) { | ||
// Pela gramática, a seguinte situação não pode ocorrer: | ||
// 1. O símbolo anterior ser um identificador; e | ||
// 2. O símbolo anterior estar na mesma linha do identificador atual. | ||
var simboloAnterior = this.simboloAnterior(); | ||
if (simboloAnterior.tipo === tipos_de_simbolos_1.default.IDENTIFICADOR && | ||
simboloAnterior.linha === simboloAtual.linha) { | ||
this.erro(this.simboloAtual(), 'Não é permitido ter dois identificadores seguidos na mesma linha.'); | ||
} | ||
} | ||
return this.declaracaoExpressao(); | ||
@@ -559,0 +570,0 @@ }; |
@@ -661,3 +661,3 @@ "use strict"; | ||
var escopoAnterior = this.pilhaEscoposExecucao.topoDaPilha(); | ||
escopoAnterior.ambiente = Object.assign(escopoAnterior.ambiente, ultimoEscopo.ambiente); | ||
escopoAnterior.ambiente.valores = Object.assign(escopoAnterior.ambiente.valores, ultimoEscopo.ambiente.valores); | ||
} | ||
@@ -664,0 +664,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
throw new Error("Pilha vazia."); | ||
return this.pilha.at(-1); | ||
return this.pilha[this.pilha.length - 1]; | ||
}; | ||
@@ -31,3 +31,3 @@ PilhaEscoposExecucao.prototype.removerUltimo = function () { | ||
PilhaEscoposExecucao.prototype.atribuirVariavelEm = function (distancia, simbolo, valor) { | ||
var ambienteAncestral = this.pilha.at(-distancia).ambiente; | ||
var ambienteAncestral = this.pilha[this.pilha.length - distancia].ambiente; | ||
ambienteAncestral.valores[simbolo.lexema] = valor; | ||
@@ -37,3 +37,3 @@ }; | ||
for (var i = 1; i <= this.pilha.length; i++) { | ||
var ambiente = this.pilha.at(-i).ambiente; | ||
var ambiente = this.pilha[this.pilha.length - i].ambiente; | ||
if (ambiente.valores[simbolo.lexema] !== undefined) { | ||
@@ -47,3 +47,3 @@ ambiente.valores[simbolo.lexema] = valor; | ||
PilhaEscoposExecucao.prototype.obterVariavelEm = function (distancia, nome) { | ||
var ambienteAncestral = this.pilha.at(-distancia).ambiente; | ||
var ambienteAncestral = this.pilha[this.pilha.length - distancia].ambiente; | ||
return ambienteAncestral.valores[nome]; | ||
@@ -53,3 +53,3 @@ }; | ||
for (var i = 1; i <= this.pilha.length; i++) { | ||
var ambiente = this.pilha.at(-i).ambiente; | ||
var ambiente = this.pilha[this.pilha.length - i].ambiente; | ||
if (ambiente.valores[simbolo.lexema] !== undefined) { | ||
@@ -67,3 +67,3 @@ return ambiente.valores[simbolo.lexema]; | ||
var retorno = {}; | ||
var ambiente = this.pilha.at(-1).ambiente; | ||
var ambiente = this.pilha[this.pilha.length - 1].ambiente; | ||
for (var _i = 0, _a = Object.entries(ambiente.valores); _i < _a.length; _i++) { | ||
@@ -70,0 +70,0 @@ var _b = _a[_i], nome = _b[0], corpo = _b[1]; |
{ | ||
"name": "@designliquido/delegua", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Linguagem de programação simples e moderna usando português", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
810363
10782