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