@designliquido/delegua 0.14.7 → 0.15.1
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/README.md +85 -85
- package/bin/delegua +2 -2
- package/bin/package.json +88 -88
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.d.ts +67 -67
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js +215 -215
- package/fontes/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -1
- package/fontes/avaliador-sintatico/avaliador-sintatico.d.ts +92 -92
- package/fontes/avaliador-sintatico/avaliador-sintatico.js +857 -727
- package/fontes/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-birl.d.ts +27 -22
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-birl.js +294 -145
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-birl.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts +69 -69
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js +640 -640
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.d.ts +84 -84
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js +714 -714
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-eguap.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.d.ts +20 -20
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.js +149 -149
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-studio.d.ts +49 -33
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-studio.js +419 -218
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-studio.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.d.ts +73 -73
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js +534 -534
- package/fontes/avaliador-sintatico/dialetos/avaliador-sintatico-visualg.js.map +1 -1
- package/fontes/avaliador-sintatico/dialetos/index.d.ts +5 -5
- package/fontes/avaliador-sintatico/dialetos/index.js +21 -21
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.d.ts +5 -5
- package/fontes/avaliador-sintatico/erro-avaliador-sintatico.js +11 -11
- package/fontes/avaliador-sintatico/index.d.ts +2 -2
- package/fontes/avaliador-sintatico/index.js +18 -18
- package/fontes/avaliador-sintatico/retornos/index.d.ts +3 -3
- package/fontes/avaliador-sintatico/retornos/index.js +19 -19
- package/fontes/avaliador-sintatico/retornos/retorno-declaracao.d.ts +3 -3
- package/fontes/avaliador-sintatico/retornos/retorno-declaracao.js +2 -2
- package/fontes/avaliador-sintatico/retornos/retorno-primario.d.ts +3 -3
- package/fontes/avaliador-sintatico/retornos/retorno-primario.js +2 -2
- package/fontes/avaliador-sintatico/retornos/retorno-resolver-declaracao.d.ts +2 -2
- package/fontes/avaliador-sintatico/retornos/retorno-resolver-declaracao.js +2 -2
- package/fontes/bibliotecas/biblioteca-global.d.ts +3 -3
- package/fontes/bibliotecas/biblioteca-global.js +315 -315
- package/fontes/bibliotecas/dialetos/egua-classico/biblioteca-global.d.ts +1 -1
- package/fontes/bibliotecas/dialetos/egua-classico/biblioteca-global.js +230 -230
- package/fontes/bibliotecas/dialetos/egua-classico/index.d.ts +2 -2
- package/fontes/bibliotecas/dialetos/egua-classico/index.js +32 -32
- package/fontes/bibliotecas/dialetos/egua-classico/matematica.d.ts +1 -1
- package/fontes/bibliotecas/dialetos/egua-classico/matematica.js +478 -478
- package/fontes/bibliotecas/dialetos/egua-classico/tempo.d.ts +1 -1
- package/fontes/bibliotecas/dialetos/egua-classico/tempo.js +39 -39
- package/fontes/bibliotecas/dialetos/egua-classico/textos.d.ts +8 -8
- package/fontes/bibliotecas/dialetos/egua-classico/textos.js +201 -201
- package/fontes/bibliotecas/primitivas-texto.d.ts +11 -11
- package/fontes/bibliotecas/primitivas-texto.js +12 -12
- package/fontes/bibliotecas/primitivas-vetor.d.ts +15 -15
- package/fontes/bibliotecas/primitivas-vetor.js +33 -33
- package/fontes/construtos/acesso-indice-variavel.d.ts +15 -15
- package/fontes/construtos/acesso-indice-variavel.js +20 -20
- package/fontes/construtos/acesso-metodo.d.ts +14 -14
- package/fontes/construtos/acesso-metodo.js +19 -19
- package/fontes/construtos/agrupamento.d.ts +14 -14
- package/fontes/construtos/agrupamento.js +19 -19
- package/fontes/construtos/atribuicao-sobrescrita.d.ts +11 -11
- package/fontes/construtos/atribuicao-sobrescrita.js +16 -16
- package/fontes/construtos/atribuir.d.ts +10 -10
- package/fontes/construtos/atribuir.js +15 -15
- package/fontes/construtos/binario.d.ts +22 -22
- package/fontes/construtos/binario.js +27 -27
- package/fontes/construtos/chamada.d.ts +13 -13
- package/fontes/construtos/chamada.js +36 -36
- package/fontes/construtos/construto.d.ts +7 -7
- package/fontes/construtos/construto.js +2 -2
- package/fontes/construtos/definir-valor.d.ts +11 -11
- package/fontes/construtos/definir-valor.js +16 -16
- package/fontes/construtos/dicionario.d.ts +10 -10
- package/fontes/construtos/dicionario.js +15 -15
- package/fontes/construtos/formatacao-escrita.d.ts +16 -16
- package/fontes/construtos/formatacao-escrita.js +21 -21
- package/fontes/construtos/funcao.d.ts +10 -10
- package/fontes/construtos/funcao.js +15 -15
- package/fontes/construtos/index.d.ts +19 -19
- package/fontes/construtos/index.js +35 -35
- package/fontes/construtos/isto.d.ts +9 -9
- package/fontes/construtos/isto.js +14 -14
- package/fontes/construtos/literal.d.ts +10 -10
- package/fontes/construtos/literal.js +14 -14
- package/fontes/construtos/logico.d.ts +11 -11
- package/fontes/construtos/logico.js +16 -16
- package/fontes/construtos/super.d.ts +10 -10
- package/fontes/construtos/super.js +15 -15
- package/fontes/construtos/unario.d.ts +11 -10
- package/fontes/construtos/unario.js +16 -15
- package/fontes/construtos/unario.js.map +1 -1
- package/fontes/construtos/variavel.d.ts +9 -9
- package/fontes/construtos/variavel.js +14 -14
- package/fontes/construtos/vetor.d.ts +9 -9
- package/fontes/construtos/vetor.js +14 -14
- package/fontes/declaracoes/bloco.d.ts +7 -7
- package/fontes/declaracoes/bloco.js +14 -14
- package/fontes/declaracoes/classe.d.ts +9 -9
- package/fontes/declaracoes/classe.js +16 -16
- package/fontes/declaracoes/continua.d.ts +6 -6
- package/fontes/declaracoes/continua.js +13 -13
- package/fontes/declaracoes/declaracao.d.ts +8 -8
- package/fontes/declaracoes/declaracao.js +17 -17
- package/fontes/declaracoes/enquanto.d.ts +9 -9
- package/fontes/declaracoes/enquanto.js +15 -15
- package/fontes/declaracoes/escolha.d.ts +14 -14
- package/fontes/declaracoes/escolha.js +19 -19
- package/fontes/declaracoes/escreva-mesma-linha.d.ts +8 -8
- package/fontes/declaracoes/escreva-mesma-linha.js +14 -14
- package/fontes/declaracoes/escreva.d.ts +8 -8
- package/fontes/declaracoes/escreva.js +14 -14
- package/fontes/declaracoes/expressao.d.ts +8 -8
- package/fontes/declaracoes/expressao.js +14 -14
- package/fontes/declaracoes/fazer.d.ts +8 -8
- package/fontes/declaracoes/fazer.js +15 -15
- package/fontes/declaracoes/funcao.d.ts +9 -9
- package/fontes/declaracoes/funcao.js +15 -15
- package/fontes/declaracoes/importar.d.ts +9 -9
- package/fontes/declaracoes/importar.js +15 -15
- package/fontes/declaracoes/index.d.ts +19 -19
- package/fontes/declaracoes/index.js +35 -35
- package/fontes/declaracoes/leia.d.ts +12 -12
- package/fontes/declaracoes/leia.js +18 -18
- package/fontes/declaracoes/para.d.ts +10 -10
- package/fontes/declaracoes/para.js +17 -17
- package/fontes/declaracoes/retorna.d.ts +8 -8
- package/fontes/declaracoes/retorna.js +15 -15
- package/fontes/declaracoes/se.d.ts +11 -11
- package/fontes/declaracoes/se.js +17 -17
- package/fontes/declaracoes/sustar.d.ts +6 -6
- package/fontes/declaracoes/sustar.js +13 -13
- package/fontes/declaracoes/tente.d.ts +14 -14
- package/fontes/declaracoes/tente.js +20 -20
- package/fontes/declaracoes/var.d.ts +9 -9
- package/fontes/declaracoes/var.js +15 -15
- package/fontes/depuracao/cyrb53.d.ts +9 -9
- package/fontes/depuracao/cyrb53.js +22 -22
- package/fontes/depuracao/index.d.ts +2 -2
- package/fontes/depuracao/index.js +23 -23
- package/fontes/depuracao/ponto-parada.d.ts +4 -4
- package/fontes/depuracao/ponto-parada.js +2 -2
- package/fontes/espaco-variaveis.d.ts +19 -19
- package/fontes/espaco-variaveis.js +19 -19
- package/fontes/estruturas/chamavel.d.ts +5 -5
- package/fontes/estruturas/chamavel.js +12 -12
- package/fontes/estruturas/classe-padrao.d.ts +17 -17
- package/fontes/estruturas/classe-padrao.js +28 -28
- package/fontes/estruturas/delegua-classe.d.ts +16 -16
- package/fontes/estruturas/delegua-classe.js +38 -38
- package/fontes/estruturas/delegua-funcao.d.ts +18 -18
- package/fontes/estruturas/delegua-funcao.js +60 -60
- package/fontes/estruturas/funcao-padrao.d.ts +12 -12
- package/fontes/estruturas/funcao-padrao.js +22 -22
- package/fontes/estruturas/index.d.ts +9 -9
- package/fontes/estruturas/index.js +25 -25
- package/fontes/estruturas/metodo-primitiva.d.ts +17 -17
- package/fontes/estruturas/metodo-primitiva.js +26 -26
- package/fontes/estruturas/modulo.d.ts +9 -9
- package/fontes/estruturas/modulo.js +13 -13
- package/fontes/estruturas/objeto-delegua-classe.d.ts +10 -10
- package/fontes/estruturas/objeto-delegua-classe.js +26 -26
- package/fontes/estruturas/objeto-padrao.d.ts +9 -9
- package/fontes/estruturas/objeto-padrao.js +21 -21
- package/fontes/excecoes/erro-em-tempo-de-execucao.d.ts +7 -7
- package/fontes/excecoes/erro-em-tempo-de-execucao.js +13 -13
- package/fontes/excecoes/index.d.ts +1 -1
- package/fontes/excecoes/index.js +17 -17
- package/fontes/formatadores/delegua.d.ts +18 -18
- package/fontes/formatadores/delegua.js +82 -82
- package/fontes/formatadores/index.d.ts +1 -1
- package/fontes/formatadores/index.js +17 -17
- package/fontes/interfaces/avaliador-sintatico-interface.d.ts +57 -57
- package/fontes/interfaces/avaliador-sintatico-interface.js +2 -2
- package/fontes/interfaces/construtos/index.d.ts +4 -4
- package/fontes/interfaces/construtos/index.js +2 -2
- package/fontes/interfaces/escopo-execucao.d.ts +11 -11
- package/fontes/interfaces/escopo-execucao.js +2 -2
- package/fontes/interfaces/index.d.ts +11 -11
- package/fontes/interfaces/index.js +27 -27
- package/fontes/interfaces/interpretador-com-depuracao-interface.d.ts +17 -17
- package/fontes/interfaces/interpretador-com-depuracao-interface.js +2 -2
- package/fontes/interfaces/interpretador-interface.d.ts +55 -55
- package/fontes/interfaces/interpretador-interface.js +2 -2
- package/fontes/interfaces/lexador-interface.d.ts +23 -23
- package/fontes/interfaces/lexador-interface.js +2 -2
- package/fontes/interfaces/parametro-interface.d.ts +6 -6
- package/fontes/interfaces/parametro-interface.js +2 -2
- package/fontes/interfaces/pilha-escopos-execucao-interface.d.ts +25 -25
- package/fontes/interfaces/pilha-escopos-execucao-interface.js +2 -2
- package/fontes/interfaces/pilha-interface.d.ts +7 -7
- package/fontes/interfaces/pilha-interface.js +2 -2
- package/fontes/interfaces/resolvedor-interface.d.ts +41 -41
- package/fontes/interfaces/resolvedor-interface.js +2 -2
- package/fontes/interfaces/retornos/index.d.ts +4 -4
- package/fontes/interfaces/retornos/index.js +20 -20
- package/fontes/interfaces/retornos/retorno-avaliador-sintatico.d.ts +6 -6
- package/fontes/interfaces/retornos/retorno-avaliador-sintatico.js +2 -2
- package/fontes/interfaces/retornos/retorno-execucao-interface.d.ts +5 -5
- package/fontes/interfaces/retornos/retorno-execucao-interface.js +2 -2
- package/fontes/interfaces/retornos/retorno-interpretador.d.ts +5 -5
- package/fontes/interfaces/retornos/retorno-interpretador.js +2 -2
- package/fontes/interfaces/retornos/retorno-lexador.d.ts +10 -10
- package/fontes/interfaces/retornos/retorno-lexador.js +2 -2
- package/fontes/interfaces/simbolo-interface.d.ts +7 -7
- package/fontes/interfaces/simbolo-interface.js +2 -2
- package/fontes/interfaces/tradutor-interface.d.ts +4 -4
- package/fontes/interfaces/tradutor-interface.js +2 -2
- package/fontes/interfaces/variavel-interface.d.ts +4 -4
- package/fontes/interfaces/variavel-interface.js +2 -2
- package/fontes/interpretador/dialetos/egua-classico/index.d.ts +1 -1
- package/fontes/interpretador/dialetos/egua-classico/index.js +17 -17
- package/fontes/interpretador/dialetos/egua-classico/interpretador-egua-classico.d.ts +99 -99
- package/fontes/interpretador/dialetos/egua-classico/interpretador-egua-classico.js +743 -743
- package/fontes/interpretador/dialetos/egua-classico/interpretador-egua-classico.js.map +1 -1
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/erro-resolvedor.d.ts +5 -5
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/erro-resolvedor.js +11 -11
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/index.d.ts +3 -3
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/index.js +19 -19
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/pilha-escopos.d.ts +9 -9
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/pilha-escopos.js +25 -25
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/resolvedor.d.ts +87 -87
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/resolvedor.js +387 -387
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/retorno-resolvedor.d.ts +6 -6
- package/fontes/interpretador/dialetos/egua-classico/resolvedor/retorno-resolvedor.js +2 -2
- package/fontes/interpretador/dialetos/index.d.ts +4 -4
- package/fontes/interpretador/dialetos/index.js +20 -20
- package/fontes/interpretador/dialetos/portugol-studio/interpretador-portugol-studio.d.ts +12 -12
- package/fontes/interpretador/dialetos/portugol-studio/interpretador-portugol-studio.js +26 -26
- package/fontes/interpretador/dialetos/visualg/interpretador-visualg-com-depuracao.d.ts +40 -40
- package/fontes/interpretador/dialetos/visualg/interpretador-visualg-com-depuracao.js +96 -96
- package/fontes/interpretador/dialetos/visualg/interpretador-visualg-com-depuracao.js.map +1 -1
- package/fontes/interpretador/dialetos/visualg/interpretador-visualg.d.ts +46 -46
- package/fontes/interpretador/dialetos/visualg/interpretador-visualg.js +102 -102
- package/fontes/interpretador/dialetos/visualg/interpretador-visualg.js.map +1 -1
- package/fontes/interpretador/erro-interpretador.d.ts +8 -8
- package/fontes/interpretador/erro-interpretador.js +2 -2
- package/fontes/interpretador/index.d.ts +4 -4
- package/fontes/interpretador/index.js +20 -20
- package/fontes/interpretador/inferenciador.d.ts +1 -1
- package/fontes/interpretador/inferenciador.js +31 -31
- package/fontes/interpretador/interpretador-base.d.ts +188 -187
- package/fontes/interpretador/interpretador-base.js +1000 -972
- package/fontes/interpretador/interpretador-base.js.map +1 -1
- package/fontes/interpretador/interpretador-com-depuracao.d.ts +199 -199
- package/fontes/interpretador/interpretador-com-depuracao.js +516 -516
- package/fontes/interpretador/pilha-escopos-execucao.d.ts +38 -38
- package/fontes/interpretador/pilha-escopos-execucao.js +158 -158
- package/fontes/lexador/dialetos/index.d.ts +6 -6
- package/fontes/lexador/dialetos/index.js +22 -22
- package/fontes/lexador/dialetos/lexador-birl.d.ts +12 -12
- package/fontes/lexador/dialetos/lexador-birl.js +211 -165
- package/fontes/lexador/dialetos/lexador-birl.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-egua-classico.d.ts +36 -36
- package/fontes/lexador/dialetos/lexador-egua-classico.js +286 -286
- package/fontes/lexador/dialetos/lexador-eguap.d.ts +51 -51
- package/fontes/lexador/dialetos/lexador-eguap.js +398 -398
- package/fontes/lexador/dialetos/lexador-guarani.d.ts +9 -9
- package/fontes/lexador/dialetos/lexador-guarani.js +113 -113
- package/fontes/lexador/dialetos/lexador-portugol-ipt.d.ts +33 -33
- package/fontes/lexador/dialetos/lexador-portugol-ipt.js +195 -195
- package/fontes/lexador/dialetos/lexador-portugol-studio.d.ts +21 -15
- package/fontes/lexador/dialetos/lexador-portugol-studio.js +280 -244
- package/fontes/lexador/dialetos/lexador-portugol-studio.js.map +1 -1
- package/fontes/lexador/dialetos/lexador-visualg.d.ts +18 -18
- package/fontes/lexador/dialetos/lexador-visualg.js +218 -218
- package/fontes/lexador/dialetos/palavras-reservadas/birl.d.ts +46 -41
- package/fontes/lexador/dialetos/palavras-reservadas/birl.js +63 -58
- package/fontes/lexador/dialetos/palavras-reservadas/birl.js.map +1 -1
- package/fontes/lexador/dialetos/palavras-reservadas/egua-classico.d.ts +36 -36
- package/fontes/lexador/dialetos/palavras-reservadas/egua-classico.js +41 -41
- package/fontes/lexador/dialetos/palavras-reservadas/guarani.d.ts +4 -4
- package/fontes/lexador/dialetos/palavras-reservadas/guarani.js +9 -9
- package/fontes/lexador/dialetos/palavras-reservadas/index.d.ts +3 -3
- package/fontes/lexador/dialetos/palavras-reservadas/index.js +19 -19
- package/fontes/lexador/dialetos/palavras-reservadas/portugol-ipt.d.ts +6 -6
- package/fontes/lexador/dialetos/palavras-reservadas/portugol-ipt.js +11 -11
- package/fontes/lexador/dialetos/palavras-reservadas/portugol-studio.d.ts +23 -11
- package/fontes/lexador/dialetos/palavras-reservadas/portugol-studio.js +28 -16
- package/fontes/lexador/dialetos/palavras-reservadas/portugol-studio.js.map +1 -1
- package/fontes/lexador/dialetos/palavras-reservadas/rantiaquin.d.ts +2 -2
- package/fontes/lexador/dialetos/palavras-reservadas/rantiaquin.js +3 -3
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.d.ts +60 -60
- package/fontes/lexador/dialetos/palavras-reservadas/visualg.js +65 -65
- package/fontes/lexador/dialetos/pragma.d.ts +8 -8
- package/fontes/lexador/dialetos/pragma.js +2 -2
- package/fontes/lexador/erro-lexador.d.ts +5 -5
- package/fontes/lexador/erro-lexador.js +2 -2
- package/fontes/lexador/index.d.ts +2 -2
- package/fontes/lexador/index.js +18 -18
- package/fontes/lexador/lexador-base-linha-unica.d.ts +28 -28
- package/fontes/lexador/lexador-base-linha-unica.js +82 -82
- package/fontes/lexador/lexador-base.d.ts +41 -41
- package/fontes/lexador/lexador-base.js +112 -112
- package/fontes/lexador/lexador.d.ts +43 -43
- package/fontes/lexador/lexador.js +412 -408
- package/fontes/lexador/lexador.js.map +1 -1
- package/fontes/lexador/palavras-reservadas.d.ts +36 -36
- package/fontes/lexador/palavras-reservadas.js +41 -41
- package/fontes/lexador/simbolo.d.ts +10 -10
- package/fontes/lexador/simbolo.js +16 -16
- package/fontes/quebras/index.d.ts +10 -10
- package/fontes/quebras/index.js +19 -19
- package/fontes/tipos-de-simbolos/birl.d.ts +71 -57
- package/fontes/tipos-de-simbolos/birl.js +78 -61
- package/fontes/tipos-de-simbolos/birl.js.map +1 -1
- package/fontes/tipos-de-simbolos/comum.d.ts +22 -22
- package/fontes/tipos-de-simbolos/comum.js +23 -23
- package/fontes/tipos-de-simbolos/delegua.d.ts +80 -80
- package/fontes/tipos-de-simbolos/delegua.js +81 -81
- package/fontes/tipos-de-simbolos/egua-classico.d.ts +77 -77
- package/fontes/tipos-de-simbolos/egua-classico.js +78 -78
- package/fontes/tipos-de-simbolos/eguap.d.ts +73 -73
- package/fontes/tipos-de-simbolos/eguap.js +74 -74
- package/fontes/tipos-de-simbolos/guarani.d.ts +14 -14
- package/fontes/tipos-de-simbolos/guarani.js +15 -15
- package/fontes/tipos-de-simbolos/portugol-ipt.d.ts +28 -28
- package/fontes/tipos-de-simbolos/portugol-ipt.js +29 -29
- package/fontes/tipos-de-simbolos/portugol-studio.d.ts +53 -37
- package/fontes/tipos-de-simbolos/portugol-studio.js +54 -38
- package/fontes/tipos-de-simbolos/portugol-studio.js.map +1 -1
- package/fontes/tipos-de-simbolos/rantiaquin.d.ts +2 -2
- package/fontes/tipos-de-simbolos/rantiaquin.js +3 -3
- package/fontes/tipos-de-simbolos/visualg.d.ts +68 -68
- package/fontes/tipos-de-simbolos/visualg.js +69 -69
- package/fontes/tradutores/dicionarios/dicionario-delegua-javascript.d.ts +2 -2
- package/fontes/tradutores/dicionarios/dicionario-delegua-javascript.js +10 -10
- package/fontes/tradutores/dicionarios/index.d.ts +1 -1
- package/fontes/tradutores/dicionarios/index.js +17 -17
- package/fontes/tradutores/index.d.ts +2 -2
- package/fontes/tradutores/index.js +18 -18
- package/fontes/tradutores/python/python3-lexer.d.ts +152 -152
- package/fontes/tradutores/python/python3-lexer.js +1226 -1226
- package/fontes/tradutores/python/python3-listener.d.ts +953 -953
- package/fontes/tradutores/python/python3-listener.js +2 -2
- package/fontes/tradutores/python/python3-parser.d.ts +1330 -1330
- package/fontes/tradutores/python/python3-parser.js +11156 -11156
- package/fontes/tradutores/python/python3-visitor.d.ts +612 -612
- package/fontes/tradutores/python/python3-visitor.js +2 -2
- package/fontes/tradutores/tradutor-javascript.d.ts +83 -83
- package/fontes/tradutores/tradutor-javascript.js +470 -470
- package/fontes/tradutores/tradutor-javascript.js.map +1 -1
- package/fontes/tradutores/tradutor-python.d.ts +1 -1
- package/fontes/tradutores/tradutor-python.js +34 -34
- package/fontes/tradutores/tradutor-reverso-javascript.d.ts +47 -47
- package/fontes/tradutores/tradutor-reverso-javascript.js +342 -342
- package/index.d.ts +5 -5
- package/index.js +23 -23
- package/package.json +88 -88
|
@@ -1,409 +1,413 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Lexador = void 0;
|
|
7
|
-
const browser_process_hrtime_1 = __importDefault(require("browser-process-hrtime"));
|
|
8
|
-
const simbolo_1 = require("./simbolo");
|
|
9
|
-
const palavras_reservadas_1 = __importDefault(require("./palavras-reservadas"));
|
|
10
|
-
const delegua_1 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
11
|
-
/**
|
|
12
|
-
* O Lexador é responsável por transformar o código em uma coleção de tokens de linguagem.
|
|
13
|
-
* Cada token de linguagem é representado por um tipo, um lexema e informações da linha de código em que foi expresso.
|
|
14
|
-
* Também é responsável por mapear as palavras reservadas da linguagem, que não podem ser usadas por outras
|
|
15
|
-
* estruturas, tais como nomes de variáveis, funções, literais, classes e assim por diante.
|
|
16
|
-
*/
|
|
17
|
-
class Lexador {
|
|
18
|
-
constructor(performance = false) {
|
|
19
|
-
this.performance = performance;
|
|
20
|
-
this.simbolos = [];
|
|
21
|
-
this.erros = [];
|
|
22
|
-
this.hashArquivo = -1;
|
|
23
|
-
this.inicioSimbolo = 0;
|
|
24
|
-
this.atual = 0;
|
|
25
|
-
this.linha = 0;
|
|
26
|
-
}
|
|
27
|
-
eDigito(caractere) {
|
|
28
|
-
return caractere >= '0' && caractere <= '9';
|
|
29
|
-
}
|
|
30
|
-
eAlfabeto(caractere) {
|
|
31
|
-
const acentuacoes = [
|
|
32
|
-
'á',
|
|
33
|
-
'Á',
|
|
34
|
-
'ã',
|
|
35
|
-
'Ã',
|
|
36
|
-
'â',
|
|
37
|
-
'Â',
|
|
38
|
-
'à',
|
|
39
|
-
'À',
|
|
40
|
-
'é',
|
|
41
|
-
'É',
|
|
42
|
-
'ê',
|
|
43
|
-
'Ê',
|
|
44
|
-
'í',
|
|
45
|
-
'Í',
|
|
46
|
-
'ó',
|
|
47
|
-
'Ó',
|
|
48
|
-
'õ',
|
|
49
|
-
'Õ',
|
|
50
|
-
'ô',
|
|
51
|
-
'Ô',
|
|
52
|
-
'ú',
|
|
53
|
-
'Ú',
|
|
54
|
-
'ç',
|
|
55
|
-
'Ç',
|
|
56
|
-
'_',
|
|
57
|
-
];
|
|
58
|
-
return ((caractere >= 'a' && caractere <= 'z') ||
|
|
59
|
-
(caractere >= 'A' && caractere <= 'Z') ||
|
|
60
|
-
acentuacoes.includes(caractere));
|
|
61
|
-
}
|
|
62
|
-
eAlfabetoOuDigito(caractere) {
|
|
63
|
-
return this.eDigito(caractere) || this.eAlfabeto(caractere);
|
|
64
|
-
}
|
|
65
|
-
eFinalDaLinha() {
|
|
66
|
-
if (this.codigo.length === this.linha) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
return this.atual >= this.codigo[this.linha].length;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Indica se o código está na última linha.
|
|
73
|
-
* @returns Verdadeiro se contador de linhas está na última linha.
|
|
74
|
-
* Falso caso contrário.
|
|
75
|
-
*/
|
|
76
|
-
eUltimaLinha() {
|
|
77
|
-
return this.linha >= this.codigo.length - 1;
|
|
78
|
-
}
|
|
79
|
-
eFinalDoCodigo() {
|
|
80
|
-
return this.eUltimaLinha() && this.codigo[this.codigo.length - 1].length <= this.atual;
|
|
81
|
-
}
|
|
82
|
-
avancar() {
|
|
83
|
-
this.atual += 1;
|
|
84
|
-
if (this.eFinalDaLinha() && !this.eUltimaLinha()) {
|
|
85
|
-
this.linha++;
|
|
86
|
-
this.atual = 0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
adicionarSimbolo(tipo, literal = null) {
|
|
90
|
-
const texto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
91
|
-
this.simbolos.push(new simbolo_1.Simbolo(tipo, literal || texto, literal, this.linha + 1, this.hashArquivo));
|
|
92
|
-
}
|
|
93
|
-
simboloAtual() {
|
|
94
|
-
if (this.eFinalDaLinha())
|
|
95
|
-
return '\0';
|
|
96
|
-
return this.codigo[this.linha].charAt(this.atual);
|
|
97
|
-
}
|
|
98
|
-
avancarParaProximaLinha() {
|
|
99
|
-
this.linha++;
|
|
100
|
-
this.atual = 0;
|
|
101
|
-
}
|
|
102
|
-
proximoSimbolo() {
|
|
103
|
-
return this.codigo[this.linha].charAt(this.atual + 1);
|
|
104
|
-
}
|
|
105
|
-
simboloAnterior() {
|
|
106
|
-
return this.codigo[this.linha].charAt(this.atual - 1);
|
|
107
|
-
}
|
|
108
|
-
analisarTexto(delimitador = '"') {
|
|
109
|
-
while (this.simboloAtual() !== delimitador && !this.eFinalDoCodigo()) {
|
|
110
|
-
this.avancar();
|
|
111
|
-
}
|
|
112
|
-
if (this.eFinalDoCodigo()) {
|
|
113
|
-
this.erros.push({
|
|
114
|
-
linha: this.linha + 1,
|
|
115
|
-
caractere: this.simboloAnterior(),
|
|
116
|
-
mensagem: 'Texto não finalizado.',
|
|
117
|
-
});
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const valor = this.codigo[this.linha].substring(this.inicioSimbolo + 1, this.atual);
|
|
121
|
-
this.adicionarSimbolo(delegua_1.default.TEXTO, valor);
|
|
122
|
-
}
|
|
123
|
-
analisarNumero() {
|
|
124
|
-
while (this.eDigito(this.simboloAtual())) {
|
|
125
|
-
this.avancar();
|
|
126
|
-
}
|
|
127
|
-
if (this.simboloAtual() == '.' && this.eDigito(this.proximoSimbolo())) {
|
|
128
|
-
this.avancar();
|
|
129
|
-
while (this.eDigito(this.simboloAtual())) {
|
|
130
|
-
this.avancar();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
const numeroCompleto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
134
|
-
this.adicionarSimbolo(delegua_1.default.NUMERO, parseFloat(numeroCompleto));
|
|
135
|
-
}
|
|
136
|
-
identificarPalavraChave() {
|
|
137
|
-
while (this.eAlfabetoOuDigito(this.simboloAtual())) {
|
|
138
|
-
this.avancar();
|
|
139
|
-
}
|
|
140
|
-
const codigo = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
141
|
-
const tipo = codigo in palavras_reservadas_1.default ? palavras_reservadas_1.default[codigo] : delegua_1.default.IDENTIFICADOR;
|
|
142
|
-
this.adicionarSimbolo(tipo);
|
|
143
|
-
}
|
|
144
|
-
encontrarFimComentarioAsterisco() {
|
|
145
|
-
while (!this.eFinalDoCodigo()) {
|
|
146
|
-
this.avancar();
|
|
147
|
-
if (this.simboloAtual() === '*' && this.proximoSimbolo() === '/') {
|
|
148
|
-
this.avancar();
|
|
149
|
-
this.avancar();
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
analisarToken() {
|
|
155
|
-
const caractere = this.simboloAtual();
|
|
156
|
-
switch (caractere) {
|
|
157
|
-
case '[':
|
|
158
|
-
this.adicionarSimbolo(delegua_1.default.COLCHETE_ESQUERDO);
|
|
159
|
-
this.avancar();
|
|
160
|
-
break;
|
|
161
|
-
case ']':
|
|
162
|
-
this.adicionarSimbolo(delegua_1.default.COLCHETE_DIREITO);
|
|
163
|
-
this.avancar();
|
|
164
|
-
break;
|
|
165
|
-
case '(':
|
|
166
|
-
this.adicionarSimbolo(delegua_1.default.PARENTESE_ESQUERDO);
|
|
167
|
-
this.avancar();
|
|
168
|
-
break;
|
|
169
|
-
case ')':
|
|
170
|
-
this.adicionarSimbolo(delegua_1.default.PARENTESE_DIREITO);
|
|
171
|
-
this.avancar();
|
|
172
|
-
break;
|
|
173
|
-
case '{':
|
|
174
|
-
this.adicionarSimbolo(delegua_1.default.CHAVE_ESQUERDA);
|
|
175
|
-
this.avancar();
|
|
176
|
-
break;
|
|
177
|
-
case '}':
|
|
178
|
-
this.adicionarSimbolo(delegua_1.default.CHAVE_DIREITA);
|
|
179
|
-
this.avancar();
|
|
180
|
-
break;
|
|
181
|
-
case ',':
|
|
182
|
-
this.adicionarSimbolo(delegua_1.default.VIRGULA);
|
|
183
|
-
this.avancar();
|
|
184
|
-
break;
|
|
185
|
-
case '.':
|
|
186
|
-
this.adicionarSimbolo(delegua_1.default.PONTO);
|
|
187
|
-
this.avancar();
|
|
188
|
-
break;
|
|
189
|
-
case '-':
|
|
190
|
-
this.inicioSimbolo = this.atual;
|
|
191
|
-
this.avancar();
|
|
192
|
-
if (this.simboloAtual() === '=') {
|
|
193
|
-
this.adicionarSimbolo(delegua_1.default.MENOS_IGUAL);
|
|
194
|
-
this.avancar();
|
|
195
|
-
}
|
|
196
|
-
else if (this.simboloAtual() === '-') {
|
|
197
|
-
this.adicionarSimbolo(delegua_1.default.DECREMENTAR);
|
|
198
|
-
this.avancar();
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
this.adicionarSimbolo(delegua_1.default.SUBTRACAO);
|
|
202
|
-
}
|
|
203
|
-
break;
|
|
204
|
-
case '+':
|
|
205
|
-
this.inicioSimbolo = this.atual;
|
|
206
|
-
this.avancar();
|
|
207
|
-
if (this.simboloAtual() === '=') {
|
|
208
|
-
this.adicionarSimbolo(delegua_1.default.MAIS_IGUAL);
|
|
209
|
-
this.avancar();
|
|
210
|
-
}
|
|
211
|
-
else if (this.simboloAtual() === '+') {
|
|
212
|
-
this.adicionarSimbolo(delegua_1.default.INCREMENTAR);
|
|
213
|
-
this.avancar();
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
this.adicionarSimbolo(delegua_1.default.ADICAO);
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
case ':':
|
|
220
|
-
this.adicionarSimbolo(delegua_1.default.DOIS_PONTOS);
|
|
221
|
-
this.avancar();
|
|
222
|
-
break;
|
|
223
|
-
case '%':
|
|
224
|
-
this.inicioSimbolo = this.atual;
|
|
225
|
-
this.avancar();
|
|
226
|
-
switch (this.simboloAtual()) {
|
|
227
|
-
case '=':
|
|
228
|
-
this.avancar();
|
|
229
|
-
this.adicionarSimbolo(delegua_1.default.MODULO_IGUAL);
|
|
230
|
-
break;
|
|
231
|
-
default:
|
|
232
|
-
this.adicionarSimbolo(delegua_1.default.MODULO);
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
break;
|
|
236
|
-
case '*':
|
|
237
|
-
this.inicioSimbolo = this.atual;
|
|
238
|
-
this.avancar();
|
|
239
|
-
switch (this.simboloAtual()) {
|
|
240
|
-
case '*':
|
|
241
|
-
this.avancar();
|
|
242
|
-
this.adicionarSimbolo(delegua_1.default.EXPONENCIACAO);
|
|
243
|
-
break;
|
|
244
|
-
case '=':
|
|
245
|
-
this.avancar();
|
|
246
|
-
this.adicionarSimbolo(delegua_1.default.MULTIPLICACAO_IGUAL);
|
|
247
|
-
break;
|
|
248
|
-
default:
|
|
249
|
-
this.adicionarSimbolo(delegua_1.default.MULTIPLICACAO);
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
break;
|
|
253
|
-
case '!':
|
|
254
|
-
this.avancar();
|
|
255
|
-
if (this.simboloAtual() === '=') {
|
|
256
|
-
this.adicionarSimbolo(delegua_1.default.DIFERENTE);
|
|
257
|
-
this.avancar();
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
this.adicionarSimbolo(delegua_1.default.NEGACAO);
|
|
261
|
-
}
|
|
262
|
-
break;
|
|
263
|
-
case '=':
|
|
264
|
-
this.avancar();
|
|
265
|
-
if (this.simboloAtual() === '=') {
|
|
266
|
-
this.adicionarSimbolo(delegua_1.default.IGUAL_IGUAL);
|
|
267
|
-
this.avancar();
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
this.adicionarSimbolo(delegua_1.default.IGUAL);
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
case '&':
|
|
274
|
-
this.adicionarSimbolo(delegua_1.default.BIT_AND);
|
|
275
|
-
this.avancar();
|
|
276
|
-
break;
|
|
277
|
-
case '~':
|
|
278
|
-
this.adicionarSimbolo(delegua_1.default.BIT_NOT);
|
|
279
|
-
this.avancar();
|
|
280
|
-
break;
|
|
281
|
-
case '|':
|
|
282
|
-
this.adicionarSimbolo(delegua_1.default.BIT_OR);
|
|
283
|
-
this.avancar();
|
|
284
|
-
break;
|
|
285
|
-
case '^':
|
|
286
|
-
this.adicionarSimbolo(delegua_1.default.BIT_XOR);
|
|
287
|
-
this.avancar();
|
|
288
|
-
break;
|
|
289
|
-
case '<':
|
|
290
|
-
this.avancar();
|
|
291
|
-
if (this.simboloAtual() === '=') {
|
|
292
|
-
this.adicionarSimbolo(delegua_1.default.MENOR_IGUAL);
|
|
293
|
-
this.avancar();
|
|
294
|
-
}
|
|
295
|
-
else if (this.simboloAtual() === '<') {
|
|
296
|
-
this.adicionarSimbolo(delegua_1.default.MENOR_MENOR);
|
|
297
|
-
this.avancar();
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
this.adicionarSimbolo(delegua_1.default.MENOR);
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
case '>':
|
|
304
|
-
this.avancar();
|
|
305
|
-
if (this.simboloAtual() === '=') {
|
|
306
|
-
this.adicionarSimbolo(delegua_1.default.MAIOR_IGUAL);
|
|
307
|
-
this.avancar();
|
|
308
|
-
}
|
|
309
|
-
else if (this.simboloAtual() === '>') {
|
|
310
|
-
this.adicionarSimbolo(delegua_1.default.MAIOR_MAIOR);
|
|
311
|
-
this.avancar();
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
this.adicionarSimbolo(delegua_1.default.MAIOR);
|
|
315
|
-
}
|
|
316
|
-
break;
|
|
317
|
-
case '/':
|
|
318
|
-
this.avancar();
|
|
319
|
-
switch (this.simboloAtual()) {
|
|
320
|
-
case '/':
|
|
321
|
-
this.avancarParaProximaLinha();
|
|
322
|
-
break;
|
|
323
|
-
case '*':
|
|
324
|
-
this.encontrarFimComentarioAsterisco();
|
|
325
|
-
break;
|
|
326
|
-
case '=':
|
|
327
|
-
this.adicionarSimbolo(delegua_1.default.DIVISAO_IGUAL);
|
|
328
|
-
this.avancar();
|
|
329
|
-
break;
|
|
330
|
-
default:
|
|
331
|
-
this.adicionarSimbolo(delegua_1.default.DIVISAO);
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
break;
|
|
335
|
-
case '\\':
|
|
336
|
-
this.inicioSimbolo = this.atual;
|
|
337
|
-
this.avancar();
|
|
338
|
-
switch (this.simboloAtual()) {
|
|
339
|
-
case '=':
|
|
340
|
-
this.adicionarSimbolo(delegua_1.default.DIVISAO_INTEIRA_IGUAL);
|
|
341
|
-
this.avancar();
|
|
342
|
-
break;
|
|
343
|
-
default:
|
|
344
|
-
this.adicionarSimbolo(delegua_1.default.DIVISAO_INTEIRA);
|
|
345
|
-
break;
|
|
346
|
-
}
|
|
347
|
-
break;
|
|
348
|
-
// Esta sessão ignora espaços em branco na tokenização.
|
|
349
|
-
|
|
350
|
-
case '
|
|
351
|
-
case '\
|
|
352
|
-
case '\
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
case '
|
|
358
|
-
this.
|
|
359
|
-
this.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
this.
|
|
364
|
-
this.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
this.
|
|
389
|
-
this.
|
|
390
|
-
this.
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
this.
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Lexador = void 0;
|
|
7
|
+
const browser_process_hrtime_1 = __importDefault(require("browser-process-hrtime"));
|
|
8
|
+
const simbolo_1 = require("./simbolo");
|
|
9
|
+
const palavras_reservadas_1 = __importDefault(require("./palavras-reservadas"));
|
|
10
|
+
const delegua_1 = __importDefault(require("../tipos-de-simbolos/delegua"));
|
|
11
|
+
/**
|
|
12
|
+
* O Lexador é responsável por transformar o código em uma coleção de tokens de linguagem.
|
|
13
|
+
* Cada token de linguagem é representado por um tipo, um lexema e informações da linha de código em que foi expresso.
|
|
14
|
+
* Também é responsável por mapear as palavras reservadas da linguagem, que não podem ser usadas por outras
|
|
15
|
+
* estruturas, tais como nomes de variáveis, funções, literais, classes e assim por diante.
|
|
16
|
+
*/
|
|
17
|
+
class Lexador {
|
|
18
|
+
constructor(performance = false) {
|
|
19
|
+
this.performance = performance;
|
|
20
|
+
this.simbolos = [];
|
|
21
|
+
this.erros = [];
|
|
22
|
+
this.hashArquivo = -1;
|
|
23
|
+
this.inicioSimbolo = 0;
|
|
24
|
+
this.atual = 0;
|
|
25
|
+
this.linha = 0;
|
|
26
|
+
}
|
|
27
|
+
eDigito(caractere) {
|
|
28
|
+
return caractere >= '0' && caractere <= '9';
|
|
29
|
+
}
|
|
30
|
+
eAlfabeto(caractere) {
|
|
31
|
+
const acentuacoes = [
|
|
32
|
+
'á',
|
|
33
|
+
'Á',
|
|
34
|
+
'ã',
|
|
35
|
+
'Ã',
|
|
36
|
+
'â',
|
|
37
|
+
'Â',
|
|
38
|
+
'à',
|
|
39
|
+
'À',
|
|
40
|
+
'é',
|
|
41
|
+
'É',
|
|
42
|
+
'ê',
|
|
43
|
+
'Ê',
|
|
44
|
+
'í',
|
|
45
|
+
'Í',
|
|
46
|
+
'ó',
|
|
47
|
+
'Ó',
|
|
48
|
+
'õ',
|
|
49
|
+
'Õ',
|
|
50
|
+
'ô',
|
|
51
|
+
'Ô',
|
|
52
|
+
'ú',
|
|
53
|
+
'Ú',
|
|
54
|
+
'ç',
|
|
55
|
+
'Ç',
|
|
56
|
+
'_',
|
|
57
|
+
];
|
|
58
|
+
return ((caractere >= 'a' && caractere <= 'z') ||
|
|
59
|
+
(caractere >= 'A' && caractere <= 'Z') ||
|
|
60
|
+
acentuacoes.includes(caractere));
|
|
61
|
+
}
|
|
62
|
+
eAlfabetoOuDigito(caractere) {
|
|
63
|
+
return this.eDigito(caractere) || this.eAlfabeto(caractere);
|
|
64
|
+
}
|
|
65
|
+
eFinalDaLinha() {
|
|
66
|
+
if (this.codigo.length === this.linha) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return this.atual >= this.codigo[this.linha].length;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Indica se o código está na última linha.
|
|
73
|
+
* @returns Verdadeiro se contador de linhas está na última linha.
|
|
74
|
+
* Falso caso contrário.
|
|
75
|
+
*/
|
|
76
|
+
eUltimaLinha() {
|
|
77
|
+
return this.linha >= this.codigo.length - 1;
|
|
78
|
+
}
|
|
79
|
+
eFinalDoCodigo() {
|
|
80
|
+
return this.eUltimaLinha() && this.codigo[this.codigo.length - 1].length <= this.atual;
|
|
81
|
+
}
|
|
82
|
+
avancar() {
|
|
83
|
+
this.atual += 1;
|
|
84
|
+
if (this.eFinalDaLinha() && !this.eUltimaLinha()) {
|
|
85
|
+
this.linha++;
|
|
86
|
+
this.atual = 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
adicionarSimbolo(tipo, literal = null) {
|
|
90
|
+
const texto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
91
|
+
this.simbolos.push(new simbolo_1.Simbolo(tipo, literal || texto, literal, this.linha + 1, this.hashArquivo));
|
|
92
|
+
}
|
|
93
|
+
simboloAtual() {
|
|
94
|
+
if (this.eFinalDaLinha())
|
|
95
|
+
return '\0';
|
|
96
|
+
return this.codigo[this.linha].charAt(this.atual);
|
|
97
|
+
}
|
|
98
|
+
avancarParaProximaLinha() {
|
|
99
|
+
this.linha++;
|
|
100
|
+
this.atual = 0;
|
|
101
|
+
}
|
|
102
|
+
proximoSimbolo() {
|
|
103
|
+
return this.codigo[this.linha].charAt(this.atual + 1);
|
|
104
|
+
}
|
|
105
|
+
simboloAnterior() {
|
|
106
|
+
return this.codigo[this.linha].charAt(this.atual - 1);
|
|
107
|
+
}
|
|
108
|
+
analisarTexto(delimitador = '"') {
|
|
109
|
+
while (this.simboloAtual() !== delimitador && !this.eFinalDoCodigo()) {
|
|
110
|
+
this.avancar();
|
|
111
|
+
}
|
|
112
|
+
if (this.eFinalDoCodigo()) {
|
|
113
|
+
this.erros.push({
|
|
114
|
+
linha: this.linha + 1,
|
|
115
|
+
caractere: this.simboloAnterior(),
|
|
116
|
+
mensagem: 'Texto não finalizado.',
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const valor = this.codigo[this.linha].substring(this.inicioSimbolo + 1, this.atual);
|
|
121
|
+
this.adicionarSimbolo(delegua_1.default.TEXTO, valor);
|
|
122
|
+
}
|
|
123
|
+
analisarNumero() {
|
|
124
|
+
while (this.eDigito(this.simboloAtual())) {
|
|
125
|
+
this.avancar();
|
|
126
|
+
}
|
|
127
|
+
if (this.simboloAtual() == '.' && this.eDigito(this.proximoSimbolo())) {
|
|
128
|
+
this.avancar();
|
|
129
|
+
while (this.eDigito(this.simboloAtual())) {
|
|
130
|
+
this.avancar();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const numeroCompleto = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
134
|
+
this.adicionarSimbolo(delegua_1.default.NUMERO, parseFloat(numeroCompleto));
|
|
135
|
+
}
|
|
136
|
+
identificarPalavraChave() {
|
|
137
|
+
while (this.eAlfabetoOuDigito(this.simboloAtual())) {
|
|
138
|
+
this.avancar();
|
|
139
|
+
}
|
|
140
|
+
const codigo = this.codigo[this.linha].substring(this.inicioSimbolo, this.atual);
|
|
141
|
+
const tipo = codigo in palavras_reservadas_1.default ? palavras_reservadas_1.default[codigo] : delegua_1.default.IDENTIFICADOR;
|
|
142
|
+
this.adicionarSimbolo(tipo);
|
|
143
|
+
}
|
|
144
|
+
encontrarFimComentarioAsterisco() {
|
|
145
|
+
while (!this.eFinalDoCodigo()) {
|
|
146
|
+
this.avancar();
|
|
147
|
+
if (this.simboloAtual() === '*' && this.proximoSimbolo() === '/') {
|
|
148
|
+
this.avancar();
|
|
149
|
+
this.avancar();
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
analisarToken() {
|
|
155
|
+
const caractere = this.simboloAtual();
|
|
156
|
+
switch (caractere) {
|
|
157
|
+
case '[':
|
|
158
|
+
this.adicionarSimbolo(delegua_1.default.COLCHETE_ESQUERDO);
|
|
159
|
+
this.avancar();
|
|
160
|
+
break;
|
|
161
|
+
case ']':
|
|
162
|
+
this.adicionarSimbolo(delegua_1.default.COLCHETE_DIREITO);
|
|
163
|
+
this.avancar();
|
|
164
|
+
break;
|
|
165
|
+
case '(':
|
|
166
|
+
this.adicionarSimbolo(delegua_1.default.PARENTESE_ESQUERDO);
|
|
167
|
+
this.avancar();
|
|
168
|
+
break;
|
|
169
|
+
case ')':
|
|
170
|
+
this.adicionarSimbolo(delegua_1.default.PARENTESE_DIREITO);
|
|
171
|
+
this.avancar();
|
|
172
|
+
break;
|
|
173
|
+
case '{':
|
|
174
|
+
this.adicionarSimbolo(delegua_1.default.CHAVE_ESQUERDA);
|
|
175
|
+
this.avancar();
|
|
176
|
+
break;
|
|
177
|
+
case '}':
|
|
178
|
+
this.adicionarSimbolo(delegua_1.default.CHAVE_DIREITA);
|
|
179
|
+
this.avancar();
|
|
180
|
+
break;
|
|
181
|
+
case ',':
|
|
182
|
+
this.adicionarSimbolo(delegua_1.default.VIRGULA);
|
|
183
|
+
this.avancar();
|
|
184
|
+
break;
|
|
185
|
+
case '.':
|
|
186
|
+
this.adicionarSimbolo(delegua_1.default.PONTO);
|
|
187
|
+
this.avancar();
|
|
188
|
+
break;
|
|
189
|
+
case '-':
|
|
190
|
+
this.inicioSimbolo = this.atual;
|
|
191
|
+
this.avancar();
|
|
192
|
+
if (this.simboloAtual() === '=') {
|
|
193
|
+
this.adicionarSimbolo(delegua_1.default.MENOS_IGUAL);
|
|
194
|
+
this.avancar();
|
|
195
|
+
}
|
|
196
|
+
else if (this.simboloAtual() === '-') {
|
|
197
|
+
this.adicionarSimbolo(delegua_1.default.DECREMENTAR);
|
|
198
|
+
this.avancar();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.adicionarSimbolo(delegua_1.default.SUBTRACAO);
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case '+':
|
|
205
|
+
this.inicioSimbolo = this.atual;
|
|
206
|
+
this.avancar();
|
|
207
|
+
if (this.simboloAtual() === '=') {
|
|
208
|
+
this.adicionarSimbolo(delegua_1.default.MAIS_IGUAL);
|
|
209
|
+
this.avancar();
|
|
210
|
+
}
|
|
211
|
+
else if (this.simboloAtual() === '+') {
|
|
212
|
+
this.adicionarSimbolo(delegua_1.default.INCREMENTAR);
|
|
213
|
+
this.avancar();
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.adicionarSimbolo(delegua_1.default.ADICAO);
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case ':':
|
|
220
|
+
this.adicionarSimbolo(delegua_1.default.DOIS_PONTOS);
|
|
221
|
+
this.avancar();
|
|
222
|
+
break;
|
|
223
|
+
case '%':
|
|
224
|
+
this.inicioSimbolo = this.atual;
|
|
225
|
+
this.avancar();
|
|
226
|
+
switch (this.simboloAtual()) {
|
|
227
|
+
case '=':
|
|
228
|
+
this.avancar();
|
|
229
|
+
this.adicionarSimbolo(delegua_1.default.MODULO_IGUAL);
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
this.adicionarSimbolo(delegua_1.default.MODULO);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
case '*':
|
|
237
|
+
this.inicioSimbolo = this.atual;
|
|
238
|
+
this.avancar();
|
|
239
|
+
switch (this.simboloAtual()) {
|
|
240
|
+
case '*':
|
|
241
|
+
this.avancar();
|
|
242
|
+
this.adicionarSimbolo(delegua_1.default.EXPONENCIACAO);
|
|
243
|
+
break;
|
|
244
|
+
case '=':
|
|
245
|
+
this.avancar();
|
|
246
|
+
this.adicionarSimbolo(delegua_1.default.MULTIPLICACAO_IGUAL);
|
|
247
|
+
break;
|
|
248
|
+
default:
|
|
249
|
+
this.adicionarSimbolo(delegua_1.default.MULTIPLICACAO);
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
break;
|
|
253
|
+
case '!':
|
|
254
|
+
this.avancar();
|
|
255
|
+
if (this.simboloAtual() === '=') {
|
|
256
|
+
this.adicionarSimbolo(delegua_1.default.DIFERENTE);
|
|
257
|
+
this.avancar();
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.adicionarSimbolo(delegua_1.default.NEGACAO);
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
case '=':
|
|
264
|
+
this.avancar();
|
|
265
|
+
if (this.simboloAtual() === '=') {
|
|
266
|
+
this.adicionarSimbolo(delegua_1.default.IGUAL_IGUAL);
|
|
267
|
+
this.avancar();
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
this.adicionarSimbolo(delegua_1.default.IGUAL);
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
case '&':
|
|
274
|
+
this.adicionarSimbolo(delegua_1.default.BIT_AND);
|
|
275
|
+
this.avancar();
|
|
276
|
+
break;
|
|
277
|
+
case '~':
|
|
278
|
+
this.adicionarSimbolo(delegua_1.default.BIT_NOT);
|
|
279
|
+
this.avancar();
|
|
280
|
+
break;
|
|
281
|
+
case '|':
|
|
282
|
+
this.adicionarSimbolo(delegua_1.default.BIT_OR);
|
|
283
|
+
this.avancar();
|
|
284
|
+
break;
|
|
285
|
+
case '^':
|
|
286
|
+
this.adicionarSimbolo(delegua_1.default.BIT_XOR);
|
|
287
|
+
this.avancar();
|
|
288
|
+
break;
|
|
289
|
+
case '<':
|
|
290
|
+
this.avancar();
|
|
291
|
+
if (this.simboloAtual() === '=') {
|
|
292
|
+
this.adicionarSimbolo(delegua_1.default.MENOR_IGUAL);
|
|
293
|
+
this.avancar();
|
|
294
|
+
}
|
|
295
|
+
else if (this.simboloAtual() === '<') {
|
|
296
|
+
this.adicionarSimbolo(delegua_1.default.MENOR_MENOR);
|
|
297
|
+
this.avancar();
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
this.adicionarSimbolo(delegua_1.default.MENOR);
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
case '>':
|
|
304
|
+
this.avancar();
|
|
305
|
+
if (this.simboloAtual() === '=') {
|
|
306
|
+
this.adicionarSimbolo(delegua_1.default.MAIOR_IGUAL);
|
|
307
|
+
this.avancar();
|
|
308
|
+
}
|
|
309
|
+
else if (this.simboloAtual() === '>') {
|
|
310
|
+
this.adicionarSimbolo(delegua_1.default.MAIOR_MAIOR);
|
|
311
|
+
this.avancar();
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
this.adicionarSimbolo(delegua_1.default.MAIOR);
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
case '/':
|
|
318
|
+
this.avancar();
|
|
319
|
+
switch (this.simboloAtual()) {
|
|
320
|
+
case '/':
|
|
321
|
+
this.avancarParaProximaLinha();
|
|
322
|
+
break;
|
|
323
|
+
case '*':
|
|
324
|
+
this.encontrarFimComentarioAsterisco();
|
|
325
|
+
break;
|
|
326
|
+
case '=':
|
|
327
|
+
this.adicionarSimbolo(delegua_1.default.DIVISAO_IGUAL);
|
|
328
|
+
this.avancar();
|
|
329
|
+
break;
|
|
330
|
+
default:
|
|
331
|
+
this.adicionarSimbolo(delegua_1.default.DIVISAO);
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
break;
|
|
335
|
+
case '\\':
|
|
336
|
+
this.inicioSimbolo = this.atual;
|
|
337
|
+
this.avancar();
|
|
338
|
+
switch (this.simboloAtual()) {
|
|
339
|
+
case '=':
|
|
340
|
+
this.adicionarSimbolo(delegua_1.default.DIVISAO_INTEIRA_IGUAL);
|
|
341
|
+
this.avancar();
|
|
342
|
+
break;
|
|
343
|
+
default:
|
|
344
|
+
this.adicionarSimbolo(delegua_1.default.DIVISAO_INTEIRA);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
break;
|
|
348
|
+
// Esta sessão ignora espaços em branco na tokenização.
|
|
349
|
+
case ' ':
|
|
350
|
+
case '\0':
|
|
351
|
+
case '\r':
|
|
352
|
+
case '\t':
|
|
353
|
+
this.avancar();
|
|
354
|
+
break;
|
|
355
|
+
// Ponto-e-vírgula é opcional em Delégua, mas em alguns casos pode ser
|
|
356
|
+
// necessário. Por exemplo, declaração de `para` sem inicializador.
|
|
357
|
+
case ';':
|
|
358
|
+
this.adicionarSimbolo(delegua_1.default.PONTO_E_VIRGULA);
|
|
359
|
+
this.avancar();
|
|
360
|
+
break;
|
|
361
|
+
case '"':
|
|
362
|
+
this.avancar();
|
|
363
|
+
this.analisarTexto('"');
|
|
364
|
+
this.avancar();
|
|
365
|
+
break;
|
|
366
|
+
case "'":
|
|
367
|
+
this.avancar();
|
|
368
|
+
this.analisarTexto("'");
|
|
369
|
+
this.avancar();
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
if (this.eDigito(caractere))
|
|
373
|
+
this.analisarNumero();
|
|
374
|
+
else if (this.eAlfabeto(caractere))
|
|
375
|
+
this.identificarPalavraChave();
|
|
376
|
+
else {
|
|
377
|
+
this.erros.push({
|
|
378
|
+
linha: this.linha + 1,
|
|
379
|
+
caractere: caractere,
|
|
380
|
+
mensagem: 'Caractere inesperado.',
|
|
381
|
+
});
|
|
382
|
+
this.avancar();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
mapear(codigo, hashArquivo) {
|
|
387
|
+
const inicioMapeamento = (0, browser_process_hrtime_1.default)();
|
|
388
|
+
this.erros = [];
|
|
389
|
+
this.simbolos = [];
|
|
390
|
+
this.inicioSimbolo = 0;
|
|
391
|
+
this.atual = 0;
|
|
392
|
+
this.linha = 0;
|
|
393
|
+
this.codigo = codigo || [''];
|
|
394
|
+
this.hashArquivo = hashArquivo;
|
|
395
|
+
for (let iterador = 0; iterador < this.codigo.length; iterador++) {
|
|
396
|
+
this.codigo[iterador] += '\0';
|
|
397
|
+
}
|
|
398
|
+
while (!this.eFinalDoCodigo()) {
|
|
399
|
+
this.inicioSimbolo = this.atual;
|
|
400
|
+
this.analisarToken();
|
|
401
|
+
}
|
|
402
|
+
if (this.performance) {
|
|
403
|
+
const deltaMapeamento = (0, browser_process_hrtime_1.default)(inicioMapeamento);
|
|
404
|
+
console.log(`[Lexador] Tempo para mapeamento: ${deltaMapeamento[0] * 1e9 + deltaMapeamento[1]}ns`);
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
simbolos: this.simbolos,
|
|
408
|
+
erros: this.erros,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
exports.Lexador = Lexador;
|
|
409
413
|
//# sourceMappingURL=lexador.js.map
|