diff --git a/.vscode/launch.json b/.vscode/launch.json index f952bfb..cd3e996 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,19 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Lexador JSON", - "skipFiles": ["<node_internals>/**", "node_modules/**"], - "cwd": "${workspaceRoot}", - "console": "integratedTerminal", - "args": [ - "${workspaceFolder}${pathSeparator}teste-json.ts" - ], - "runtimeExecutable": "node", - "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"] - }, { "type": "node", "request": "launch", @@ -466,15 +453,28 @@ { "type": "node", "request": "launch", - "name": "Portugol IPT > Olá mundo", + "name": "Lexador JSON", + "skipFiles": ["<node_internals>/**", "node_modules/**"], + "cwd": "${workspaceRoot}", + "console": "integratedTerminal", + "args": [ + "${workspaceFolder}${pathSeparator}teste-json.ts" + ], + "runtimeExecutable": "node", + "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"] + }, + { + "type": "node", + "request": "launch", + "name": "Mapler > Olá Mundo", "skipFiles": ["<node_internals>/**", "node_modules/**"], "cwd": "${workspaceRoot}", "console": "integratedTerminal", "args": [ "${workspaceFolder}${pathSeparator}execucao.ts", "--dialeto", - "portugol-ipt", - "./exemplos/dialetos/portugol-ipt/ola-mundo.alg" + "mapler", + "./exemplos/dialetos/mapler/ola-mundo.mapler" ], "runtimeExecutable": "node", "runtimeArgs": [ @@ -486,15 +486,15 @@ { "type": "node", "request": "launch", - "name": "Portugol Studio > Número digitado", + "name": "Portugol IPT > Olá mundo", "skipFiles": ["<node_internals>/**", "node_modules/**"], "cwd": "${workspaceRoot}", "console": "integratedTerminal", "args": [ "${workspaceFolder}${pathSeparator}execucao.ts", "--dialeto", - "portugol-studio", - "./exemplos/dialetos/portugol-studio/numero-digitado.por" + "portugol-ipt", + "./exemplos/dialetos/portugol-ipt/ola-mundo.alg" ], "runtimeExecutable": "node", "runtimeArgs": [ @@ -506,7 +506,7 @@ { "type": "node", "request": "launch", - "name": "Portugol Studio > Olá mundo", + "name": "Portugol Studio > Número digitado", "skipFiles": ["<node_internals>/**", "node_modules/**"], "cwd": "${workspaceRoot}", "console": "integratedTerminal", @@ -514,7 +514,7 @@ "${workspaceFolder}${pathSeparator}execucao.ts", "--dialeto", "portugol-studio", - "./exemplos/dialetos/portugol-studio/ola-mundo.por" + "./exemplos/dialetos/portugol-studio/numero-digitado.por" ], "runtimeExecutable": "node", "runtimeArgs": [ @@ -526,15 +526,15 @@ { "type": "node", "request": "launch", - "name": "Mapler > Olá Mundo", + "name": "Portugol Studio > Olá mundo", "skipFiles": ["<node_internals>/**", "node_modules/**"], "cwd": "${workspaceRoot}", "console": "integratedTerminal", "args": [ "${workspaceFolder}${pathSeparator}execucao.ts", "--dialeto", - "mapler", - "./exemplos/dialetos/mapler/ola-mundo.mapler" + "portugol-studio", + "./exemplos/dialetos/portugol-studio/ola-mundo.por" ], "runtimeExecutable": "node", "runtimeArgs": [ @@ -676,6 +676,22 @@ "runtimeExecutable": "node", "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"] }, + { + "type": "node", + "request": "launch", + "name": "VisuAlg > Negativos", + "skipFiles": ["<node_internals>/**", "node_modules/**"], + "cwd": "${workspaceRoot}", + "console": "integratedTerminal", + "args": [ + "${workspaceFolder}${pathSeparator}execucao.ts", + "--dialeto", + "visualg", + "./exemplos/dialetos/visualg/negativos.alg" + ], + "runtimeExecutable": "node", + "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"] + }, { "type": "node", "request": "launch", diff --git a/execucao.ts b/execucao.ts index 6fa7c2d..e8ec610 100644 --- a/execucao.ts +++ b/execucao.ts @@ -4,7 +4,7 @@ import { Command } from 'commander'; const principal = async () => { const analisadorArgumentos = new Command(); analisadorArgumentos; - let codigoOuNomeArquivo: string; + let codigoOuNomeArquivo: string | undefined = undefined; analisadorArgumentos .helpOption('-h, --ajuda', 'Exibe a ajuda para o comando.') diff --git a/exemplos/dialetos/visualg/negativos.alg b/exemplos/dialetos/visualg/negativos.alg new file mode 100644 index 0000000..7849468 --- /dev/null +++ b/exemplos/dialetos/visualg/negativos.alg @@ -0,0 +1,27 @@ +algoritmo "negativos" + +var + + n, i: inteiro + vet: vetor [0..9] de inteiro + +inicio + + escreval("Quantos numeros voce vai digitar? ") + leia(n) + + para i de 0 ate n-1 faca + escreval("Digite um numero: ") + leia(vet[i]) + fimpara + + escreval(" ") + escreval("NUMEROS NEGATIVOS") + + para i de 0 ate n-1 faca + se (vet[i] < 0) entao + escreval(vet[i]) + fimse + fimpara + +fimalgoritmo \ No newline at end of file diff --git a/fontes/delegua.ts b/fontes/delegua.ts index eb24208..2f62275 100644 --- a/fontes/delegua.ts +++ b/fontes/delegua.ts @@ -17,16 +17,16 @@ import { NucleoTraducao } from './nucleo-traducao'; * correspondente à operação solicitada e observar a execução. */ export class Delegua implements DeleguaInterface { - lexador: LexadorInterface<any>; - avaliadorSintatico: AvaliadorSintaticoInterface<any, any>; - importador: ImportadorInterface<any, any>; + lexador: LexadorInterface<any> | undefined; + avaliadorSintatico: AvaliadorSintaticoInterface<any, any> | undefined; + importador: ImportadorInterface<any, any> | undefined; funcaoDeRetorno: Function; funcaoDeRetornoMesmaLinha: Function; constructor( - funcaoDeRetorno: Function = null, - funcaoDeRetornoMesmaLinha: Function = null + funcaoDeRetorno?: Function, + funcaoDeRetornoMesmaLinha?: Function ) { this.funcaoDeRetorno = funcaoDeRetorno || console.log; // `process.stdout.write.bind(process.stdout)` é necessário por causa de diff --git a/package.json b/package.json index 08047a7..39b809b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "testes:servidor-depuracao": "ts-node ./fontes/depuracao/servidor-depuracao.ts" }, "dependencies": { - "@designliquido/delegua": "0.25.12", + "@designliquido/delegua": "0.25.13", "chalk": "4.1.2", "commander": "^9.4.1", "json-colorizer": "^2.2.2", diff --git a/tsconfig.json b/tsconfig.json index 4e4cf6a..b598d96 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,10 @@ "outDir": "dist", "module": "CommonJS", "target": "es2017", + "mapRoot": "dist", "rootDir": ".", - "allowJs": true, + "strict": false, + "allowJs": false, "sourceMap": true, "declaration": true, "esModuleInterop": true, diff --git a/yarn.lock b/yarn.lock index adfe106..3dfa6eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -337,10 +337,10 @@ resolved "https://registry.yarnpkg.com/@designliquido/delegua-tempo/-/delegua-tempo-0.0.1.tgz#964834d127354857cda1c388f5de9327735b6747" integrity sha512-/O1/eXlTXPTWSZGZ862i6uHHKCW0cmP6KnOV29zK4d4hgn03QjcNDeFKVC9L9vz3OJ6pPY0d/S8ANJkgBnnoaQ== -"@designliquido/delegua@0.25.12": - version "0.25.12" - resolved "https://registry.yarnpkg.com/@designliquido/delegua/-/delegua-0.25.12.tgz#cb76ac0ff7305f3438ea118b6d47cf64de1a5a7d" - integrity sha512-/pIPBJX+1cu9bSb88q8sHEs5TWUhVA6L/B//up4avgSc2tjmzhTR3sWKWg+hjTtrqTDgmhdsSzA2//arObJj3Q== +"@designliquido/delegua@0.25.13": + version "0.25.13" + resolved "https://registry.yarnpkg.com/@designliquido/delegua/-/delegua-0.25.13.tgz#02cb5e371b08c0025f42833969a5e2fcb51b19b2" + integrity sha512-kKdZenbNODJ9iqiBhoXoxiSgSozh/mSK+uKIBGYpl7mR1T8sG/eqIBaik2qDtrOiBp6tngHKVArVZ4qVut/dzA== dependencies: antlr4ts "^0.5.0-alpha.4" browser-process-hrtime "^1.0.0"