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