@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,25 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var tiposDeSimbolos_1 = require("../../tiposDeSimbolos");
|
|
6
|
+
exports.AvaliadorSintaticoEguaClassico = void 0;
|
|
7
|
+
var tiposDeSimbolos_1 = __importDefault(require("../../tiposDeSimbolos"));
|
|
5
8
|
var construtos_1 = require("../../construtos");
|
|
6
|
-
var
|
|
9
|
+
var erro_avaliador_sintatico_1 = require("../erro-avaliador-sintatico");
|
|
7
10
|
var declaracoes_1 = require("../../declaracoes");
|
|
8
11
|
/**
|
|
9
12
|
* O avaliador sintático (Parser) é responsável por transformar os símbolos do Lexador em estruturas de alto nível.
|
|
10
13
|
* Essas estruturas de alto nível são as partes que executam lógica de programação de fato.
|
|
11
14
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
15
|
+
var AvaliadorSintaticoEguaClassico = /** @class */ (function () {
|
|
16
|
+
function AvaliadorSintaticoEguaClassico(simbolos) {
|
|
14
17
|
this.simbolos = simbolos;
|
|
15
|
-
this.Delegua = Delegua;
|
|
16
18
|
this.atual = 0;
|
|
17
19
|
this.ciclos = 0;
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
+
AvaliadorSintaticoEguaClassico.prototype.sincronizar = function () {
|
|
22
|
+
this.avancarEDevolverAnterior();
|
|
21
23
|
while (!this.estaNoFinal()) {
|
|
22
|
-
if (this.
|
|
24
|
+
if (this.simboloAnterior().tipo === tiposDeSimbolos_1.default.PONTO_E_VIRGULA)
|
|
23
25
|
return;
|
|
24
26
|
switch (this.simboloAtual().tipo) {
|
|
25
27
|
case tiposDeSimbolos_1.default.CLASSE:
|
|
@@ -32,86 +34,88 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
32
34
|
case tiposDeSimbolos_1.default.RETORNA:
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
|
-
this.
|
|
37
|
+
this.avancarEDevolverAnterior();
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
AvaliadorSintaticoEguaClassico.prototype.erro = function (simbolo, mensagemDeErro) {
|
|
41
|
+
var excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(simbolo, mensagemDeErro);
|
|
42
|
+
this.erros.push(excecao);
|
|
43
|
+
return excecao;
|
|
41
44
|
};
|
|
42
|
-
|
|
43
|
-
if (this.
|
|
44
|
-
return this.
|
|
45
|
+
AvaliadorSintaticoEguaClassico.prototype.consumir = function (tipo, mensagemDeErro) {
|
|
46
|
+
if (this.verificarTipoSimboloAtual(tipo))
|
|
47
|
+
return this.avancarEDevolverAnterior();
|
|
45
48
|
else
|
|
46
49
|
throw this.erro(this.simboloAtual(), mensagemDeErro);
|
|
47
50
|
};
|
|
48
|
-
|
|
51
|
+
AvaliadorSintaticoEguaClassico.prototype.verificarTipoSimboloAtual = function (tipo) {
|
|
49
52
|
if (this.estaNoFinal())
|
|
50
53
|
return false;
|
|
51
54
|
return this.simboloAtual().tipo === tipo;
|
|
52
55
|
};
|
|
53
|
-
|
|
56
|
+
AvaliadorSintaticoEguaClassico.prototype.verificarTipoProximoSimbolo = function (tipo) {
|
|
54
57
|
if (this.estaNoFinal())
|
|
55
58
|
return false;
|
|
56
59
|
return this.simbolos[this.atual + 1].tipo === tipo;
|
|
57
60
|
};
|
|
58
|
-
|
|
61
|
+
AvaliadorSintaticoEguaClassico.prototype.simboloAtual = function () {
|
|
59
62
|
return this.simbolos[this.atual];
|
|
60
63
|
};
|
|
61
|
-
|
|
64
|
+
AvaliadorSintaticoEguaClassico.prototype.simboloAnterior = function () {
|
|
62
65
|
return this.simbolos[this.atual - 1];
|
|
63
66
|
};
|
|
64
|
-
|
|
67
|
+
AvaliadorSintaticoEguaClassico.prototype.simboloNaPosicao = function (posicao) {
|
|
65
68
|
return this.simbolos[this.atual + posicao];
|
|
66
69
|
};
|
|
67
|
-
|
|
70
|
+
AvaliadorSintaticoEguaClassico.prototype.estaNoFinal = function () {
|
|
68
71
|
return this.simboloAtual().tipo === tiposDeSimbolos_1.default.EOF;
|
|
69
72
|
};
|
|
70
|
-
|
|
73
|
+
AvaliadorSintaticoEguaClassico.prototype.avancarEDevolverAnterior = function () {
|
|
71
74
|
if (!this.estaNoFinal())
|
|
72
75
|
this.atual += 1;
|
|
73
|
-
return this.
|
|
76
|
+
return this.simboloAnterior();
|
|
74
77
|
};
|
|
75
|
-
|
|
78
|
+
AvaliadorSintaticoEguaClassico.prototype.verificarSeSimboloAtualEIgualA = function () {
|
|
76
79
|
var argumentos = [];
|
|
77
80
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
78
81
|
argumentos[_i] = arguments[_i];
|
|
79
82
|
}
|
|
80
83
|
for (var i = 0; i < argumentos.length; i++) {
|
|
81
84
|
var tipoAtual = argumentos[i];
|
|
82
|
-
if (this.
|
|
83
|
-
this.
|
|
85
|
+
if (this.verificarTipoSimboloAtual(tipoAtual)) {
|
|
86
|
+
this.avancarEDevolverAnterior();
|
|
84
87
|
return true;
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
return false;
|
|
88
91
|
};
|
|
89
|
-
|
|
92
|
+
AvaliadorSintaticoEguaClassico.prototype.primario = function () {
|
|
90
93
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.SUPER)) {
|
|
91
|
-
var palavraChave = this.
|
|
94
|
+
var palavraChave = this.simboloAnterior();
|
|
92
95
|
this.consumir(tiposDeSimbolos_1.default.PONTO, "Esperado '.' após 'super'.");
|
|
93
|
-
var metodo = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR,
|
|
94
|
-
return new construtos_1.Super(palavraChave, metodo);
|
|
96
|
+
var metodo = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, 'Esperado nome do método da SuperClasse.');
|
|
97
|
+
return new construtos_1.Super(0, palavraChave, metodo);
|
|
95
98
|
}
|
|
96
99
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.COLCHETE_ESQUERDO)) {
|
|
97
100
|
var valores = [];
|
|
98
101
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.COLCHETE_DIREITO)) {
|
|
99
|
-
return new construtos_1.Vetor([]);
|
|
102
|
+
return new construtos_1.Vetor(0, []);
|
|
100
103
|
}
|
|
101
104
|
while (!this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.COLCHETE_DIREITO)) {
|
|
102
105
|
var valor = this.atribuir();
|
|
103
106
|
valores.push(valor);
|
|
104
|
-
if (this.simboloAtual().tipo !==
|
|
105
|
-
|
|
107
|
+
if (this.simboloAtual().tipo !==
|
|
108
|
+
tiposDeSimbolos_1.default.COLCHETE_DIREITO) {
|
|
109
|
+
this.consumir(tiposDeSimbolos_1.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
|
-
return new construtos_1.Vetor(valores);
|
|
112
|
+
return new construtos_1.Vetor(0, valores);
|
|
109
113
|
}
|
|
110
114
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CHAVE_ESQUERDA)) {
|
|
111
115
|
var chaves = [];
|
|
112
116
|
var valores = [];
|
|
113
117
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CHAVE_DIREITA)) {
|
|
114
|
-
return new construtos_1.Dicionario([], []);
|
|
118
|
+
return new construtos_1.Dicionario(0, [], []);
|
|
115
119
|
}
|
|
116
120
|
while (!this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CHAVE_DIREITA)) {
|
|
117
121
|
var chave = this.atribuir();
|
|
@@ -120,42 +124,42 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
120
124
|
chaves.push(chave);
|
|
121
125
|
valores.push(valor);
|
|
122
126
|
if (this.simboloAtual().tipo !== tiposDeSimbolos_1.default.CHAVE_DIREITA) {
|
|
123
|
-
this.consumir(tiposDeSimbolos_1.default.VIRGULA,
|
|
127
|
+
this.consumir(tiposDeSimbolos_1.default.VIRGULA, 'Esperado vírgula antes da próxima expressão.');
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
|
-
return new construtos_1.Dicionario(chaves, valores);
|
|
130
|
+
return new construtos_1.Dicionario(0, chaves, valores);
|
|
127
131
|
}
|
|
128
132
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.FUNÇÃO))
|
|
129
|
-
return this.corpoDaFuncao(
|
|
133
|
+
return this.corpoDaFuncao('função');
|
|
130
134
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.FALSO))
|
|
131
|
-
return new construtos_1.Literal(false);
|
|
135
|
+
return new construtos_1.Literal(0, false);
|
|
132
136
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.VERDADEIRO))
|
|
133
|
-
return new construtos_1.Literal(true);
|
|
137
|
+
return new construtos_1.Literal(0, true);
|
|
134
138
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.NULO))
|
|
135
|
-
return new construtos_1.Literal(null);
|
|
139
|
+
return new construtos_1.Literal(0, null);
|
|
136
140
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.ISTO))
|
|
137
|
-
return new construtos_1.Isto(this.
|
|
141
|
+
return new construtos_1.Isto(this.simboloAnterior());
|
|
138
142
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.NUMERO, tiposDeSimbolos_1.default.TEXTO)) {
|
|
139
|
-
return new construtos_1.Literal(this.
|
|
143
|
+
return new construtos_1.Literal(0, this.simboloAnterior().literal);
|
|
140
144
|
}
|
|
141
145
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.IDENTIFICADOR)) {
|
|
142
|
-
return new construtos_1.Variavel(this.
|
|
146
|
+
return new construtos_1.Variavel(this.simboloAnterior());
|
|
143
147
|
}
|
|
144
148
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO)) {
|
|
145
149
|
var expr = this.expressao();
|
|
146
150
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após a expressão.");
|
|
147
|
-
return new construtos_1.
|
|
151
|
+
return new construtos_1.Agrupamento(0, expr);
|
|
148
152
|
}
|
|
149
153
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.IMPORTAR))
|
|
150
154
|
return this.declaracaoImportar();
|
|
151
|
-
throw this.erro(this.simboloAtual(),
|
|
155
|
+
throw this.erro(this.simboloAtual(), 'Esperado expressão.');
|
|
152
156
|
};
|
|
153
|
-
|
|
157
|
+
AvaliadorSintaticoEguaClassico.prototype.finalizarChamada = function (entidadeChamada) {
|
|
154
158
|
var argumentos = [];
|
|
155
|
-
if (!this.
|
|
159
|
+
if (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PARENTESE_DIREITO)) {
|
|
156
160
|
do {
|
|
157
161
|
if (argumentos.length >= 255) {
|
|
158
|
-
throw this.erro(this.simboloAtual(),
|
|
162
|
+
throw this.erro(this.simboloAtual(), 'Não pode haver mais de 255 argumentos.');
|
|
159
163
|
}
|
|
160
164
|
argumentos.push(this.expressao());
|
|
161
165
|
} while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.VIRGULA));
|
|
@@ -163,201 +167,202 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
163
167
|
var parenteseDireito = this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após os argumentos.");
|
|
164
168
|
return new construtos_1.Chamada(entidadeChamada, parenteseDireito, argumentos);
|
|
165
169
|
};
|
|
166
|
-
|
|
167
|
-
var
|
|
170
|
+
AvaliadorSintaticoEguaClassico.prototype.chamar = function () {
|
|
171
|
+
var expressao = this.primario();
|
|
168
172
|
while (true) {
|
|
169
173
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO)) {
|
|
170
|
-
|
|
174
|
+
expressao = this.finalizarChamada(expressao);
|
|
171
175
|
}
|
|
172
176
|
else if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.PONTO)) {
|
|
173
177
|
var nome = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, "Esperado nome do método após '.'.");
|
|
174
|
-
|
|
178
|
+
expressao = new construtos_1.AcessoMetodo(expressao, nome);
|
|
175
179
|
}
|
|
176
180
|
else if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.COLCHETE_ESQUERDO)) {
|
|
177
181
|
var indice = this.expressao();
|
|
178
|
-
var
|
|
179
|
-
|
|
182
|
+
var simboloFechamento = this.consumir(tiposDeSimbolos_1.default.COLCHETE_DIREITO, "Esperado ']' após escrita do indice.");
|
|
183
|
+
expressao = new construtos_1.AcessoIndiceVariavel(expressao, indice, simboloFechamento);
|
|
180
184
|
}
|
|
181
185
|
else {
|
|
182
186
|
break;
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
|
-
return
|
|
189
|
+
return expressao;
|
|
186
190
|
};
|
|
187
|
-
|
|
191
|
+
AvaliadorSintaticoEguaClassico.prototype.unario = function () {
|
|
188
192
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.NEGACAO, tiposDeSimbolos_1.default.SUBTRACAO, tiposDeSimbolos_1.default.BIT_NOT)) {
|
|
189
|
-
var operador = this.
|
|
193
|
+
var operador = this.simboloAnterior();
|
|
190
194
|
var direito = this.unario();
|
|
191
195
|
return new construtos_1.Unario(operador, direito);
|
|
192
196
|
}
|
|
193
197
|
return this.chamar();
|
|
194
198
|
};
|
|
195
|
-
|
|
196
|
-
var
|
|
199
|
+
AvaliadorSintaticoEguaClassico.prototype.exponenciacao = function () {
|
|
200
|
+
var expressao = this.unario();
|
|
197
201
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.EXPONENCIACAO)) {
|
|
198
|
-
var operador = this.
|
|
202
|
+
var operador = this.simboloAnterior();
|
|
199
203
|
var direito = this.unario();
|
|
200
|
-
|
|
204
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
201
205
|
}
|
|
202
|
-
return
|
|
206
|
+
return expressao;
|
|
203
207
|
};
|
|
204
|
-
|
|
205
|
-
var
|
|
208
|
+
AvaliadorSintaticoEguaClassico.prototype.multiplicar = function () {
|
|
209
|
+
var expressao = this.exponenciacao();
|
|
206
210
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.DIVISAO, tiposDeSimbolos_1.default.MULTIPLICACAO, tiposDeSimbolos_1.default.MODULO)) {
|
|
207
|
-
var operador = this.
|
|
211
|
+
var operador = this.simboloAnterior();
|
|
208
212
|
var direito = this.exponenciacao();
|
|
209
|
-
|
|
213
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
210
214
|
}
|
|
211
|
-
return
|
|
215
|
+
return expressao;
|
|
212
216
|
};
|
|
213
|
-
|
|
214
|
-
var
|
|
217
|
+
AvaliadorSintaticoEguaClassico.prototype.adicionar = function () {
|
|
218
|
+
var expressao = this.multiplicar();
|
|
215
219
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.SUBTRACAO, tiposDeSimbolos_1.default.ADICAO)) {
|
|
216
|
-
var operador = this.
|
|
220
|
+
var operador = this.simboloAnterior();
|
|
217
221
|
var direito = this.multiplicar();
|
|
218
|
-
|
|
222
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
219
223
|
}
|
|
220
|
-
return
|
|
224
|
+
return expressao;
|
|
221
225
|
};
|
|
222
|
-
|
|
223
|
-
var
|
|
226
|
+
AvaliadorSintaticoEguaClassico.prototype.bitFill = function () {
|
|
227
|
+
var expressao = this.adicionar();
|
|
224
228
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.MENOR_MENOR, tiposDeSimbolos_1.default.MAIOR_MAIOR)) {
|
|
225
|
-
var operador = this.
|
|
229
|
+
var operador = this.simboloAnterior();
|
|
226
230
|
var direito = this.adicionar();
|
|
227
|
-
|
|
231
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
228
232
|
}
|
|
229
|
-
return
|
|
233
|
+
return expressao;
|
|
230
234
|
};
|
|
231
|
-
|
|
232
|
-
var
|
|
235
|
+
AvaliadorSintaticoEguaClassico.prototype.bitE = function () {
|
|
236
|
+
var expressao = this.bitFill();
|
|
233
237
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.BIT_AND)) {
|
|
234
|
-
var operador = this.
|
|
238
|
+
var operador = this.simboloAnterior();
|
|
235
239
|
var direito = this.bitFill();
|
|
236
|
-
|
|
240
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
237
241
|
}
|
|
238
|
-
return
|
|
242
|
+
return expressao;
|
|
239
243
|
};
|
|
240
|
-
|
|
241
|
-
var
|
|
244
|
+
AvaliadorSintaticoEguaClassico.prototype.bitOu = function () {
|
|
245
|
+
var expressao = this.bitE();
|
|
242
246
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.BIT_OR, tiposDeSimbolos_1.default.BIT_XOR)) {
|
|
243
|
-
var operador = this.
|
|
247
|
+
var operador = this.simboloAnterior();
|
|
244
248
|
var direito = this.bitE();
|
|
245
|
-
|
|
249
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
246
250
|
}
|
|
247
|
-
return
|
|
251
|
+
return expressao;
|
|
248
252
|
};
|
|
249
|
-
|
|
250
|
-
var
|
|
253
|
+
AvaliadorSintaticoEguaClassico.prototype.comparar = function () {
|
|
254
|
+
var expressao = this.bitOu();
|
|
251
255
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.MAIOR, tiposDeSimbolos_1.default.MAIOR_IGUAL, tiposDeSimbolos_1.default.MENOR, tiposDeSimbolos_1.default.MENOR_IGUAL)) {
|
|
252
|
-
var operador = this.
|
|
256
|
+
var operador = this.simboloAnterior();
|
|
253
257
|
var direito = this.bitOu();
|
|
254
|
-
|
|
258
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
255
259
|
}
|
|
256
|
-
return
|
|
260
|
+
return expressao;
|
|
257
261
|
};
|
|
258
|
-
|
|
259
|
-
var
|
|
262
|
+
AvaliadorSintaticoEguaClassico.prototype.comparacaoIgualdade = function () {
|
|
263
|
+
var expressao = this.comparar();
|
|
260
264
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.DIFERENTE, tiposDeSimbolos_1.default.IGUAL_IGUAL)) {
|
|
261
|
-
var operador = this.
|
|
265
|
+
var operador = this.simboloAnterior();
|
|
262
266
|
var direito = this.comparar();
|
|
263
|
-
|
|
267
|
+
expressao = new construtos_1.Binario(expressao, operador, direito);
|
|
264
268
|
}
|
|
265
|
-
return
|
|
269
|
+
return expressao;
|
|
266
270
|
};
|
|
267
|
-
|
|
268
|
-
var
|
|
271
|
+
AvaliadorSintaticoEguaClassico.prototype.em = function () {
|
|
272
|
+
var expressao = this.comparacaoIgualdade();
|
|
269
273
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.EM)) {
|
|
270
|
-
var operador = this.
|
|
274
|
+
var operador = this.simboloAnterior();
|
|
271
275
|
var direito = this.comparacaoIgualdade();
|
|
272
|
-
|
|
276
|
+
expressao = new construtos_1.Logico(expressao, operador, direito);
|
|
273
277
|
}
|
|
274
|
-
return
|
|
278
|
+
return expressao;
|
|
275
279
|
};
|
|
276
|
-
|
|
277
|
-
var
|
|
280
|
+
AvaliadorSintaticoEguaClassico.prototype.e = function () {
|
|
281
|
+
var expressao = this.em();
|
|
278
282
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.E)) {
|
|
279
|
-
var operador = this.
|
|
283
|
+
var operador = this.simboloAnterior();
|
|
280
284
|
var direito = this.em();
|
|
281
|
-
|
|
285
|
+
expressao = new construtos_1.Logico(expressao, operador, direito);
|
|
282
286
|
}
|
|
283
|
-
return
|
|
287
|
+
return expressao;
|
|
284
288
|
};
|
|
285
|
-
|
|
286
|
-
var
|
|
289
|
+
AvaliadorSintaticoEguaClassico.prototype.ou = function () {
|
|
290
|
+
var expressao = this.e();
|
|
287
291
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.OU)) {
|
|
288
|
-
var operador = this.
|
|
292
|
+
var operador = this.simboloAnterior();
|
|
289
293
|
var direito = this.e();
|
|
290
|
-
|
|
294
|
+
expressao = new construtos_1.Logico(expressao, operador, direito);
|
|
291
295
|
}
|
|
292
|
-
return
|
|
296
|
+
return expressao;
|
|
293
297
|
};
|
|
294
|
-
|
|
295
|
-
var
|
|
298
|
+
AvaliadorSintaticoEguaClassico.prototype.atribuir = function () {
|
|
299
|
+
var expressao = this.ou();
|
|
296
300
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.IGUAL)) {
|
|
297
|
-
var igual = this.
|
|
301
|
+
var igual = this.simboloAnterior();
|
|
298
302
|
var valor = this.atribuir();
|
|
299
|
-
if (
|
|
300
|
-
var
|
|
301
|
-
return new construtos_1.Atribuir(
|
|
303
|
+
if (expressao instanceof construtos_1.Variavel) {
|
|
304
|
+
var simbolo = expressao.simbolo;
|
|
305
|
+
return new construtos_1.Atribuir(simbolo, valor);
|
|
302
306
|
}
|
|
303
|
-
else if (
|
|
304
|
-
var get =
|
|
305
|
-
return new construtos_1.Conjunto(get.objeto, get.
|
|
307
|
+
else if (expressao instanceof construtos_1.AcessoMetodo) {
|
|
308
|
+
var get = expressao;
|
|
309
|
+
return new construtos_1.Conjunto(0, get.objeto, get.simbolo, valor);
|
|
306
310
|
}
|
|
307
|
-
else if (
|
|
308
|
-
return new construtos_1.AtribuicaoSobrescrita(
|
|
311
|
+
else if (expressao instanceof construtos_1.AcessoIndiceVariavel) {
|
|
312
|
+
return new construtos_1.AtribuicaoSobrescrita(0, expressao.entidadeChamada, expressao.indice, valor);
|
|
309
313
|
}
|
|
310
|
-
this.erro(igual,
|
|
314
|
+
this.erro(igual, 'Tarefa de atribuição inválida');
|
|
311
315
|
}
|
|
312
|
-
return
|
|
316
|
+
return expressao;
|
|
313
317
|
};
|
|
314
|
-
|
|
318
|
+
AvaliadorSintaticoEguaClassico.prototype.expressao = function () {
|
|
315
319
|
return this.atribuir();
|
|
316
320
|
};
|
|
317
|
-
|
|
321
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoEscreva = function () {
|
|
318
322
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' antes dos valores em escreva.");
|
|
319
323
|
var valor = this.expressao();
|
|
320
324
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após os valores em escreva.");
|
|
321
325
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após o valor.");
|
|
322
326
|
return new declaracoes_1.Escreva(valor);
|
|
323
327
|
};
|
|
324
|
-
|
|
325
|
-
var
|
|
328
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoExpressao = function () {
|
|
329
|
+
var expressao = this.expressao();
|
|
326
330
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após expressão.");
|
|
327
|
-
return new declaracoes_1.Expressao(
|
|
331
|
+
return new declaracoes_1.Expressao(expressao);
|
|
328
332
|
};
|
|
329
|
-
|
|
333
|
+
AvaliadorSintaticoEguaClassico.prototype.blocoEscopo = function () {
|
|
330
334
|
var declaracoes = [];
|
|
331
|
-
while (!this.
|
|
335
|
+
while (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CHAVE_DIREITA) &&
|
|
332
336
|
!this.estaNoFinal()) {
|
|
333
337
|
declaracoes.push(this.declaracao());
|
|
334
338
|
}
|
|
335
339
|
this.consumir(tiposDeSimbolos_1.default.CHAVE_DIREITA, "Esperado '}' após o bloco.");
|
|
336
340
|
return declaracoes;
|
|
337
341
|
};
|
|
338
|
-
|
|
342
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoSe = function () {
|
|
343
|
+
var simboloSe = this.simboloAnterior();
|
|
339
344
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'se'.");
|
|
340
345
|
var condicao = this.expressao();
|
|
341
346
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após condição do se.");
|
|
342
|
-
var
|
|
343
|
-
var
|
|
347
|
+
var caminhoEntao = this.resolverDeclaracao();
|
|
348
|
+
var caminhosSeSenao = [];
|
|
344
349
|
while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.SENÃOSE)) {
|
|
345
350
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'senãose'.");
|
|
346
|
-
var
|
|
351
|
+
var condicaoSeSenao = this.expressao();
|
|
347
352
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' apóes codição do 'senãose.");
|
|
348
|
-
var
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
353
|
+
var caminho = this.resolverDeclaracao();
|
|
354
|
+
caminhosSeSenao.push({
|
|
355
|
+
condicao: condicaoSeSenao,
|
|
356
|
+
caminho: caminho,
|
|
352
357
|
});
|
|
353
358
|
}
|
|
354
|
-
var
|
|
359
|
+
var caminhoSenao = null;
|
|
355
360
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.SENÃO)) {
|
|
356
|
-
|
|
361
|
+
caminhoSenao = this.resolverDeclaracao();
|
|
357
362
|
}
|
|
358
|
-
return new declaracoes_1.Se(condicao,
|
|
363
|
+
return new declaracoes_1.Se(Number(simboloSe.linha), condicao, caminhoEntao, caminhosSeSenao, caminhoSenao);
|
|
359
364
|
};
|
|
360
|
-
|
|
365
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoEnquanto = function () {
|
|
361
366
|
try {
|
|
362
367
|
this.ciclos += 1;
|
|
363
368
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'enquanto'.");
|
|
@@ -370,8 +375,9 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
370
375
|
this.ciclos -= 1;
|
|
371
376
|
}
|
|
372
377
|
};
|
|
373
|
-
|
|
378
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoPara = function () {
|
|
374
379
|
try {
|
|
380
|
+
var simboloPara = this.simboloAnterior();
|
|
375
381
|
this.ciclos += 1;
|
|
376
382
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' após 'para'.");
|
|
377
383
|
var inicializador = void 0;
|
|
@@ -385,103 +391,106 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
385
391
|
inicializador = this.declaracaoExpressao();
|
|
386
392
|
}
|
|
387
393
|
var condicao = null;
|
|
388
|
-
if (!this.
|
|
394
|
+
if (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PONTO_E_VIRGULA)) {
|
|
389
395
|
condicao = this.expressao();
|
|
390
396
|
}
|
|
391
397
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após valores da condicional");
|
|
392
398
|
var incrementar = null;
|
|
393
|
-
if (!this.
|
|
399
|
+
if (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PARENTESE_DIREITO)) {
|
|
394
400
|
incrementar = this.expressao();
|
|
395
401
|
}
|
|
396
402
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após cláusulas");
|
|
397
403
|
var corpo = this.resolverDeclaracao();
|
|
398
|
-
return new declaracoes_1.Para(inicializador, condicao, incrementar, corpo);
|
|
404
|
+
return new declaracoes_1.Para(Number(simboloPara.linha), inicializador, condicao, incrementar, corpo);
|
|
399
405
|
}
|
|
400
406
|
finally {
|
|
401
407
|
this.ciclos -= 1;
|
|
402
408
|
}
|
|
403
409
|
};
|
|
404
|
-
|
|
410
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoSustar = function () {
|
|
405
411
|
if (this.ciclos < 1) {
|
|
406
|
-
this.erro(this.
|
|
412
|
+
this.erro(this.simboloAnterior(), "'pausa' deve estar dentro de um loop.");
|
|
407
413
|
}
|
|
408
414
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após 'pausa'.");
|
|
409
|
-
return new declaracoes_1.
|
|
415
|
+
return new declaracoes_1.Sustar();
|
|
410
416
|
};
|
|
411
|
-
|
|
417
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoContinua = function () {
|
|
412
418
|
if (this.ciclos < 1) {
|
|
413
|
-
this.erro(this.
|
|
419
|
+
this.erro(this.simboloAnterior(), "'continua' precisa estar em um laço de repetição.");
|
|
414
420
|
}
|
|
415
421
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após 'continua'.");
|
|
416
422
|
return new declaracoes_1.Continua();
|
|
417
423
|
};
|
|
418
|
-
|
|
419
|
-
var palavraChave = this.
|
|
424
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoRetorna = function () {
|
|
425
|
+
var palavraChave = this.simboloAnterior();
|
|
420
426
|
var valor = null;
|
|
421
|
-
if (!this.
|
|
427
|
+
if (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PONTO_E_VIRGULA)) {
|
|
422
428
|
valor = this.expressao();
|
|
423
429
|
}
|
|
424
430
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após o retorno.");
|
|
425
431
|
return new declaracoes_1.Retorna(palavraChave, valor);
|
|
426
432
|
};
|
|
427
|
-
|
|
433
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoEscolha = function () {
|
|
428
434
|
try {
|
|
429
435
|
this.ciclos += 1;
|
|
430
436
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '{' após 'escolha'.");
|
|
431
437
|
var condicao = this.expressao();
|
|
432
438
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado '}' após a condição de 'escolha'.");
|
|
433
439
|
this.consumir(tiposDeSimbolos_1.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo do 'escolha'.");
|
|
434
|
-
var
|
|
435
|
-
var
|
|
440
|
+
var caminhos = [];
|
|
441
|
+
var caminhoPadrao = null;
|
|
436
442
|
while (!this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CHAVE_DIREITA) &&
|
|
437
443
|
!this.estaNoFinal()) {
|
|
438
444
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CASO)) {
|
|
439
445
|
var branchConditions = [this.expressao()];
|
|
440
446
|
this.consumir(tiposDeSimbolos_1.default.DOIS_PONTOS, "Esperado ':' após o 'caso'.");
|
|
441
|
-
while (this.
|
|
447
|
+
while (this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CASO)) {
|
|
442
448
|
this.consumir(tiposDeSimbolos_1.default.CASO, null);
|
|
443
449
|
branchConditions.push(this.expressao());
|
|
444
450
|
this.consumir(tiposDeSimbolos_1.default.DOIS_PONTOS, "Esperado ':' após declaração do 'caso'.");
|
|
445
451
|
}
|
|
446
|
-
var
|
|
452
|
+
var declaracoes = [];
|
|
447
453
|
do {
|
|
448
|
-
|
|
449
|
-
} while (!this.
|
|
450
|
-
!this.
|
|
451
|
-
!this.
|
|
452
|
-
|
|
454
|
+
declaracoes.push(this.resolverDeclaracao());
|
|
455
|
+
} while (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CASO) &&
|
|
456
|
+
!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PADRAO) &&
|
|
457
|
+
!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CHAVE_DIREITA));
|
|
458
|
+
caminhos.push({
|
|
453
459
|
conditions: branchConditions,
|
|
454
|
-
|
|
460
|
+
declaracoes: declaracoes,
|
|
455
461
|
});
|
|
456
462
|
}
|
|
457
463
|
else if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.PADRAO)) {
|
|
458
|
-
if (
|
|
459
|
-
|
|
464
|
+
if (caminhoPadrao !== null) {
|
|
465
|
+
var excecao = new erro_avaliador_sintatico_1.ErroAvaliadorSintatico(this.simboloAtual(), "Você só pode ter um 'padrao' em cada declaração de 'escolha'.");
|
|
466
|
+
this.erros.push(excecao);
|
|
467
|
+
throw excecao;
|
|
468
|
+
}
|
|
460
469
|
this.consumir(tiposDeSimbolos_1.default.DOIS_PONTOS, "Esperado ':' após declaração do 'padrao'.");
|
|
461
|
-
var
|
|
470
|
+
var declaracoes = [];
|
|
462
471
|
do {
|
|
463
|
-
|
|
464
|
-
} while (!this.
|
|
465
|
-
!this.
|
|
466
|
-
!this.
|
|
467
|
-
|
|
468
|
-
|
|
472
|
+
declaracoes.push(this.resolverDeclaracao());
|
|
473
|
+
} while (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CASO) &&
|
|
474
|
+
!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PADRAO) &&
|
|
475
|
+
!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CHAVE_DIREITA));
|
|
476
|
+
caminhoPadrao = {
|
|
477
|
+
declaracoes: declaracoes,
|
|
469
478
|
};
|
|
470
479
|
}
|
|
471
480
|
}
|
|
472
|
-
return new declaracoes_1.Escolha(condicao,
|
|
481
|
+
return new declaracoes_1.Escolha(condicao, caminhos, caminhoPadrao);
|
|
473
482
|
}
|
|
474
483
|
finally {
|
|
475
484
|
this.ciclos -= 1;
|
|
476
485
|
}
|
|
477
486
|
};
|
|
478
|
-
|
|
487
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoImportar = function () {
|
|
479
488
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' após declaração.");
|
|
480
489
|
var caminho = this.expressao();
|
|
481
|
-
var
|
|
482
|
-
return new declaracoes_1.Importar(caminho,
|
|
490
|
+
var simboloFechamento = this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após declaração.");
|
|
491
|
+
return new declaracoes_1.Importar(caminho, simboloFechamento);
|
|
483
492
|
};
|
|
484
|
-
|
|
493
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoTente = function () {
|
|
485
494
|
this.consumir(tiposDeSimbolos_1.default.CHAVE_ESQUERDA, "Esperado '{' após a declaração 'tente'.");
|
|
486
495
|
var tryBlock = this.blocoEscopo();
|
|
487
496
|
var catchBlock = null;
|
|
@@ -501,25 +510,25 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
501
510
|
}
|
|
502
511
|
return new declaracoes_1.Tente(tryBlock, catchBlock, elseBlock, finallyBlock);
|
|
503
512
|
};
|
|
504
|
-
|
|
513
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoFazer = function () {
|
|
505
514
|
try {
|
|
506
515
|
this.ciclos += 1;
|
|
507
|
-
var
|
|
516
|
+
var caminhoFazer = this.resolverDeclaracao();
|
|
508
517
|
this.consumir(tiposDeSimbolos_1.default.ENQUANTO, "Esperado declaração do 'enquanto' após o escopo do 'fazer'.");
|
|
509
518
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' após declaração 'enquanto'.");
|
|
510
|
-
var
|
|
519
|
+
var condicaoEnquanto = this.expressao();
|
|
511
520
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após declaração do 'enquanto'.");
|
|
512
|
-
return new declaracoes_1.Fazer(
|
|
521
|
+
return new declaracoes_1.Fazer(caminhoFazer, condicaoEnquanto);
|
|
513
522
|
}
|
|
514
523
|
finally {
|
|
515
524
|
this.ciclos -= 1;
|
|
516
525
|
}
|
|
517
526
|
};
|
|
518
|
-
|
|
527
|
+
AvaliadorSintaticoEguaClassico.prototype.resolverDeclaracao = function () {
|
|
519
528
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.FAZER))
|
|
520
529
|
return this.declaracaoFazer();
|
|
521
530
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.TENTE))
|
|
522
|
-
return this.
|
|
531
|
+
return this.declaracaoTente();
|
|
523
532
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.ESCOLHA))
|
|
524
533
|
return this.declaracaoEscolha();
|
|
525
534
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.RETORNA))
|
|
@@ -527,7 +536,7 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
527
536
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CONTINUA))
|
|
528
537
|
return this.declaracaoContinua();
|
|
529
538
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.PAUSA))
|
|
530
|
-
return this.
|
|
539
|
+
return this.declaracaoSustar();
|
|
531
540
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.PARA))
|
|
532
541
|
return this.declaracaoPara();
|
|
533
542
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.ENQUANTO))
|
|
@@ -535,13 +544,13 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
535
544
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.SE))
|
|
536
545
|
return this.declaracaoSe();
|
|
537
546
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.ESCREVA))
|
|
538
|
-
return this.
|
|
547
|
+
return this.declaracaoEscreva();
|
|
539
548
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.CHAVE_ESQUERDA))
|
|
540
549
|
return new declaracoes_1.Bloco(this.blocoEscopo());
|
|
541
550
|
return this.declaracaoExpressao();
|
|
542
551
|
};
|
|
543
|
-
|
|
544
|
-
var nome = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR,
|
|
552
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoDeVariavel = function () {
|
|
553
|
+
var nome = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, 'Esperado nome de variável.');
|
|
545
554
|
var inicializador = null;
|
|
546
555
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.IGUAL)) {
|
|
547
556
|
inicializador = this.expressao();
|
|
@@ -549,62 +558,62 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
549
558
|
this.consumir(tiposDeSimbolos_1.default.PONTO_E_VIRGULA, "Esperado ';' após a declaração da variável.");
|
|
550
559
|
return new declaracoes_1.Var(nome, inicializador);
|
|
551
560
|
};
|
|
552
|
-
|
|
561
|
+
AvaliadorSintaticoEguaClassico.prototype.funcao = function (kind) {
|
|
553
562
|
var nome = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, "Esperado nome ".concat(kind, "."));
|
|
554
563
|
return new declaracoes_1.Funcao(nome, this.corpoDaFuncao(kind));
|
|
555
564
|
};
|
|
556
|
-
|
|
565
|
+
AvaliadorSintaticoEguaClassico.prototype.corpoDaFuncao = function (kind) {
|
|
557
566
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_ESQUERDO, "Esperado '(' ap\u00F3s o nome ".concat(kind, "."));
|
|
558
567
|
var parametros = [];
|
|
559
|
-
if (!this.
|
|
568
|
+
if (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.PARENTESE_DIREITO)) {
|
|
560
569
|
do {
|
|
561
570
|
if (parametros.length >= 255) {
|
|
562
|
-
this.erro(this.simboloAtual(),
|
|
571
|
+
this.erro(this.simboloAtual(), 'Não pode haver mais de 255 parâmetros');
|
|
563
572
|
}
|
|
564
573
|
var paramObj = {};
|
|
565
574
|
if (this.simboloAtual().tipo === tiposDeSimbolos_1.default.MULTIPLICACAO) {
|
|
566
575
|
this.consumir(tiposDeSimbolos_1.default.MULTIPLICACAO, null);
|
|
567
|
-
paramObj[
|
|
576
|
+
paramObj['tipo'] = 'wildcard';
|
|
568
577
|
}
|
|
569
578
|
else {
|
|
570
|
-
paramObj[
|
|
579
|
+
paramObj['tipo'] = 'standard';
|
|
571
580
|
}
|
|
572
|
-
paramObj[
|
|
581
|
+
paramObj['nome'] = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, 'Esperado nome do parâmetro.');
|
|
573
582
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.IGUAL)) {
|
|
574
|
-
paramObj[
|
|
583
|
+
paramObj['default'] = this.primario();
|
|
575
584
|
}
|
|
576
585
|
parametros.push(paramObj);
|
|
577
|
-
if (paramObj[
|
|
586
|
+
if (paramObj['tipo'] === 'wildcard')
|
|
578
587
|
break;
|
|
579
588
|
} while (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.VIRGULA));
|
|
580
589
|
}
|
|
581
590
|
this.consumir(tiposDeSimbolos_1.default.PARENTESE_DIREITO, "Esperado ')' após parâmetros.");
|
|
582
591
|
this.consumir(tiposDeSimbolos_1.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo do ".concat(kind, "."));
|
|
583
592
|
var corpo = this.blocoEscopo();
|
|
584
|
-
return new construtos_1.Funcao(parametros, corpo);
|
|
593
|
+
return new construtos_1.Funcao(0, parametros, corpo);
|
|
585
594
|
};
|
|
586
|
-
|
|
587
|
-
var nome = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR,
|
|
595
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracaoDeClasse = function () {
|
|
596
|
+
var nome = this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, 'Esperado nome da classe.');
|
|
588
597
|
var superClasse = null;
|
|
589
598
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.HERDA)) {
|
|
590
|
-
this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR,
|
|
591
|
-
superClasse = new construtos_1.Variavel(this.
|
|
599
|
+
this.consumir(tiposDeSimbolos_1.default.IDENTIFICADOR, 'Esperado nome da SuperClasse.');
|
|
600
|
+
superClasse = new construtos_1.Variavel(this.simboloAnterior());
|
|
592
601
|
}
|
|
593
602
|
this.consumir(tiposDeSimbolos_1.default.CHAVE_ESQUERDA, "Esperado '{' antes do escopo da classe.");
|
|
594
603
|
var metodos = [];
|
|
595
|
-
while (!this.
|
|
604
|
+
while (!this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.CHAVE_DIREITA) &&
|
|
596
605
|
!this.estaNoFinal()) {
|
|
597
|
-
metodos.push(this.funcao(
|
|
606
|
+
metodos.push(this.funcao('método'));
|
|
598
607
|
}
|
|
599
608
|
this.consumir(tiposDeSimbolos_1.default.CHAVE_DIREITA, "Esperado '}' após o escopo da classe.");
|
|
600
609
|
return new declaracoes_1.Classe(nome, superClasse, metodos);
|
|
601
610
|
};
|
|
602
|
-
|
|
611
|
+
AvaliadorSintaticoEguaClassico.prototype.declaracao = function () {
|
|
603
612
|
try {
|
|
604
|
-
if (this.
|
|
605
|
-
this.
|
|
613
|
+
if (this.verificarTipoSimboloAtual(tiposDeSimbolos_1.default.FUNÇÃO) &&
|
|
614
|
+
this.verificarTipoProximoSimbolo(tiposDeSimbolos_1.default.IDENTIFICADOR)) {
|
|
606
615
|
this.consumir(tiposDeSimbolos_1.default.FUNÇÃO, null);
|
|
607
|
-
return this.funcao(
|
|
616
|
+
return this.funcao('função');
|
|
608
617
|
}
|
|
609
618
|
if (this.verificarSeSimboloAtualEIgualA(tiposDeSimbolos_1.default.VARIAVEL))
|
|
610
619
|
return this.declaracaoDeVariavel();
|
|
@@ -617,7 +626,8 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
617
626
|
return null;
|
|
618
627
|
}
|
|
619
628
|
};
|
|
620
|
-
|
|
629
|
+
AvaliadorSintaticoEguaClassico.prototype.analisar = function (simbolos) {
|
|
630
|
+
this.erros = [];
|
|
621
631
|
this.atual = 0;
|
|
622
632
|
this.ciclos = 0;
|
|
623
633
|
if (simbolos) {
|
|
@@ -627,9 +637,12 @@ var ParserEguaClassico = /** @class */ (function () {
|
|
|
627
637
|
while (!this.estaNoFinal()) {
|
|
628
638
|
declaracoes.push(this.declaracao());
|
|
629
639
|
}
|
|
630
|
-
return
|
|
640
|
+
return {
|
|
641
|
+
declaracoes: declaracoes,
|
|
642
|
+
erros: this.erros
|
|
643
|
+
};
|
|
631
644
|
};
|
|
632
|
-
return
|
|
645
|
+
return AvaliadorSintaticoEguaClassico;
|
|
633
646
|
}());
|
|
634
|
-
exports.
|
|
647
|
+
exports.AvaliadorSintaticoEguaClassico = AvaliadorSintaticoEguaClassico;
|
|
635
648
|
//# sourceMappingURL=egua-classico.js.map
|