@designliquido/delegua 0.2.1 → 0.2.2
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 +2 -1
- package/{src → fontes}/ambiente.d.ts +4 -3
- package/{src → fontes}/ambiente.js +7 -7
- package/fontes/ambiente.js.map +1 -0
- package/fontes/avaliador-sintatico/dialetos/egua-classico.d.ts +63 -0
- package/{src → fontes}/avaliador-sintatico/dialetos/egua-classico.js +230 -217
- package/fontes/avaliador-sintatico/dialetos/egua-classico.js.map +1 -0
- package/{src → fontes}/avaliador-sintatico/dialetos/index.d.ts +0 -0
- package/{src → fontes}/avaliador-sintatico/dialetos/index.js +0 -0
- package/fontes/avaliador-sintatico/dialetos/index.js.map +1 -0
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.d.ts +5 -0
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.js +30 -0
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.js.map +1 -0
- package/fontes/avaliador-sintatico/index.d.ts +66 -0
- package/{src → fontes}/avaliador-sintatico/index.js +231 -216
- package/fontes/avaliador-sintatico/index.js.map +1 -0
- package/fontes/avaliador-sintatico/retorno-avaliador-sintatico.d.ts +6 -0
- package/fontes/avaliador-sintatico/retorno-avaliador-sintatico.js +3 -0
- package/fontes/avaliador-sintatico/retorno-avaliador-sintatico.js.map +1 -0
- package/{src → fontes}/bibliotecas/biblioteca-global.d.ts +0 -0
- package/{src → fontes}/bibliotecas/biblioteca-global.js +4 -4
- package/fontes/bibliotecas/biblioteca-global.js.map +1 -0
- package/{src → fontes}/bibliotecas/importar-biblioteca.d.ts +0 -0
- package/{src → fontes}/bibliotecas/importar-biblioteca.js +0 -0
- package/fontes/bibliotecas/importar-biblioteca.js.map +1 -0
- package/fontes/construtos/acesso-indice-variavel.d.ts +13 -0
- package/fontes/construtos/acesso-indice-variavel.js +21 -0
- package/fontes/construtos/acesso-indice-variavel.js.map +1 -0
- package/fontes/construtos/acesso-metodo.d.ts +13 -0
- package/fontes/construtos/acesso-metodo.js +20 -0
- package/fontes/construtos/acesso-metodo.js.map +1 -0
- package/fontes/construtos/agrupamento.d.ts +7 -0
- package/fontes/construtos/agrupamento.js +15 -0
- package/fontes/construtos/agrupamento.js.map +1 -0
- package/{src → fontes}/construtos/atribuicao-sobrescrita.d.ts +2 -1
- package/{src → fontes}/construtos/atribuicao-sobrescrita.js +2 -1
- package/fontes/construtos/atribuicao-sobrescrita.js.map +1 -0
- package/fontes/construtos/atribuir.d.ts +9 -0
- package/{src → fontes}/construtos/atribuir.js +3 -2
- package/fontes/construtos/atribuir.js.map +1 -0
- package/{src → fontes}/construtos/binario.d.ts +1 -0
- package/{src → fontes}/construtos/binario.js +1 -0
- package/fontes/construtos/binario.js.map +1 -0
- package/{src → fontes}/construtos/chamada.d.ts +3 -2
- package/{src → fontes}/construtos/chamada.js +1 -0
- package/fontes/construtos/chamada.js.map +1 -0
- package/{src → fontes}/construtos/conjunto.d.ts +2 -1
- package/{src → fontes}/construtos/conjunto.js +2 -1
- package/fontes/construtos/conjunto.js.map +1 -0
- package/{src → fontes}/construtos/construto.d.ts +1 -0
- package/{src → fontes}/construtos/construto.js +0 -0
- package/fontes/construtos/construto.js.map +1 -0
- package/{src → fontes}/construtos/dicionario.d.ts +2 -1
- package/{src → fontes}/construtos/dicionario.js +2 -1
- package/fontes/construtos/dicionario.js.map +1 -0
- package/{src → fontes}/construtos/funcao.d.ts +2 -1
- package/{src → fontes}/construtos/funcao.js +2 -1
- package/fontes/construtos/funcao.js.map +1 -0
- package/{src → fontes}/construtos/index.d.ts +4 -4
- package/{src → fontes}/construtos/index.js +4 -4
- package/fontes/construtos/index.js.map +1 -0
- package/{src → fontes}/construtos/isto.d.ts +2 -1
- package/{src → fontes}/construtos/isto.js +2 -1
- package/fontes/construtos/isto.js.map +1 -0
- package/{src → fontes}/construtos/literal.d.ts +2 -1
- package/{src → fontes}/construtos/literal.js +2 -1
- package/fontes/construtos/literal.js.map +1 -0
- package/{src/construtos/logical.d.ts → fontes/construtos/logico.d.ts} +2 -1
- package/fontes/construtos/logico.js +17 -0
- package/fontes/construtos/logico.js.map +1 -0
- package/{src → fontes}/construtos/super.d.ts +2 -1
- package/{src → fontes}/construtos/super.js +2 -1
- package/fontes/construtos/super.js.map +1 -0
- package/{src → fontes}/construtos/unario.d.ts +1 -0
- package/{src → fontes}/construtos/unario.js +1 -0
- package/fontes/construtos/unario.js.map +1 -0
- package/fontes/construtos/variavel.d.ts +8 -0
- package/{src → fontes}/construtos/variavel.js +3 -2
- package/fontes/construtos/variavel.js.map +1 -0
- package/{src → fontes}/construtos/vetor.d.ts +2 -1
- package/{src → fontes}/construtos/vetor.js +2 -1
- package/fontes/construtos/vetor.js.map +1 -0
- package/{src → fontes}/declaracoes/bloco.d.ts +0 -0
- package/{src → fontes}/declaracoes/bloco.js +1 -1
- package/fontes/declaracoes/bloco.js.map +1 -0
- package/{src → fontes}/declaracoes/classe.d.ts +3 -2
- package/{src → fontes}/declaracoes/classe.js +3 -3
- package/fontes/declaracoes/classe.js.map +1 -0
- package/{src → fontes}/declaracoes/continua.d.ts +0 -0
- package/{src → fontes}/declaracoes/continua.js +1 -1
- package/fontes/declaracoes/continua.js.map +1 -0
- package/{src → fontes}/declaracoes/declaracao.d.ts +2 -0
- package/{src → fontes}/declaracoes/declaracao.js +2 -1
- package/fontes/declaracoes/declaracao.js.map +1 -0
- package/{src → fontes}/declaracoes/enquanto.d.ts +0 -0
- package/{src → fontes}/declaracoes/enquanto.js +1 -1
- package/fontes/declaracoes/enquanto.js.map +1 -0
- package/{src → fontes}/declaracoes/escolha.d.ts +3 -3
- package/{src → fontes}/declaracoes/escolha.js +4 -4
- package/fontes/declaracoes/escolha.js.map +1 -0
- package/{src → fontes}/declaracoes/escreva.d.ts +0 -0
- package/{src → fontes}/declaracoes/escreva.js +1 -1
- package/fontes/declaracoes/escreva.js.map +1 -0
- package/{src → fontes}/declaracoes/expressao.d.ts +3 -2
- package/{src → fontes}/declaracoes/expressao.js +1 -1
- package/fontes/declaracoes/expressao.js.map +1 -0
- package/{src → fontes}/declaracoes/fazer.d.ts +3 -3
- package/{src → fontes}/declaracoes/fazer.js +4 -4
- package/fontes/declaracoes/fazer.js.map +1 -0
- package/fontes/declaracoes/funcao.d.ts +8 -0
- package/{src → fontes}/declaracoes/funcao.js +3 -3
- package/fontes/declaracoes/funcao.js.map +1 -0
- package/fontes/declaracoes/importar.d.ts +8 -0
- package/{src → fontes}/declaracoes/importar.js +3 -3
- package/fontes/declaracoes/importar.js.map +1 -0
- package/{src → fontes}/declaracoes/index.d.ts +1 -1
- package/{src → fontes}/declaracoes/index.js +1 -1
- package/fontes/declaracoes/index.js.map +1 -0
- package/{src → fontes}/declaracoes/para.d.ts +1 -1
- package/{src → fontes}/declaracoes/para.js +2 -2
- package/fontes/declaracoes/para.js.map +1 -0
- package/{src → fontes}/declaracoes/retorna.d.ts +0 -0
- package/{src → fontes}/declaracoes/retorna.js +1 -1
- package/fontes/declaracoes/retorna.js.map +1 -0
- package/fontes/declaracoes/se.d.ts +9 -0
- package/{src → fontes}/declaracoes/se.js +5 -5
- package/fontes/declaracoes/se.js.map +1 -0
- package/{src/declaracoes/pausa.d.ts → fontes/declaracoes/sustar.d.ts} +1 -1
- package/{src/declaracoes/pausa.js → fontes/declaracoes/sustar.js} +10 -10
- package/fontes/declaracoes/sustar.js.map +1 -0
- package/fontes/declaracoes/tente.d.ts +9 -0
- package/{src → fontes}/declaracoes/tente.js +6 -6
- package/fontes/declaracoes/tente.js.map +1 -0
- package/fontes/declaracoes/var.d.ts +8 -0
- package/{src → fontes}/declaracoes/var.js +3 -3
- package/fontes/declaracoes/var.js.map +1 -0
- package/{src → fontes}/delegua.d.ts +6 -7
- package/fontes/delegua.js +174 -0
- package/fontes/delegua.js.map +1 -0
- package/{src → fontes}/estruturas/chamavel.d.ts +0 -0
- package/{src → fontes}/estruturas/chamavel.js +0 -0
- package/fontes/estruturas/chamavel.js.map +1 -0
- package/{src → fontes}/estruturas/classe.d.ts +0 -0
- package/{src → fontes}/estruturas/classe.js +0 -0
- package/fontes/estruturas/classe.js.map +1 -0
- package/{src → fontes}/estruturas/funcao-padrao.d.ts +0 -0
- package/{src → fontes}/estruturas/funcao-padrao.js +0 -0
- package/fontes/estruturas/funcao-padrao.js.map +1 -0
- package/{src → fontes}/estruturas/funcao.d.ts +0 -0
- package/{src → fontes}/estruturas/funcao.js +0 -0
- package/fontes/estruturas/funcao.js.map +1 -0
- package/{src → fontes}/estruturas/index.d.ts +0 -0
- package/{src → fontes}/estruturas/index.js +0 -0
- package/fontes/estruturas/index.js.map +1 -0
- package/fontes/estruturas/instancia.d.ts +9 -0
- package/{src → fontes}/estruturas/instancia.js +7 -7
- package/fontes/estruturas/instancia.js.map +1 -0
- package/{src → fontes}/estruturas/modulo.d.ts +4 -0
- package/{src → fontes}/estruturas/modulo.js +3 -3
- package/fontes/estruturas/modulo.js.map +1 -0
- package/fontes/excecoes/erro-em-tempo-de-execucao.d.ts +7 -0
- package/{src → fontes}/excecoes/erro-em-tempo-de-execucao.js +2 -1
- package/fontes/excecoes/erro-em-tempo-de-execucao.js.map +1 -0
- package/{src → fontes}/excecoes/excecao-continuar.d.ts +0 -0
- package/{src → fontes}/excecoes/excecao-continuar.js +0 -0
- package/fontes/excecoes/excecao-continuar.js.map +1 -0
- package/{src → fontes}/excecoes/excecao-retornar.d.ts +0 -0
- package/{src → fontes}/excecoes/excecao-retornar.js +0 -0
- package/fontes/excecoes/excecao-retornar.js.map +1 -0
- package/fontes/excecoes/excecao-sustar.d.ts +2 -0
- package/{src/excecoes/excecao-quebra.js → fontes/excecoes/excecao-sustar.js} +7 -7
- package/fontes/excecoes/excecao-sustar.js.map +1 -0
- package/{src → fontes}/excecoes/index.d.ts +1 -1
- package/{src → fontes}/excecoes/index.js +1 -1
- package/fontes/excecoes/index.js.map +1 -0
- package/fontes/interfaces/avaliador-sintatico-interface.d.ts +59 -0
- package/{src → fontes}/interfaces/avaliador-sintatico-interface.js +0 -0
- package/fontes/interfaces/avaliador-sintatico-interface.js.map +1 -0
- package/{src → fontes}/interfaces/index.d.ts +0 -0
- package/{src → fontes}/interfaces/index.js +0 -0
- package/fontes/interfaces/index.js.map +1 -0
- package/fontes/interfaces/interpretador-interface.d.ts +53 -0
- package/{src → fontes}/interfaces/interpretador-interface.js +0 -0
- package/fontes/interfaces/interpretador-interface.js.map +1 -0
- package/fontes/interfaces/lexador-interface.d.ts +24 -0
- package/{src → fontes}/interfaces/lexador-interface.js +0 -0
- package/fontes/interfaces/lexador-interface.js.map +1 -0
- package/{src → fontes}/interfaces/pilha-interface.d.ts +0 -0
- package/{src → fontes}/interfaces/pilha-interface.js +0 -0
- package/fontes/interfaces/pilha-interface.js.map +1 -0
- package/fontes/interfaces/resolvedor-interface.d.ts +53 -0
- package/{src → fontes}/interfaces/resolvedor-interface.js +0 -0
- package/fontes/interfaces/resolvedor-interface.js.map +1 -0
- package/{src → fontes}/interfaces/simbolo-interface.d.ts +0 -0
- package/{src → fontes}/interfaces/simbolo-interface.js +0 -0
- package/fontes/interfaces/simbolo-interface.js.map +1 -0
- package/fontes/interpretador/dialetos/egua-classico.d.ts +62 -0
- package/{src → fontes}/interpretador/dialetos/egua-classico.js +211 -185
- package/fontes/interpretador/dialetos/egua-classico.js.map +1 -0
- package/{src → fontes}/interpretador/dialetos/index.d.ts +0 -0
- package/{src → fontes}/interpretador/dialetos/index.js +0 -0
- package/fontes/interpretador/dialetos/index.js.map +1 -0
- package/fontes/interpretador/index.d.ts +63 -0
- package/{src → fontes}/interpretador/index.js +245 -226
- package/fontes/interpretador/index.js.map +1 -0
- package/{src → fontes}/lexador/dialetos/egua-classico.d.ts +11 -9
- package/{src → fontes}/lexador/dialetos/egua-classico.js +103 -54
- package/fontes/lexador/dialetos/egua-classico.js.map +1 -0
- package/{src → fontes}/lexador/dialetos/index.d.ts +0 -0
- package/{src → fontes}/lexador/dialetos/index.js +0 -0
- package/fontes/lexador/dialetos/index.js.map +1 -0
- package/fontes/lexador/erro-lexador.d.ts +5 -0
- package/fontes/lexador/erro-lexador.js +3 -0
- package/fontes/lexador/erro-lexador.js.map +1 -0
- package/{src → fontes}/lexador/index.d.ts +5 -4
- package/{src → fontes}/lexador/index.js +21 -9
- package/fontes/lexador/index.js.map +1 -0
- package/fontes/lexador/retorno-lexador.d.ts +6 -0
- package/fontes/lexador/retorno-lexador.js +3 -0
- package/fontes/lexador/retorno-lexador.js.map +1 -0
- package/fontes/resolvedor/dialetos/egua-classico.d.ts +62 -0
- package/fontes/resolvedor/dialetos/egua-classico.js +343 -0
- package/fontes/resolvedor/dialetos/egua-classico.js.map +1 -0
- package/{src → fontes}/resolvedor/dialetos/index.d.ts +0 -0
- package/{src → fontes}/resolvedor/dialetos/index.js +0 -0
- package/fontes/resolvedor/dialetos/index.js.map +1 -0
- package/fontes/resolvedor/erro-resolvedor.d.ts +5 -0
- package/{src → fontes}/resolvedor/erro-resolvedor.js +3 -2
- package/fontes/resolvedor/erro-resolvedor.js.map +1 -0
- package/fontes/resolvedor/index.d.ts +62 -0
- package/fontes/resolvedor/index.js +342 -0
- package/fontes/resolvedor/index.js.map +1 -0
- package/{src → fontes}/resolvedor/pilha-escopos.d.ts +0 -0
- package/{src → fontes}/resolvedor/pilha-escopos.js +0 -0
- package/fontes/resolvedor/pilha-escopos.js.map +1 -0
- package/fontes/resolvedor/retorno-resolvedor.d.ts +4 -0
- package/fontes/resolvedor/retorno-resolvedor.js +3 -0
- package/fontes/resolvedor/retorno-resolvedor.js.map +1 -0
- package/{src → fontes}/tiposDeSimbolos.d.ts +0 -0
- package/{src → fontes}/tiposDeSimbolos.js +0 -0
- package/fontes/tiposDeSimbolos.js.map +1 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -1
- package/testes/avaliador-sintatico.test.js +14 -14
- package/testes/avaliador-sintatico.test.js.map +1 -1
- package/testes/biblioteca-global.test.d.ts +1 -0
- package/testes/biblioteca-global.test.js +131 -0
- package/testes/biblioteca-global.test.js.map +1 -0
- package/testes/egua-classico/avaliador-sintatico.test.d.ts +1 -0
- package/testes/egua-classico/avaliador-sintatico.test.js +33 -0
- package/testes/egua-classico/avaliador-sintatico.test.js.map +1 -0
- package/testes/egua-classico/interpretador.test.d.ts +1 -0
- package/testes/egua-classico/interpretador.test.js +219 -0
- package/testes/egua-classico/interpretador.test.js.map +1 -0
- package/testes/egua-classico/lexador.test.d.ts +1 -0
- package/testes/egua-classico/lexador.test.js +80 -0
- package/testes/egua-classico/lexador.test.js.map +1 -0
- package/testes/egua-classico/resolvedor.test.d.ts +1 -0
- package/testes/egua-classico/resolvedor.test.js +38 -0
- package/testes/egua-classico/resolvedor.test.js.map +1 -0
- package/testes/interpretador.test.js +154 -75
- package/testes/interpretador.test.js.map +1 -1
- package/testes/lexador.test.js +17 -14
- package/testes/lexador.test.js.map +1 -1
- package/testes/resolvedor.test.js +4 -4
- package/testes/resolvedor.test.js.map +1 -1
- package/src/ambiente.js.map +0 -1
- package/src/avaliador-sintatico/dialetos/egua-classico.d.ts +0 -60
- package/src/avaliador-sintatico/dialetos/egua-classico.js.map +0 -1
- package/src/avaliador-sintatico/dialetos/index.js.map +0 -1
- package/src/avaliador-sintatico/erros-avaliador.d.ts +0 -2
- package/src/avaliador-sintatico/erros-avaliador.js +0 -27
- package/src/avaliador-sintatico/erros-avaliador.js.map +0 -1
- package/src/avaliador-sintatico/index.d.ts +0 -62
- package/src/avaliador-sintatico/index.js.map +0 -1
- package/src/bibliotecas/biblioteca-global.js.map +0 -1
- package/src/bibliotecas/importar-biblioteca.js.map +0 -1
- package/src/construtos/atribuicao-sobrescrita.js.map +0 -1
- package/src/construtos/atribuir.d.ts +0 -7
- package/src/construtos/atribuir.js.map +0 -1
- package/src/construtos/binario.js.map +0 -1
- package/src/construtos/chamada.js.map +0 -1
- package/src/construtos/conjunto.js.map +0 -1
- package/src/construtos/construto.js.map +0 -1
- package/src/construtos/dicionario.js.map +0 -1
- package/src/construtos/funcao.js.map +0 -1
- package/src/construtos/get.d.ts +0 -7
- package/src/construtos/get.js +0 -15
- package/src/construtos/get.js.map +0 -1
- package/src/construtos/grouping.d.ts +0 -6
- package/src/construtos/grouping.js +0 -14
- package/src/construtos/grouping.js.map +0 -1
- package/src/construtos/index.js.map +0 -1
- package/src/construtos/isto.js.map +0 -1
- package/src/construtos/literal.js.map +0 -1
- package/src/construtos/logical.js +0 -16
- package/src/construtos/logical.js.map +0 -1
- package/src/construtos/subscript.d.ts +0 -8
- package/src/construtos/subscript.js +0 -16
- package/src/construtos/subscript.js.map +0 -1
- package/src/construtos/super.js.map +0 -1
- package/src/construtos/unario.js.map +0 -1
- package/src/construtos/variavel.d.ts +0 -6
- package/src/construtos/variavel.js.map +0 -1
- package/src/construtos/vetor.js.map +0 -1
- package/src/declaracoes/bloco.js.map +0 -1
- package/src/declaracoes/classe.js.map +0 -1
- package/src/declaracoes/continua.js.map +0 -1
- package/src/declaracoes/declaracao.js.map +0 -1
- package/src/declaracoes/enquanto.js.map +0 -1
- package/src/declaracoes/escolha.js.map +0 -1
- package/src/declaracoes/escreva.js.map +0 -1
- package/src/declaracoes/expressao.js.map +0 -1
- package/src/declaracoes/fazer.js.map +0 -1
- package/src/declaracoes/funcao.d.ts +0 -7
- package/src/declaracoes/funcao.js.map +0 -1
- package/src/declaracoes/importar.d.ts +0 -7
- package/src/declaracoes/importar.js.map +0 -1
- package/src/declaracoes/index.js.map +0 -1
- package/src/declaracoes/para.js.map +0 -1
- package/src/declaracoes/pausa.js.map +0 -1
- package/src/declaracoes/retorna.js.map +0 -1
- package/src/declaracoes/se.d.ts +0 -9
- package/src/declaracoes/se.js.map +0 -1
- package/src/declaracoes/tente.d.ts +0 -9
- package/src/declaracoes/tente.js.map +0 -1
- package/src/declaracoes/var.d.ts +0 -7
- package/src/declaracoes/var.js.map +0 -1
- package/src/delegua.js +0 -138
- package/src/delegua.js.map +0 -1
- package/src/estruturas/chamavel.js.map +0 -1
- package/src/estruturas/classe.js.map +0 -1
- package/src/estruturas/funcao-padrao.js.map +0 -1
- package/src/estruturas/funcao.js.map +0 -1
- package/src/estruturas/index.js.map +0 -1
- package/src/estruturas/instancia.d.ts +0 -8
- package/src/estruturas/instancia.js.map +0 -1
- package/src/estruturas/modulo.js.map +0 -1
- package/src/excecoes/erro-em-tempo-de-execucao.d.ts +0 -5
- package/src/excecoes/erro-em-tempo-de-execucao.js.map +0 -1
- package/src/excecoes/excecao-continuar.js.map +0 -1
- package/src/excecoes/excecao-quebra.d.ts +0 -2
- package/src/excecoes/excecao-quebra.js.map +0 -1
- package/src/excecoes/excecao-retornar.js.map +0 -1
- package/src/excecoes/index.js.map +0 -1
- package/src/interfaces/avaliador-sintatico-interface.d.ts +0 -55
- package/src/interfaces/avaliador-sintatico-interface.js.map +0 -1
- package/src/interfaces/index.js.map +0 -1
- package/src/interfaces/interpretador-interface.d.ts +0 -51
- package/src/interfaces/interpretador-interface.js.map +0 -1
- package/src/interfaces/lexador-interface.d.ts +0 -23
- package/src/interfaces/lexador-interface.js.map +0 -1
- package/src/interfaces/pilha-interface.js.map +0 -1
- package/src/interfaces/resolvedor-interface.d.ts +0 -50
- package/src/interfaces/resolvedor-interface.js.map +0 -1
- package/src/interfaces/simbolo-interface.js.map +0 -1
- package/src/interpretador/dialetos/egua-classico.d.ts +0 -58
- package/src/interpretador/dialetos/egua-classico.js.map +0 -1
- package/src/interpretador/dialetos/index.js.map +0 -1
- package/src/interpretador/index.d.ts +0 -59
- package/src/interpretador/index.js.map +0 -1
- package/src/lexador/dialetos/egua-classico.js.map +0 -1
- package/src/lexador/dialetos/index.js.map +0 -1
- package/src/lexador/index.js.map +0 -1
- package/src/resolvedor/dialetos/egua-classico.d.ts +0 -59
- package/src/resolvedor/dialetos/egua-classico.js +0 -331
- package/src/resolvedor/dialetos/egua-classico.js.map +0 -1
- package/src/resolvedor/dialetos/index.js.map +0 -1
- package/src/resolvedor/erro-resolvedor.d.ts +0 -4
- package/src/resolvedor/erro-resolvedor.js.map +0 -1
- package/src/resolvedor/index.d.ts +0 -60
- package/src/resolvedor/index.js +0 -331
- package/src/resolvedor/index.js.map +0 -1
- package/src/resolvedor/pilha-escopos.js.map +0 -1
- package/src/tiposDeSimbolos.js.map +0 -1
|
@@ -1,13 +1,39 @@
|
|
|
1
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
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
29
|
exports.InterpretadorEguaClassico = void 0;
|
|
4
|
-
var tiposDeSimbolos_1 = require("../../tiposDeSimbolos");
|
|
30
|
+
var tiposDeSimbolos_1 = __importDefault(require("../../tiposDeSimbolos"));
|
|
5
31
|
var ambiente_1 = require("../../ambiente");
|
|
6
32
|
var delegua_1 = require("../../delegua");
|
|
7
|
-
var biblioteca_global_1 = require("../../bibliotecas/biblioteca-global");
|
|
8
|
-
var caminho = require("path");
|
|
9
|
-
var fs = require("fs");
|
|
10
|
-
var importar_biblioteca_1 = require("../../bibliotecas/importar-biblioteca");
|
|
33
|
+
var biblioteca_global_1 = __importDefault(require("../../bibliotecas/biblioteca-global"));
|
|
34
|
+
var caminho = __importStar(require("path"));
|
|
35
|
+
var fs = __importStar(require("fs"));
|
|
36
|
+
var importar_biblioteca_1 = __importDefault(require("../../bibliotecas/importar-biblioteca"));
|
|
11
37
|
var chamavel_1 = require("../../estruturas/chamavel");
|
|
12
38
|
var funcao_padrao_1 = require("../../estruturas/funcao-padrao");
|
|
13
39
|
var classe_1 = require("../../estruturas/classe");
|
|
@@ -28,31 +54,31 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
28
54
|
this.locais = new Map();
|
|
29
55
|
this.global = (0, biblioteca_global_1.default)(this, this.global);
|
|
30
56
|
}
|
|
31
|
-
InterpretadorEguaClassico.prototype.resolver = function (
|
|
32
|
-
this.locais.set(
|
|
57
|
+
InterpretadorEguaClassico.prototype.resolver = function (expressao, profundidade) {
|
|
58
|
+
this.locais.set(expressao, profundidade);
|
|
33
59
|
};
|
|
34
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoLiteral = function (
|
|
35
|
-
return
|
|
60
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoLiteral = function (expressao) {
|
|
61
|
+
return expressao.valor;
|
|
36
62
|
};
|
|
37
|
-
InterpretadorEguaClassico.prototype.avaliar = function (
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
63
|
+
InterpretadorEguaClassico.prototype.avaliar = function (expressao) {
|
|
64
|
+
if (expressao.aceitar) {
|
|
65
|
+
return expressao.aceitar(this);
|
|
40
66
|
}
|
|
41
67
|
};
|
|
42
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoAgrupamento = function (
|
|
43
|
-
return this.avaliar(
|
|
68
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoAgrupamento = function (expressao) {
|
|
69
|
+
return this.avaliar(expressao.expressao);
|
|
44
70
|
};
|
|
45
71
|
InterpretadorEguaClassico.prototype.eVerdadeiro = function (objeto) {
|
|
46
72
|
if (objeto === null)
|
|
47
73
|
return false;
|
|
48
|
-
if (typeof objeto ===
|
|
74
|
+
if (typeof objeto === 'boolean')
|
|
49
75
|
return Boolean(objeto);
|
|
50
76
|
return true;
|
|
51
77
|
};
|
|
52
78
|
InterpretadorEguaClassico.prototype.verificarOperandoNumero = function (operador, operand) {
|
|
53
|
-
if (typeof operand ===
|
|
79
|
+
if (typeof operand === 'number')
|
|
54
80
|
return;
|
|
55
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(operador,
|
|
81
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(operador, 'Operador precisa ser um número.', operador.linha);
|
|
56
82
|
};
|
|
57
83
|
InterpretadorEguaClassico.prototype.visitarExpressaoUnaria = function (expr) {
|
|
58
84
|
var direita = this.avaliar(expr.direita);
|
|
@@ -75,9 +101,9 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
75
101
|
return esquerda === direita;
|
|
76
102
|
};
|
|
77
103
|
InterpretadorEguaClassico.prototype.verificarOperandosNumeros = function (operador, direita, esquerda) {
|
|
78
|
-
if (typeof direita ===
|
|
104
|
+
if (typeof direita === 'number' && typeof esquerda === 'number')
|
|
79
105
|
return;
|
|
80
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(operador,
|
|
106
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(operador, 'Operadores precisam ser números.', operador.linha);
|
|
81
107
|
};
|
|
82
108
|
InterpretadorEguaClassico.prototype.visitarExpressaoBinaria = function (expr) {
|
|
83
109
|
var esquerda = this.avaliar(expr.esquerda);
|
|
@@ -102,14 +128,15 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
102
128
|
this.verificarOperandosNumeros(expr.operador, esquerda, direita);
|
|
103
129
|
return Number(esquerda) - Number(direita);
|
|
104
130
|
case tiposDeSimbolos_1.default.ADICAO:
|
|
105
|
-
if (typeof esquerda ===
|
|
131
|
+
if (typeof esquerda === 'number' &&
|
|
132
|
+
typeof direita === 'number') {
|
|
106
133
|
return Number(esquerda) + Number(direita);
|
|
107
134
|
}
|
|
108
|
-
else if (typeof esquerda ===
|
|
109
|
-
typeof direita ===
|
|
135
|
+
else if (typeof esquerda === 'string' &&
|
|
136
|
+
typeof direita === 'string') {
|
|
110
137
|
return String(esquerda) + String(direita);
|
|
111
138
|
}
|
|
112
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(expr.operador,
|
|
139
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expr.operador, 'Operadores precisam ser dois números ou duas strings.');
|
|
113
140
|
case tiposDeSimbolos_1.default.DIVISAO:
|
|
114
141
|
this.verificarOperandosNumeros(expr.operador, esquerda, direita);
|
|
115
142
|
return Number(esquerda) / Number(direita);
|
|
@@ -141,14 +168,14 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
141
168
|
}
|
|
142
169
|
return null;
|
|
143
170
|
};
|
|
144
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoDeChamada = function (
|
|
145
|
-
var entidadeChamada = this.avaliar(
|
|
171
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoDeChamada = function (expressao) {
|
|
172
|
+
var entidadeChamada = this.avaliar(expressao.entidadeChamada);
|
|
146
173
|
var argumentos = [];
|
|
147
|
-
for (var i = 0; i <
|
|
148
|
-
argumentos.push(this.avaliar(
|
|
174
|
+
for (var i = 0; i < expressao.argumentos.length; i++) {
|
|
175
|
+
argumentos.push(this.avaliar(expressao.argumentos[i]));
|
|
149
176
|
}
|
|
150
177
|
if (!(entidadeChamada instanceof chamavel_1.Chamavel)) {
|
|
151
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
178
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.parentese, 'Só pode chamar função ou classe.', expressao.linha);
|
|
152
179
|
}
|
|
153
180
|
var parametros;
|
|
154
181
|
if (entidadeChamada instanceof funcao_1.DeleguaFuncao) {
|
|
@@ -172,101 +199,101 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
172
199
|
else {
|
|
173
200
|
if (parametros &&
|
|
174
201
|
parametros.length > 0 &&
|
|
175
|
-
parametros[parametros.length - 1][
|
|
202
|
+
parametros[parametros.length - 1]['tipo'] === 'wildcard') {
|
|
176
203
|
var novosArgumentos = argumentos.slice(0, parametros.length - 1);
|
|
177
204
|
novosArgumentos.push(argumentos.slice(parametros.length - 1, argumentos.length));
|
|
178
205
|
argumentos = novosArgumentos;
|
|
179
206
|
}
|
|
180
207
|
}
|
|
181
208
|
if (entidadeChamada instanceof funcao_padrao_1.FuncaoPadrao) {
|
|
182
|
-
return entidadeChamada.chamar(this, argumentos,
|
|
209
|
+
return entidadeChamada.chamar(this, argumentos, expressao.entidadeChamada.nome);
|
|
183
210
|
}
|
|
184
211
|
return entidadeChamada.chamar(this, argumentos);
|
|
185
212
|
};
|
|
186
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoDeAtribuicao = function (
|
|
187
|
-
var valor = this.avaliar(
|
|
188
|
-
var distancia = this.locais.get(
|
|
213
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoDeAtribuicao = function (expressao) {
|
|
214
|
+
var valor = this.avaliar(expressao.valor);
|
|
215
|
+
var distancia = this.locais.get(expressao);
|
|
189
216
|
if (distancia !== undefined) {
|
|
190
|
-
this.ambiente.atribuirVariavelEm(distancia,
|
|
217
|
+
this.ambiente.atribuirVariavelEm(distancia, expressao.simbolo, valor);
|
|
191
218
|
}
|
|
192
219
|
else {
|
|
193
|
-
this.ambiente.atribuirVariavel(
|
|
220
|
+
this.ambiente.atribuirVariavel(expressao.simbolo, valor);
|
|
194
221
|
}
|
|
195
222
|
return valor;
|
|
196
223
|
};
|
|
197
|
-
InterpretadorEguaClassico.prototype.procurarVariavel = function (
|
|
224
|
+
InterpretadorEguaClassico.prototype.procurarVariavel = function (simbolo, expr) {
|
|
198
225
|
var distancia = this.locais.get(expr);
|
|
199
226
|
if (distancia !== undefined) {
|
|
200
|
-
return this.ambiente.obterVariavelEm(distancia,
|
|
227
|
+
return this.ambiente.obterVariavelEm(distancia, simbolo.lexema);
|
|
201
228
|
}
|
|
202
229
|
else {
|
|
203
|
-
return this.global.obterVariavel(
|
|
230
|
+
return this.global.obterVariavel(simbolo);
|
|
204
231
|
}
|
|
205
232
|
};
|
|
206
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoDeVariavel = function (
|
|
207
|
-
return this.procurarVariavel(
|
|
233
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoDeVariavel = function (expressao) {
|
|
234
|
+
return this.procurarVariavel(expressao.simbolo, expressao);
|
|
208
235
|
};
|
|
209
|
-
InterpretadorEguaClassico.prototype.visitarDeclaracaoDeExpressao = function (
|
|
210
|
-
return this.avaliar(
|
|
236
|
+
InterpretadorEguaClassico.prototype.visitarDeclaracaoDeExpressao = function (declaracao) {
|
|
237
|
+
return this.avaliar(declaracao.expressao);
|
|
211
238
|
};
|
|
212
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoLogica = function (
|
|
213
|
-
var esquerda = this.avaliar(
|
|
214
|
-
if (
|
|
215
|
-
var direita = this.avaliar(
|
|
216
|
-
if (Array.isArray(direita) || typeof direita ===
|
|
239
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoLogica = function (expressao) {
|
|
240
|
+
var esquerda = this.avaliar(expressao.esquerda);
|
|
241
|
+
if (expressao.operador.tipo === tiposDeSimbolos_1.default.EM) {
|
|
242
|
+
var direita = this.avaliar(expressao.direita);
|
|
243
|
+
if (Array.isArray(direita) || typeof direita === 'string') {
|
|
217
244
|
return direita.includes(esquerda);
|
|
218
245
|
}
|
|
219
246
|
else if (direita.constructor === Object) {
|
|
220
247
|
return esquerda in direita;
|
|
221
248
|
}
|
|
222
249
|
else {
|
|
223
|
-
throw new excecoes_1.ErroEmTempoDeExecucao("Tipo de chamada inválida com 'em'.");
|
|
250
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(esquerda, "Tipo de chamada inválida com 'em'.", expressao.linha);
|
|
224
251
|
}
|
|
225
252
|
}
|
|
226
253
|
// se um estado for verdadeiro, retorna verdadeiro
|
|
227
|
-
if (
|
|
254
|
+
if (expressao.operador.tipo === tiposDeSimbolos_1.default.OU) {
|
|
228
255
|
if (this.eVerdadeiro(esquerda))
|
|
229
256
|
return esquerda;
|
|
230
257
|
}
|
|
231
258
|
// se um estado for falso, retorna falso
|
|
232
|
-
if (
|
|
259
|
+
if (expressao.operador.tipo === tiposDeSimbolos_1.default.E) {
|
|
233
260
|
if (!this.eVerdadeiro(esquerda))
|
|
234
261
|
return esquerda;
|
|
235
262
|
}
|
|
236
|
-
return this.avaliar(
|
|
263
|
+
return this.avaliar(expressao.direita);
|
|
237
264
|
};
|
|
238
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoSe = function (
|
|
239
|
-
if (this.eVerdadeiro(this.avaliar(
|
|
240
|
-
this.executar(
|
|
265
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoSe = function (declaracao) {
|
|
266
|
+
if (this.eVerdadeiro(this.avaliar(declaracao.condicao))) {
|
|
267
|
+
this.executar(declaracao.caminhoEntao);
|
|
241
268
|
return null;
|
|
242
269
|
}
|
|
243
|
-
for (var i = 0; i <
|
|
244
|
-
var atual =
|
|
270
|
+
for (var i = 0; i < declaracao.caminhosSeSenao.length; i++) {
|
|
271
|
+
var atual = declaracao.caminhosSeSenao[i];
|
|
245
272
|
if (this.eVerdadeiro(this.avaliar(atual.condicao))) {
|
|
246
|
-
this.executar(atual.
|
|
273
|
+
this.executar(atual.caminho);
|
|
247
274
|
return null;
|
|
248
275
|
}
|
|
249
276
|
}
|
|
250
|
-
if (
|
|
251
|
-
this.executar(
|
|
277
|
+
if (declaracao.caminhoSenao !== null) {
|
|
278
|
+
this.executar(declaracao.caminhoSenao);
|
|
252
279
|
}
|
|
253
280
|
return null;
|
|
254
281
|
};
|
|
255
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoPara = function (
|
|
256
|
-
if (
|
|
257
|
-
this.avaliar(
|
|
282
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoPara = function (declaracao) {
|
|
283
|
+
if (declaracao.inicializador !== null) {
|
|
284
|
+
this.avaliar(declaracao.inicializador);
|
|
258
285
|
}
|
|
259
286
|
while (true) {
|
|
260
|
-
if (
|
|
261
|
-
if (!this.eVerdadeiro(this.avaliar(
|
|
287
|
+
if (declaracao.condicao !== null) {
|
|
288
|
+
if (!this.eVerdadeiro(this.avaliar(declaracao.condicao))) {
|
|
262
289
|
break;
|
|
263
290
|
}
|
|
264
291
|
}
|
|
265
292
|
try {
|
|
266
|
-
this.executar(
|
|
293
|
+
this.executar(declaracao.corpo);
|
|
267
294
|
}
|
|
268
295
|
catch (erro) {
|
|
269
|
-
if (erro instanceof excecoes_1.
|
|
296
|
+
if (erro instanceof excecoes_1.ExcecaoSustar) {
|
|
270
297
|
break;
|
|
271
298
|
}
|
|
272
299
|
else if (erro instanceof excecoes_1.ExcecaoContinuar) {
|
|
@@ -275,19 +302,19 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
275
302
|
throw erro;
|
|
276
303
|
}
|
|
277
304
|
}
|
|
278
|
-
if (
|
|
279
|
-
this.avaliar(
|
|
305
|
+
if (declaracao.incrementar !== null) {
|
|
306
|
+
this.avaliar(declaracao.incrementar);
|
|
280
307
|
}
|
|
281
308
|
}
|
|
282
309
|
return null;
|
|
283
310
|
};
|
|
284
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoFazer = function (
|
|
311
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoFazer = function (declaracao) {
|
|
285
312
|
do {
|
|
286
313
|
try {
|
|
287
|
-
this.executar(
|
|
314
|
+
this.executar(declaracao.caminhoFazer);
|
|
288
315
|
}
|
|
289
316
|
catch (erro) {
|
|
290
|
-
if (erro instanceof excecoes_1.
|
|
317
|
+
if (erro instanceof excecoes_1.ExcecaoSustar) {
|
|
291
318
|
break;
|
|
292
319
|
}
|
|
293
320
|
else if (erro instanceof excecoes_1.ExcecaoContinuar) {
|
|
@@ -296,22 +323,22 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
296
323
|
throw erro;
|
|
297
324
|
}
|
|
298
325
|
}
|
|
299
|
-
} while (this.eVerdadeiro(this.avaliar(
|
|
326
|
+
} while (this.eVerdadeiro(this.avaliar(declaracao.condicaoEnquanto)));
|
|
300
327
|
};
|
|
301
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoEscolha = function (
|
|
302
|
-
var
|
|
303
|
-
var
|
|
304
|
-
var
|
|
305
|
-
var
|
|
328
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoEscolha = function (declaracao) {
|
|
329
|
+
var condicaoEscolha = this.avaliar(declaracao.condicao);
|
|
330
|
+
var caminhos = declaracao.caminhos;
|
|
331
|
+
var caminhoPadrao = declaracao.caminhoPadrao;
|
|
332
|
+
var encontrado = false;
|
|
306
333
|
try {
|
|
307
|
-
for (var i = 0; i <
|
|
308
|
-
var
|
|
309
|
-
for (var j = 0; j <
|
|
310
|
-
if (this.avaliar(
|
|
311
|
-
|
|
334
|
+
for (var i = 0; i < caminhos.length; i++) {
|
|
335
|
+
var caminho_1 = caminhos[i];
|
|
336
|
+
for (var j = 0; j < caminho_1.conditions.length; j++) {
|
|
337
|
+
if (this.avaliar(caminho_1.conditions[j]) === condicaoEscolha) {
|
|
338
|
+
encontrado = true;
|
|
312
339
|
try {
|
|
313
|
-
for (var k = 0; k <
|
|
314
|
-
this.executar(
|
|
340
|
+
for (var k = 0; k < caminho_1.declaracoes.length; k++) {
|
|
341
|
+
this.executar(caminho_1.declaracoes[k]);
|
|
315
342
|
}
|
|
316
343
|
}
|
|
317
344
|
catch (erro) {
|
|
@@ -324,48 +351,48 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
324
351
|
}
|
|
325
352
|
}
|
|
326
353
|
}
|
|
327
|
-
if (
|
|
328
|
-
for (var i = 0; i <
|
|
329
|
-
this.executar(
|
|
354
|
+
if (caminhoPadrao !== null && encontrado === false) {
|
|
355
|
+
for (var i = 0; i < caminhoPadrao.declaracoes.length; i++) {
|
|
356
|
+
this.executar(caminhoPadrao['declaracoes'][i]);
|
|
330
357
|
}
|
|
331
358
|
}
|
|
332
359
|
}
|
|
333
360
|
catch (erro) {
|
|
334
|
-
if (erro instanceof excecoes_1.
|
|
361
|
+
if (erro instanceof excecoes_1.ExcecaoSustar) {
|
|
335
362
|
}
|
|
336
363
|
else {
|
|
337
364
|
throw erro;
|
|
338
365
|
}
|
|
339
366
|
}
|
|
340
367
|
};
|
|
341
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoTente = function (
|
|
368
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoTente = function (declaracao) {
|
|
342
369
|
try {
|
|
343
370
|
var sucesso = true;
|
|
344
371
|
try {
|
|
345
|
-
this.executarBloco(
|
|
372
|
+
this.executarBloco(declaracao.caminhoTente, new ambiente_1.Ambiente(this.ambiente));
|
|
346
373
|
}
|
|
347
374
|
catch (erro) {
|
|
348
375
|
sucesso = false;
|
|
349
|
-
if (
|
|
350
|
-
this.executarBloco(
|
|
376
|
+
if (declaracao.caminhoPegue !== null) {
|
|
377
|
+
this.executarBloco(declaracao.caminhoPegue, new ambiente_1.Ambiente(this.ambiente));
|
|
351
378
|
}
|
|
352
379
|
}
|
|
353
|
-
if (sucesso &&
|
|
354
|
-
this.executarBloco(
|
|
380
|
+
if (sucesso && declaracao.caminhoSenao !== null) {
|
|
381
|
+
this.executarBloco(declaracao.caminhoSenao, new ambiente_1.Ambiente(this.ambiente));
|
|
355
382
|
}
|
|
356
383
|
}
|
|
357
384
|
finally {
|
|
358
|
-
if (
|
|
359
|
-
this.executarBloco(
|
|
385
|
+
if (declaracao.caminhoFinalmente !== null)
|
|
386
|
+
this.executarBloco(declaracao.caminhoFinalmente, new ambiente_1.Ambiente(this.ambiente));
|
|
360
387
|
}
|
|
361
388
|
};
|
|
362
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoEnquanto = function (
|
|
363
|
-
while (this.eVerdadeiro(this.avaliar(
|
|
389
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoEnquanto = function (declaracao) {
|
|
390
|
+
while (this.eVerdadeiro(this.avaliar(declaracao.condicao))) {
|
|
364
391
|
try {
|
|
365
|
-
this.executar(
|
|
392
|
+
this.executar(declaracao.corpo);
|
|
366
393
|
}
|
|
367
394
|
catch (erro) {
|
|
368
|
-
if (erro instanceof excecoes_1.
|
|
395
|
+
if (erro instanceof excecoes_1.ExcecaoSustar) {
|
|
369
396
|
break;
|
|
370
397
|
}
|
|
371
398
|
else if (erro instanceof excecoes_1.ExcecaoContinuar) {
|
|
@@ -377,21 +404,20 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
377
404
|
}
|
|
378
405
|
return null;
|
|
379
406
|
};
|
|
380
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoImportar = function (
|
|
381
|
-
var caminhoRelativo = this.avaliar(
|
|
407
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoImportar = function (declaracao) {
|
|
408
|
+
var caminhoRelativo = this.avaliar(declaracao.caminho);
|
|
382
409
|
var caminhoTotal = caminho.join(this.diretorioBase, caminhoRelativo);
|
|
383
|
-
// const pastaTotal = caminho.dirname(caminhoTotal);
|
|
384
410
|
var nomeArquivo = caminho.basename(caminhoTotal);
|
|
385
411
|
var dados = (0, importar_biblioteca_1.default)(caminhoRelativo);
|
|
386
412
|
if (dados)
|
|
387
413
|
return dados;
|
|
388
414
|
try {
|
|
389
415
|
if (!fs.existsSync(caminhoTotal)) {
|
|
390
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
416
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(declaracao.simboloFechamento, 'Não foi possível encontrar arquivo importado.', declaracao.linha);
|
|
391
417
|
}
|
|
392
418
|
}
|
|
393
419
|
catch (erro) {
|
|
394
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
420
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(declaracao.simboloFechamento, 'Não foi possível ler o arquivo.', declaracao.linha);
|
|
395
421
|
}
|
|
396
422
|
dados = fs.readFileSync(caminhoTotal).toString();
|
|
397
423
|
var delegua = new delegua_1.Delegua(this.Delegua.dialeto, false, nomeArquivo);
|
|
@@ -408,8 +434,8 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
408
434
|
}
|
|
409
435
|
return exportar;
|
|
410
436
|
};
|
|
411
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoEscreva = function (
|
|
412
|
-
var valor = this.avaliar(
|
|
437
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoEscreva = function (declaracao) {
|
|
438
|
+
var valor = this.avaliar(declaracao.expressao);
|
|
413
439
|
console.log(this.paraTexto(valor));
|
|
414
440
|
return null;
|
|
415
441
|
};
|
|
@@ -431,37 +457,37 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
431
457
|
this.ambiente = anterior;
|
|
432
458
|
}
|
|
433
459
|
};
|
|
434
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoBloco = function (
|
|
435
|
-
this.executarBloco(
|
|
460
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoBloco = function (declaracao) {
|
|
461
|
+
this.executarBloco(declaracao.declaracoes, new ambiente_1.Ambiente(this.ambiente));
|
|
436
462
|
return null;
|
|
437
463
|
};
|
|
438
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoVar = function (
|
|
464
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoVar = function (declaracao) {
|
|
439
465
|
var valor = null;
|
|
440
|
-
if (
|
|
441
|
-
valor = this.avaliar(
|
|
466
|
+
if (declaracao.inicializador !== null) {
|
|
467
|
+
valor = this.avaliar(declaracao.inicializador);
|
|
442
468
|
}
|
|
443
|
-
this.ambiente.definirVariavel(
|
|
469
|
+
this.ambiente.definirVariavel(declaracao.simbolo.lexema, valor);
|
|
444
470
|
return null;
|
|
445
471
|
};
|
|
446
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoContinua = function (
|
|
472
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoContinua = function (declaracao) {
|
|
447
473
|
throw new excecoes_1.ExcecaoContinuar();
|
|
448
474
|
};
|
|
449
|
-
InterpretadorEguaClassico.prototype.
|
|
450
|
-
throw new excecoes_1.
|
|
475
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoSustar = function (declaracao) {
|
|
476
|
+
throw new excecoes_1.ExcecaoSustar();
|
|
451
477
|
};
|
|
452
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoRetornar = function (
|
|
478
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoRetornar = function (declaracao) {
|
|
453
479
|
var valor = null;
|
|
454
|
-
if (
|
|
455
|
-
valor = this.avaliar(
|
|
480
|
+
if (declaracao.valor != null)
|
|
481
|
+
valor = this.avaliar(declaracao.valor);
|
|
456
482
|
throw new excecoes_1.ExcecaoRetornar(valor);
|
|
457
483
|
};
|
|
458
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoDeleguaFuncao = function (
|
|
459
|
-
return new funcao_1.DeleguaFuncao(null,
|
|
484
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoDeleguaFuncao = function (expressao) {
|
|
485
|
+
return new funcao_1.DeleguaFuncao(null, expressao, this.ambiente, false);
|
|
460
486
|
};
|
|
461
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoAtribuicaoSobrescrita = function (
|
|
462
|
-
var objeto = this.avaliar(
|
|
463
|
-
var indice = this.avaliar(
|
|
464
|
-
var valor = this.avaliar(
|
|
487
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoAtribuicaoSobrescrita = function (expressao) {
|
|
488
|
+
var objeto = this.avaliar(expressao.objeto);
|
|
489
|
+
var indice = this.avaliar(expressao.indice);
|
|
490
|
+
var valor = this.avaliar(expressao.valor);
|
|
465
491
|
if (Array.isArray(objeto)) {
|
|
466
492
|
if (indice < 0 && objeto.length !== 0) {
|
|
467
493
|
while (indice < 0) {
|
|
@@ -481,15 +507,15 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
481
507
|
objeto[indice] = valor;
|
|
482
508
|
}
|
|
483
509
|
else {
|
|
484
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
510
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.objeto.nome, 'Somente listas, dicionários, classes e objetos podem ser mudados por sobrescrita.', expressao.linha);
|
|
485
511
|
}
|
|
486
512
|
};
|
|
487
|
-
InterpretadorEguaClassico.prototype.
|
|
513
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoAcessoIndiceVariavel = function (expressao) {
|
|
488
514
|
var objeto = this.avaliar(expressao.entidadeChamada);
|
|
489
515
|
var indice = this.avaliar(expressao.indice);
|
|
490
516
|
if (Array.isArray(objeto)) {
|
|
491
517
|
if (!Number.isInteger(indice)) {
|
|
492
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.
|
|
518
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simboloFechamento, 'Somente inteiros podem ser usados para indexar um vetor.', expressao.linha);
|
|
493
519
|
}
|
|
494
520
|
if (indice < 0 && objeto.length !== 0) {
|
|
495
521
|
while (indice < 0) {
|
|
@@ -497,7 +523,7 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
497
523
|
}
|
|
498
524
|
}
|
|
499
525
|
if (indice >= objeto.length) {
|
|
500
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.
|
|
526
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simboloFechamento, 'Índice do vetor fora do intervalo.', expressao.linha);
|
|
501
527
|
}
|
|
502
528
|
return objeto[indice];
|
|
503
529
|
}
|
|
@@ -508,9 +534,9 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
508
534
|
objeto instanceof modulo_1.DeleguaModulo) {
|
|
509
535
|
return objeto[indice] || null;
|
|
510
536
|
}
|
|
511
|
-
else if (typeof objeto ===
|
|
537
|
+
else if (typeof objeto === 'string') {
|
|
512
538
|
if (!Number.isInteger(indice)) {
|
|
513
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.
|
|
539
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simboloFechamento, 'Somente inteiros podem ser usados para indexar um vetor.', expressao.linha);
|
|
514
540
|
}
|
|
515
541
|
if (indice < 0 && objeto.length !== 0) {
|
|
516
542
|
while (indice < 0) {
|
|
@@ -518,123 +544,123 @@ var InterpretadorEguaClassico = /** @class */ (function () {
|
|
|
518
544
|
}
|
|
519
545
|
}
|
|
520
546
|
if (indice >= objeto.length) {
|
|
521
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.
|
|
547
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.simboloFechamento, 'Índice fora do tamanho.', expressao.linha);
|
|
522
548
|
}
|
|
523
549
|
return objeto.charAt(indice);
|
|
524
550
|
}
|
|
525
551
|
else {
|
|
526
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.entidadeChamada.nome,
|
|
552
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.entidadeChamada.nome, 'Somente listas, dicionários, classes e objetos podem ser mudados por sobrescrita.', expressao.linha);
|
|
527
553
|
}
|
|
528
554
|
};
|
|
529
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoDefinir = function (
|
|
530
|
-
var objeto = this.avaliar(
|
|
555
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoDefinir = function (expressao) {
|
|
556
|
+
var objeto = this.avaliar(expressao.objeto);
|
|
531
557
|
if (!(objeto instanceof instancia_1.DeleguaInstancia) &&
|
|
532
558
|
objeto.constructor !== Object) {
|
|
533
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
559
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.objeto.nome, 'Somente instâncias e dicionários podem possuir campos.', expressao.linha);
|
|
534
560
|
}
|
|
535
|
-
var valor = this.avaliar(
|
|
561
|
+
var valor = this.avaliar(expressao.valor);
|
|
536
562
|
if (objeto instanceof instancia_1.DeleguaInstancia) {
|
|
537
|
-
objeto.set(
|
|
563
|
+
objeto.set(expressao.nome, valor);
|
|
538
564
|
return valor;
|
|
539
565
|
}
|
|
540
566
|
else if (objeto.constructor === Object) {
|
|
541
|
-
objeto[
|
|
567
|
+
objeto[expressao.simbolo.lexema] = valor;
|
|
542
568
|
}
|
|
543
569
|
};
|
|
544
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoFuncao = function (
|
|
545
|
-
var funcao = new funcao_1.DeleguaFuncao(
|
|
546
|
-
this.ambiente.definirVariavel(
|
|
570
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoFuncao = function (declaracao) {
|
|
571
|
+
var funcao = new funcao_1.DeleguaFuncao(declaracao.simbolo.lexema, declaracao.funcao, this.ambiente, false);
|
|
572
|
+
this.ambiente.definirVariavel(declaracao.simbolo.lexema, funcao);
|
|
547
573
|
};
|
|
548
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoClasse = function (
|
|
574
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoClasse = function (declaracao) {
|
|
549
575
|
var superClasse = null;
|
|
550
|
-
if (
|
|
551
|
-
superClasse = this.avaliar(
|
|
576
|
+
if (declaracao.superClasse !== null) {
|
|
577
|
+
superClasse = this.avaliar(declaracao.superClasse);
|
|
552
578
|
if (!(superClasse instanceof classe_1.DeleguaClasse)) {
|
|
553
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
579
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(declaracao.superClasse.nome, 'SuperClasse precisa ser uma classe.', declaracao.linha);
|
|
554
580
|
}
|
|
555
581
|
}
|
|
556
|
-
this.ambiente.definirVariavel(
|
|
557
|
-
if (
|
|
582
|
+
this.ambiente.definirVariavel(declaracao.simbolo.lexema, null);
|
|
583
|
+
if (declaracao.superClasse !== null) {
|
|
558
584
|
this.ambiente = new ambiente_1.Ambiente(this.ambiente);
|
|
559
|
-
this.ambiente.definirVariavel(
|
|
585
|
+
this.ambiente.definirVariavel('super', superClasse);
|
|
560
586
|
}
|
|
561
587
|
var metodos = {};
|
|
562
|
-
var definirMetodos =
|
|
563
|
-
for (var i = 0; i <
|
|
588
|
+
var definirMetodos = declaracao.metodos;
|
|
589
|
+
for (var i = 0; i < declaracao.metodos.length; i++) {
|
|
564
590
|
var metodoAtual = definirMetodos[i];
|
|
565
|
-
var eInicializado = metodoAtual.
|
|
566
|
-
var funcao = new funcao_1.DeleguaFuncao(metodoAtual.
|
|
567
|
-
metodos[metodoAtual.
|
|
591
|
+
var eInicializado = metodoAtual.simbolo.lexema === 'construtor';
|
|
592
|
+
var funcao = new funcao_1.DeleguaFuncao(metodoAtual.simbolo.lexema, metodoAtual.funcao, this.ambiente, eInicializado);
|
|
593
|
+
metodos[metodoAtual.simbolo.lexema] = funcao;
|
|
568
594
|
}
|
|
569
|
-
var criado = new classe_1.DeleguaClasse(
|
|
595
|
+
var criado = new classe_1.DeleguaClasse(declaracao.simbolo.lexema, superClasse, metodos);
|
|
570
596
|
if (superClasse !== null) {
|
|
571
597
|
this.ambiente = this.ambiente.enclosing;
|
|
572
598
|
}
|
|
573
|
-
this.ambiente.atribuirVariavel(
|
|
599
|
+
this.ambiente.atribuirVariavel(declaracao.simbolo, criado);
|
|
574
600
|
return null;
|
|
575
601
|
};
|
|
576
|
-
InterpretadorEguaClassico.prototype.
|
|
577
|
-
var objeto = this.avaliar(
|
|
602
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoAcessoMetodo = function (expressao) {
|
|
603
|
+
var objeto = this.avaliar(expressao.objeto);
|
|
578
604
|
if (objeto instanceof instancia_1.DeleguaInstancia) {
|
|
579
|
-
return objeto.get(
|
|
605
|
+
return objeto.get(expressao.simbolo) || null;
|
|
580
606
|
}
|
|
581
607
|
else if (objeto.constructor === Object) {
|
|
582
|
-
return objeto[
|
|
608
|
+
return objeto[expressao.simbolo.lexema] || null;
|
|
583
609
|
}
|
|
584
610
|
else if (objeto instanceof modulo_1.DeleguaModulo) {
|
|
585
|
-
return objeto[
|
|
611
|
+
return objeto[expressao.simbolo.lexema] || null;
|
|
586
612
|
}
|
|
587
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
613
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.nome, 'Você só pode acessar métodos do objeto e dicionários.', expressao.linha);
|
|
588
614
|
};
|
|
589
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoIsto = function (
|
|
590
|
-
return this.procurarVariavel(
|
|
615
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoIsto = function (expressao) {
|
|
616
|
+
return this.procurarVariavel(expressao.palavraChave, expressao);
|
|
591
617
|
};
|
|
592
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoDicionario = function (
|
|
618
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoDicionario = function (expressao) {
|
|
593
619
|
var dicionario = {};
|
|
594
|
-
for (var i = 0; i <
|
|
595
|
-
dicionario[this.avaliar(
|
|
620
|
+
for (var i = 0; i < expressao.chaves.length; i++) {
|
|
621
|
+
dicionario[this.avaliar(expressao.chaves[i])] = this.avaliar(expressao.valores[i]);
|
|
596
622
|
}
|
|
597
623
|
return dicionario;
|
|
598
624
|
};
|
|
599
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoVetor = function (
|
|
625
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoVetor = function (expressao) {
|
|
600
626
|
var valores = [];
|
|
601
|
-
for (var i = 0; i <
|
|
602
|
-
valores.push(this.avaliar(
|
|
627
|
+
for (var i = 0; i < expressao.valores.length; i++) {
|
|
628
|
+
valores.push(this.avaliar(expressao.valores[i]));
|
|
603
629
|
}
|
|
604
630
|
return valores;
|
|
605
631
|
};
|
|
606
|
-
InterpretadorEguaClassico.prototype.visitarExpressaoSuper = function (
|
|
607
|
-
var distancia = this.locais.get(
|
|
608
|
-
var superClasse = this.ambiente.obterVariavelEm(distancia,
|
|
609
|
-
var objeto = this.ambiente.obterVariavelEm(distancia - 1,
|
|
610
|
-
var metodo = superClasse.encontrarMetodo(
|
|
632
|
+
InterpretadorEguaClassico.prototype.visitarExpressaoSuper = function (expressao) {
|
|
633
|
+
var distancia = this.locais.get(expressao);
|
|
634
|
+
var superClasse = this.ambiente.obterVariavelEm(distancia, 'super');
|
|
635
|
+
var objeto = this.ambiente.obterVariavelEm(distancia - 1, 'isto');
|
|
636
|
+
var metodo = superClasse.encontrarMetodo(expressao.metodo.lexema);
|
|
611
637
|
if (metodo === undefined) {
|
|
612
|
-
throw new excecoes_1.ErroEmTempoDeExecucao(
|
|
638
|
+
throw new excecoes_1.ErroEmTempoDeExecucao(expressao.metodo, 'Método chamado indefinido.', expressao.linha);
|
|
613
639
|
}
|
|
614
640
|
return metodo.definirEscopo(objeto);
|
|
615
641
|
};
|
|
616
642
|
InterpretadorEguaClassico.prototype.paraTexto = function (objeto) {
|
|
617
643
|
if (objeto === null)
|
|
618
|
-
return
|
|
619
|
-
if (typeof objeto ===
|
|
620
|
-
return objeto ?
|
|
644
|
+
return 'nulo';
|
|
645
|
+
if (typeof objeto === 'boolean') {
|
|
646
|
+
return objeto ? 'verdadeiro' : 'falso';
|
|
621
647
|
}
|
|
622
648
|
if (objeto instanceof Date) {
|
|
623
|
-
var formato = Intl.DateTimeFormat(
|
|
624
|
-
dateStyle:
|
|
625
|
-
timeStyle:
|
|
649
|
+
var formato = Intl.DateTimeFormat('pt', {
|
|
650
|
+
dateStyle: 'full',
|
|
651
|
+
timeStyle: 'full',
|
|
626
652
|
});
|
|
627
653
|
return formato.format(objeto);
|
|
628
654
|
}
|
|
629
655
|
if (Array.isArray(objeto))
|
|
630
656
|
return objeto;
|
|
631
|
-
if (typeof objeto ===
|
|
657
|
+
if (typeof objeto === 'object')
|
|
632
658
|
return JSON.stringify(objeto);
|
|
633
659
|
return objeto.toString();
|
|
634
660
|
};
|
|
635
|
-
InterpretadorEguaClassico.prototype.executar = function (
|
|
661
|
+
InterpretadorEguaClassico.prototype.executar = function (declaracao, mostrarResultado) {
|
|
636
662
|
if (mostrarResultado === void 0) { mostrarResultado = false; }
|
|
637
|
-
|
|
663
|
+
declaracao.aceitar(this);
|
|
638
664
|
};
|
|
639
665
|
InterpretadorEguaClassico.prototype.interpretar = function (declaracoes) {
|
|
640
666
|
try {
|